On Wed, Aug 23, 2017 at 11:23 AM, Clément Aubin <[email protected]> wrote:
Hi everyone !
So, recently I have been dealing with a module that uses two kind of translation strings.
- "Static" translations : the title of a block, a xHint, … the translation key itself is not meant to be changed over time. - "Dynamic" translations : things like : - mymodule.component.<componentId>.name - mymodule.component.<componentId>.description Those are translation strings that depend on a parameter (here componentId) that can be part of a list.
If you want a better in-context example, check out this gist : https://gist.github.com/aubincleme/19edb249082185deedc8ec36fe354d42
Currently, we don’t have a lot of best practices regarding the translation keys (see the doc : http://dev.xwiki.org/xwiki/bin/view/Community/DevelopmentPractices# HTranslationBestPractices), so it may b nice to think about improving them.
We have quite a few best practice rules, but on http://dev.xwiki.org/xwiki/bin/view/Community/L10N%20Conventions , which is linked from the place you mentioned.
Here are some proposals :
* For translation keys used for a livetable, we could use the following : <prefix>.<liveTableId>Table.<columnName> or <prefix>.table.<columnName> if the livetable doesn’t have a specific id.
* If we deal with "dynamic" translation keys, it would be nice to mark them as different from the others with an underscore (_) prefix, or a specific keyword.
WDYT ?
Thanks, Clément