Spigot [API] I18N - Translate your plugins easier than ever before! - v1.8 - v1.11 1.4.0

Internationalization API for use with CraftBukkit / Spigot

  1. BlackyPaw submitted a new resource:

    I18N - Internationalization API for use with CraftBukkit / Spigot

    Read more about this resource...
     
  2. nice and free ! i hope next update!
     
  3. Is it possibile that the plugin detects the Language a user has set in the language options?
     
  4. I don't precisely know what you mean by "detects". In fact, there is no way, the plugin can reliably identify where a player is coming from as not even IP ranges are an entirely reliable source. Yet, if you insist to do so you can always implement the LocaleResolver interface and then implement an IP lookup yourself. Afterwards you simply pass the plugin your custom locale resolve via I18NUtilities.setLocaleResolver( ... ); and you are good to go.

    EDIT: If by "detect" you mean "store" then yes - this is possible with the DATABASE locale resolver which you can configure inside the plugin's configuration file.
     
  5. Hello BlackyPaw, your plugin is realy awesome, i love it, and the API is pretty easy to use, but I have a question, i can't find in your javadoc how to translate a scoreboard, I have to set a different scoreboard for each player or just one with a function ?

    Best regards,
    Lucas
     
  6. Hey LucasKeur,

    first of all, thank you for the praise, I really appreciate it!

    Answering your question: Wherever you would normally put text such as the team's name, prefix, suffix, the score's name, etc. into a scoreboard you can simply use whatever is returned to you by your localizer instance - I18N handles the rest automatically for you. See below for an example. Please note, though, that in case a player switches his language whilst viewing the scoreboard you will have to display the scoreboard to him again manually so that he will see the translations in his new language. I will probably add an event to account for these circumstances in the next snapshot.

    Example code:
    Code (Text):

    Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();

    Team team = scoreboard.registerNewTeam( "team" );
    team.setDisplayName( this.localizer.inject( "team.name" ) );
    team.addEntry( player.getName() );

    Objective objective = scoreboard.registerNewObjective( "test", "dummy" );
    objective.setDisplayName( this.localizer.inject( "objective.name" ) );
    objective.setDisplaySlot( DisplaySlot.SIDEBAR );

    Score goal = objective.getScore( this.localizer.inject( "score.name" ) );
    goal.setScore( 15 );

    player.setScoreboard( scoreboard );
     
    Feel free to ask again, if anything is left unanswered.

    Best regards,
    BlackyPaw.
     
    #10 BlackyPaw, May 14, 2016
    Last edited: May 14, 2016
    • Like Like x 1
  7. Thanks for your fast reply, I really appreciate it.
    Thanks for your answer too, that works now !

    But i have another question but, when I try to change my language to ANY language that say to my "Failed to set your preferred language!", and i don't have any error in console, you now why ?

    Best regards,
    LucasKeur
     
    #11 LucasKeur, May 14, 2016
    Last edited: May 14, 2016
  8. Hey,

    what do you specify as your language parameter? It should be an ISO639 code such as "de" or "en" not "English" or "German".

    Best regards,
    BlackyPaw.

    EDIT: Also, make sure to configure a locale resolver which allows you to actually change your language: do not choose CONSTANT but DATABASE instead or write your own.
     
  9. Sorry, I forget to setup the database, that's works well now, ty

    Best regards,
    LucasKeur
     
  10. BlackyPaw updated [API] I18N - Internationalize your plugins! with a new update entry:

    Update to Version 0.4.0-SNAPSHOT: Added PlayerSetLanguageEvent

    Read the rest of this update entry...
     
  11. Actually, it is possible to get a clients Language Setting set in the 'Language' Menu in Minecraft itself. It will be sended using a Packet. This will be sended when a player joins or change his options. I submited a Pull Request that listens for that Packet and then sets the Language in the Plugin itself to that language.
     
  12. BlackyPaw updated [API] I18N - Internationalize your plugins! with a new update entry:

    Update to Version 0.5.0-SNAPSHOT: Added PlayerLanguageSettingEvent

    Read the rest of this update entry...
     
  13. BlackyPaw updated [API] I18N - Internationalize your plugins! with a new update entry:

    Update to Version 0.6.0-SNAPSHOT: Added support for translated display names of ItemStacks

    Read the rest of this update entry...
     
  14. BlackyPaw updated [API] I18N - Internationalize your plugins! with a new update entry:

    Update to Version 0.7.0-SNAPSHOT: Compatibility with Minecraft 1.10.2

    Read the rest of this update entry...
     
  15. BlackyPaw updated [API] I18N - Internationalize your plugins! with a new update entry:

    Update to Version 0.7.1-SNAPSHOT: Fixed chat formatting bug and enhanced TranslationStorage

    Read the rest of this update entry...