-
Notifications
You must be signed in to change notification settings - Fork 0
Internationalization
All pages except moderator and admin pages must be translated. That means you should never add any direct text output to these pages.
Use a plugin so that you can edit the language files all at once (Resources.de.l3s.learnweb.lang
) as a Bundle.
Eclipse: Use ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
IntelliJ IDEA: you don't need any plugin to edit resources as a bundle, but you may need a RBESort plugin to sort messages
Add the English translation to messages.properties
, you don't need to put them into messages_en_UK.properties
.
Always put a comment into messages_xy.properties
where and in which context the translation is used.
This is especially important for single words. Their translation can vary by context.
If one of the other supported languages is your mother language you have to add this as well.
You should use snake_case
for all messages keys, you can also use .
to separate a component where the key is used.
General words like "Create", "Apply", "Continue" should not be added to components, they should be reused across the system.
Examples
apply = Apply hello_world = Hello World! glossary.confirm_delete = Do you really want to delete the glossary? group_resource.select_more_resources = You need to
select more resources!
You should avoid modifying files directly, use a plugin (Bundle editor) to create new and update existing keys!
You can and should use placeholders like in examples below. Read MessageFormat
docs from references for documentation
The resource {0} has been deleted.
You can also use simple switches to format numbers:
{0, choice, 0#Not rated yet|1#One vote|1<{0} Votes} <h:outputFormat value="#{msg.votes}"><f:param value="#{result.resource.rateNumber}" /></h:outputFormat>
Sometimes you need to set a formatted message as an attribute value. Then you can't use h:outputFormat
but Omnifaces provides a solution: <o:outputFormat> or of:formatX().
We have extended the resourceBundle to support constants. Hence a usual definition like
application.name = Learnweb
can be included in other definitions. E.g.:
homepageTitle = Welcome to #[application.name]
You should never write "Learnweb" in any translation but use #[application.name] instead.
Never concatenate translations like this:
#{msg['ForumIndex.messages']} #{msg.of} #{forumPostBean.topic.title}
Either use a parametrized msg as described before or for less important messages a simple definition is also sufficient:
#{msg['ForumIndex.topic']}: #{forumPostBean.topic.title}
Also don't leave punctuation characters outside of a message. Don't do:
<h:outputText value="#{msg['consent_is_required ']}." /> <h:outputText value="#{msg['delete_confirm_dialog_content']}?" />
Instead, add them directly to the message, like:
consent_is_required = You need to agree with it. delete_confirm_dialog_content = Do you really want to delete the selected items?
Pages in the folder /lw/admin
shall not be translated to avoid unncessary work for translators.
But you should reuse translations if they already exists like title
or options