- What Are .rs Files?
- Creating and Using Resources
- Do I Need to Know All of Those Languages?
- TODO_TRANSLATE_AGAIN
What Are .rs Files?
To support different languages inside CET we use resource files. The resource file contains the translations of words or sentences in different languages and when using them in code, the appropriate translation of that resource is shown in CET.
An example from base/cm/std/accessories/accessories.rs can be seen below:
$SnowmanTip { english "Snowman"; swedish "Snögubbe"; danish "Snemand"; spanish "Hombre de Nieve"; french "Bonhomme de neige"; norwegian "Snømann"; chinese "雪人"; german "Snowman"; dutch "Sneeuwpop"; finnish "Lumimies"; englishuk "Snowman"; japanese "雪だるま"; status "reviewed"; }
The resource is being used in base/cm/std/wall/library.cm:
limb SnapperLimb snowman(pkg=external, "Snowman", uiPure3D, toolTipText=getRs("SnowmanTip", external));
So if one were to change the language inside CET to Swedish one would instead see "Snögubbe" instead of "Snowman" as a tooltip when hovering over the Snowman snapper in the toolbox.
Creating and Using Resources
$newWord { english "New word"; swedish "Nytt ord"; }
Resource in Resource
A resource could also be used inside another resource, like so:
$cet { english "CET"; swedish "CET" } $love { english "I love $cet"; swedish "Jag älskar $cet"; }
Using a Resource Without Any Translations
If a resource is used that does not list any translation at the moment, it'll just return the resource string.
{ pln($nothing); }
Output: $nothing
Do I Need to Know All of Those Languages?
Fortunately no! An english translation of the word/phrase is sufficient.
Core exports the internal .rs files and then sends them to the different translators.
The resources that will be sent to the translators are:
- Resources without some translations. I.e. resources completely missing one or a few languages.
- Resources marked with
TODO_TRANSLATE_AGAN
After receiving the translations, Core will import the new translations.
TODO_TRANSLATE_AGAIN
If you want a resource in an internal package to be translated again, please add this comment: TODO_TRANSLATE_AGAIN
.
Example:
$attributes { // TODO_TRANSLATE_AGAIN english "Dynamic"; spanish "Dinámico"; norwegian "Dynamisk"; swedish "Dynamisk"; french "Dynamique"; danish "Dynamisk"; chinese "动态"; german "Dynamisch"; }
This means that the $attributes
resource will be sent to our translators again. This is typically wanted if an already existing word/phrase has been updated.
TODO
comment shouldn’t be added if the resource never has been translated before, since all missing languages are sent to the translators.
Comments
0 comments
Please sign in to leave a comment.