| NOTE | |:---------------------------| | Work in progress: English translation has been generated locally from French with libretranslate. It is far from correct, and for testing purposes only. |
Internationalization (also i18n) is the process of easing the use of different languages in a software 1.
To facilitate switching language in easieR
, dictionnary files have been created in the ./R
directory of this package.
They are named according to the language they correspond to (e.g. fr_FR
), and contain almost every strings visible to users.
Those files can be copied and translated into another language "easily".
Each of the strings they contain is associated to a variable's name (its specific identifier).
Those variables act like placeholders in easieR code, pointing to their matching string.
Files in this folder can therefore be seen as mutable dictionnaries.
Any number of dictionnaries can be created for different languages.
To avoid collision with easieR or other packages variables, placeholders must have unique variables names (their identifiers). For now, there are three types of placeholders, all starting with a specific pattern :
ask_
. They are asking the user to do something.desc_
. They describe/indicate something (titles, windows names, how $x$ works, etc.)txt_
. TODO.Those categories are not well delimited, but it will be quite easy to modify them in the future.
⚠ I bare full responsibility for poorly named variables. While strings translation was done with libretranslate, variables name were written by hand... casually. They therefore contain bad anglicisms and errors, but I hope changing them now to be less costly than redesigning the language system itself.
Some strings are better to be hard coded in easieR scripts, for example packages names (BayesFactor
, outliers
,...).
To avoid mistakes during translation, I surrounded those strings with single quotes ('
) instead of double quotes ("
).
Double quotes are now reserved for placeholders (i.e. replacable strings) (to be done).
Translation process might have been a bit agressive, with some invisible-to-the-user strings uselessly replaced by placeholders. While not affecting easieR proper operation, it has made the code less easy to read.
To continue coding on easieR with strings displayed in place of placeholders, one script will help switching between strings and placeholders (TODO).
easieR
?Apparently no. But testing required!
Same analysis on same datasets gave exact same results for:
Not tested :
1) switch
cannot match EXPR
to variables, even if they point to a string. That's why I replaced every switch
by if..else
conditions.
2) The "dictionnaries" method loads a lot of objects in memory. This is potentially annoying. Placeholders variables are stored in accessible variables. Moreove those variables are made global (might not be good practise).
.dico
into which placeholders are stored.Interface
> Choose language
) or command-line (e.g. load_language("English")
)Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.