Plugin inline translations

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3373
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Plugin inline translations

#1

Post by Lobby » Sat Dec 08, 2018 15:15

Until now the only way to translate plugins was by doing it hardcoded in the project itself. That means you weren't able to provide translations for your own plugins and rather had to offer different variants in order to offer localization.

Version 1.5.56 will solve that by introducing inline translations for plugins. The way this will work is by using a special syntax within the plugin. Let's have a look at this example from the wandering animals plugin:

Code: Select all

"title":"Wandering animals"
That's how the title definition looks right now. This notion will still work in the future, but we can append specialized translations to it by writing [languagetag]Translation. For example for the case of a German translation that would look like:

Code: Select all

"title":"Wandering animals[de]Streunende Tiere"
You can append as many specialized translations as you want to. The game will then pick that one that's closest to the current language. The first case (here the English one without []) will be used as a fallback translation if no other translation does fit. I recommend to use English for it.

This special syntax will also work for the text attribute.

Note that only languages that are supported by the game naively can be translated that way. Have a look at the public translation repository for the supported language codes right now.
...Have a nice stay

User avatar
CommanderABab
AB
Reactions:
Posts: 7877
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Plugin inline translations

#2

Post by CommanderABab » Mon Dec 31, 2018 4:14

When using foreign alphabets with QuickEdit, be sure to change the Default Encoding for files from auto detect to one of the encodings that includes your alphabet. Otherwise the next time you load it the foreign alphabet will look like this: "????? ?????????? ??????". :/
770!770Currently using alpha 770. 770 What's new? :)
Need plugins dialog!!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
Lobby
Developer
Reactions:
Posts: 3373
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Re: Plugin inline translations

#3

Post by Lobby » Tue Feb 05, 2019 19:10

I recommend to use UTF8 whenever possible.
...Have a nice stay

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”

Who is online

Users browsing this forum: No registered users and 1 guest