Created

Sep 16, 2013

i18n and the comment parameter

Posted by Feike Visser

Today I had a small issue to implement a translation for an i18n call, via this post I want you to show the issue and how to resolve it.

It has to do that you can specify a 'comment' in your i18n call to give the translators more context.

This was the i18n content I wanted to translate. This is located in the ratings-component.

i18n.get("I love it", "Rating meaning for 5 stars")

My thinking was that a sling:key with the value of 'I love it' should be enough.

Well it is not, because of the comment that is specified (Rating meaning for 5 stars).

When you have a comment, the i18n-api expects the following sling:key "I love it ((Rating meaning for 5 stars))"

Below an example with a nice Dutch translation.

ratings2

Related docs

i18n Javadoc

 

Happy coding.

@heervisscher