-
Notifications
You must be signed in to change notification settings - Fork 18
pyloc
daniel-flassig edited this page May 10, 2020
·
12 revisions
Mark a string as translatable / fetch the translated string. Please read this tutorial to understand how to translate your plugin.
pyloc(translatable_string)often written as
pyloc "This string can be translated!"| Parameter | Type | Description |
|---|---|---|
translatable_string |
literal_string |
String that might need translation |
| Type | Description |
|---|---|
string |
The translated string. If no translation is found in the current language, then translatable_string is returned directly. |
Note that the parameter of pyloc must be a literal string. So the following would NOT work in practice
function test()
return "This string cannot be translated!"
end
pyloc(test())because the string will NOT appear in the translation base file. You should instead write:
function test()
return pyloc "This string can be translated!"
end
test()If you have to change the original text and do not want to break existing translations, then use one of the following syntax variations:
pyloc(translatable_string, original_string)
pyloc(translatable_string, translation_id)| Parameter | Type | Description |
|---|---|---|
translatable_string |
string |
Newest version of the string that needs to be translated |
original_string |
string |
Original version of the string to be translated (the hash of this string is used as the id in the xliff file) |
translation_id |
integer |
Explicit unique unit@id to be used in the xliff file (recommended only for experienced programmers) |