Coder Social home page Coder Social logo

reversetranslation's Introduction

ReverseTranslation

S: Server, C: Client

S: {Item, Block}Name ==[ReverseTranslation]==> NamespacedID ==[TranslationContainer]

C: TextPacket ==[Client side i18n]==> Client locale {Item, Block}Name

resources/{API}_v{MinecraftVersion}.json

auto generated.

Usage

as plugin

plugin.yml

depends:
 - ReverseTranslation # fuyutsuki/ReverseTranslation

as virion

poggit.yml

# Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/author/YourProject
branches:
  - master
projects:
  YourProject:
    path: ""
    icon: ""
    libs:
      - src: fuyutsuki/ReverseTranslation/libReverseTranslation
        version: 1.14.30

API

src/example/ExamplePlugin/Main.php

<?php

declare(strict_types=1);

namespace example\ExamplePlugin;

use pocketmine\event\block\BlockBreakEvent;
use pocketmine\event\Listener;
use pocketmine\plugin\PluginBase;
use jp\mcbe\ReverseTranslation\ReverseTranslator;

class Main extends PluginBase implements Listener {

    /** @var ReverseTranslator */
    private $rt;
    
    public function onEnable() {
        $this->rt = ReverseTranslator::getInstance();
    }

    public function onBreakBlock(BlockBreakEvent $ev) {
        $block = $ev->getBlock();
        $player = $ev->getPlayer();
        $item = $player->getInventory()->getItemInHand();
        
        $player->sendTranslation("What you have: {$this->rt->fromItem($item)}");
        $player->sendTranslation("What you broke: {$this->rt->fromBlock($block)}");
    }

}

or you can use json file directly!

reversetranslation's People

Contributors

fuyutsuki avatar pjz9n avatar poggit-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

pjz9n

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.