[1.2.4] About i18n

26 views
Skip to first unread message

AleX

unread,
Jun 3, 2012, 5:36:25 AM6/3/12
to play-fr...@googlegroups.com
Hello,

I have a few questions about i18n and play framework 1.2.x :) I already use messages files to translate strings according to people language (messages, messages.fr...) but:
  1. Is it possible to use more than one file per language (for maintenance purpose, i would like to split my properties files (eg : messages.fr, countryLabels.fr...). If yes, which rules should i follow (file name, location...) ?
  2. How to translate enum values ? For example, i use an enum "Country" and if a get the UK value in my template, i would like to display "United Kingdom" for english people, "Royaume Uni" for french etc...
Best regards,

Alex

Marcel Klemenz

unread,
Jun 3, 2012, 9:23:53 AM6/3/12
to play-fr...@googlegroups.com
I don't know if you can use multiple files per  language , but enum values can be translated this way:
&{myLangEnum}
and the messages file looks like
uk =  United Kingdom
fr = Royaume Uni
if this does not work try 
&{myLangEnum.getName()} 

you can use prefixes, too:
&{"langCode_" + myLangEnum} 
langCode_uk =  United Kingdom

greets,
Marcel
Reply all
Reply to author
Forward
0 new messages