Dynamic i18n.Messages - translation

280 views
Skip to first unread message

Siiim

unread,
Oct 7, 2011, 7:54:23 AM10/7/11
to play-framework
Hello,

I would like to know if it's possible to create/edit the files
messages.en, messages.fr dynamically? maybe by storing them into
database ?

I want to able admin users to translate themselves the website, with a
big form including the list of all the keys and values corresponding
in each language.

I want to know if there is a best way to do it, or a module, or if
somebody have already try it.

Thank you, and sorry for my english.

Fehmi Can SAĞLAM

unread,
Oct 7, 2011, 8:01:59 AM10/7/11
to play-fr...@googlegroups.com, Siiim
There is @messages module. Although it does not provide what you want
exactly, it has screens for editing messages for available languages in
DEV mode.
http://www.playframework.org/modules/messages

Once I created video for this module(in Turkish). You may also check it.
http://youtu.be/R4s_ayS01Ks

Siiim

unread,
Oct 7, 2011, 9:33:33 AM10/7/11
to play-framework
Really helpful module !
I want something like that to change translation messages, but in PROD
mode.
But thank you for the link, I will probably use it for now.

Thanks

On 7 oct, 14:01, Fehmi Can SAĞLAM <fehmican.sag...@gmail.com> wrote:
> There is @messages module. Although it does not provide what you want
> exactly, it has screens for editing messages for available languages in
> DEV mode.http://www.playframework.org/modules/messages
>
> Once I created video for this module(in Turkish). You may also check it.http://youtu.be/R4s_ayS01Ks

Steve Chaloner

unread,
Oct 12, 2011, 4:41:44 PM10/12/11
to play-framework
Take a look at http://www.objectify.be/wordpress/?p=163 - it's a
rethink of an idea that I used in production, and is a much better
approach than that initial implementation. Might be worth fleshing
out into a fuller description, but it'll certainly give you one
approach to get started.

On Oct 7, 3:33 pm, Siiim <simon....@gmail.com> wrote:
> Really helpful module !
> I want something like that to change translation messages, but in PROD
> mode.
> But thank you for the link, I will probably use it for now.
>
> Thanks
>

Peter Hilton - committer (Lunatech)

unread,
Oct 13, 2011, 4:43:26 AM10/13/11
to play-fr...@googlegroups.com
You can do this with a plug-in:
  1. In your application, add a class I18nPlugin extends play.PlayPlugin
  2. Override the getMessage method to do something like look-up a value in the database
  3. Add the file conf/play.plugins containing the plug-in priority and fully-qualified class name, e.g. 1000:i18n.I18nPlugin
Reply all
Reply to author
Forward
0 new messages