How to internationalize javascript messages in Grails 2.3

58 views
Skip to first unread message

Pavel Zakharov

unread,
Aug 13, 2015, 2:54:10 AM8/13/15
to Grails Dev Discuss
Hi guys, i have some trouble. Someone know how use localization in grails 2.3 for javascript messages ?

Søren Berg Glasius

unread,
Aug 13, 2015, 3:37:00 AM8/13/15
to grails-de...@googlegroups.com
You could make a controller that takes a message key and returns a value, then have your javascript populate it's messages by calling this controller via Ajax, given the browsers locale.


Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.

On 13 August 2015 at 08:54, Pavel Zakharov <pza...@gmail.com> wrote:
Hi guys, i have some trouble. Someone know how use localization in grails 2.3 for javascript messages ?

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/5848a048-f2b3-4c86-ac21-bb202b7cbc2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pavel Zakharov

unread,
Aug 13, 2015, 4:18:47 AM8/13/15
to Grails Dev Discuss
Oh, thank's for reply. Hm, you talk, that i must to send message from controller to JS?  Did you have example? I listen about JAWR lib, but when i try using here in Grails, i have same exceptions.

четверг, 13 августа 2015 г., 0:37:00 UTC-7 пользователь Søren Berg Glasius написал:
You could make a controller that takes a message key and returns a value, then have your javascript populate it's messages by calling this controller via Ajax, given the browsers locale.


Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.

On 13 August 2015 at 08:54, Pavel Zakharov <pza...@gmail.com> wrote:
Hi guys, i have some trouble. Someone know how use localization in grails 2.3 for javascript messages ?

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+unsub...@googlegroups.com.

Søren Berg Glasius

unread,
Aug 13, 2015, 7:51:02 AM8/13/15
to grails-de...@googlegroups.com
Hi Pavel,

Just did a quick search, and found this plugin: https://github.com/dellermann/i18n-asset-pipeline (if you are using Asset Pipeline plugin, if not, I suggest you take a look at the plugin code and see if you can reuse some of it, or better, switch to Asset Pipeline :) )



Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.

On 13 August 2015 at 10:18, Pavel Zakharov <pza...@gmail.com> wrote:
Oh, thank's for reply. Hm, you talk, that i must to send message from controller to JS?  Did you have example? I listen about JAWR lib, but when i try using here in Grails, i have same exceptions.

четверг, 13 августа 2015 г., 0:37:00 UTC-7 пользователь Søren Berg Glasius написал:
You could make a controller that takes a message key and returns a value, then have your javascript populate it's messages by calling this controller via Ajax, given the browsers locale.


Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.

On 13 August 2015 at 08:54, Pavel Zakharov <pza...@gmail.com> wrote:
Hi guys, i have some trouble. Someone know how use localization in grails 2.3 for javascript messages ?

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.

To post to this group, send email to grails-de...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages