Page 1 of 1

Plugin inline translations

Posted: 08 Dec 2018, 15:15
by Lobby
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.

Re: Plugin inline translations

Posted: 31 Dec 2018, 04:14
by CommanderABab
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: "????? ?????????? ??????". :/

Re: Plugin inline translations

Posted: 05 Feb 2019, 19:10
by Lobby
I recommend to use UTF8 whenever possible.

Re: Plugin inline translations

Posted: 26 Apr 2022, 15:18
by Pederont
Inline translation doesn't work with requirement text?

Re: Plugin inline translations

Posted: 26 Apr 2022, 18:51
by CommanderABab
You would have to provide the language tags in the text [RU]текст, [EN]text, etc

Re: Plugin inline translations

Posted: 19 Aug 2022, 19:18
by Mako1137
Can you please add the Filipino language? I'm an inactive speaker.
Language tag: [tl].

@Lobby

Re: Plugin inline translations

Posted: 21 Aug 2022, 03:49
by Naufhal
Filipino language is already added in game setting.

Re: Plugin inline translations

Posted: 17 Sep 2022, 20:28
by Mako1137
Naufhal wrote:
21 Aug 2022, 03:49
Filipino language is already added in game setting.
I meant the language tag at the Github

Re: Plugin inline translations

Posted: 18 Sep 2022, 04:58
by Naufhal
Probably b+fil are filipino.

Re: Plugin inline translations

Posted: 14 Oct 2022, 05:19
by Lakan Haraya
@Mako1137
Heya! Use [fil] instead of [tl] for that ;)

Code: Select all

"text":"Hello![fil]Kumusta!"

Re: Plugin inline translations

Posted: 09 Feb 2024, 17:11
by Pederont

Code: Select all

"requirements":[{
"type":"CONDITION", 
"data":{"condition":{"type":"building count", "id":"$containment_building_02_pederont", "min":0, "max":0}, 
"text": "Must not own upgraded building[ko]업그레이드한 건물이 없어야 합니다"}
}]
I wanted inline translation on requirement text but it just prints entire text.