How to internationalize javascript messages in Grails 2.3

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to internationalize javascript messages in Grails 2.3

Pavel Zakharov
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: How to internationalize javascript messages in Grails 2.3

sbglasius
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 <[hidden email]> 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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAGY%2BWWR%2BvzhEmhRxnARZStFUC0DpTLwTcG%2BLPftqeGa8fm%2BK6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to internationalize javascript messages in Grails 2.3

Pavel Zakharov
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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="VlKSfg6_DAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">pza...@...> 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="VlKSfg6_DAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">grails-dev-discuss+unsubscribe@....
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="VlKSfg6_DAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/5848a048-f2b3-4c86-ac21-bb202b7cbc2f%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/5848a048-f2b3-4c86-ac21-bb202b7cbc2f%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/5848a048-f2b3-4c86-ac21-bb202b7cbc2f%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/grails-dev-discuss/5848a048-f2b3-4c86-ac21-bb202b7cbc2f%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/20fb06a5-b95b-49f1-8734-4ecb2584bc80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to internationalize javascript messages in Grails 2.3

sbglasius
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 <[hidden email]> 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: <a href="tel:%2B45%2040%2044%2091%2088" value="+4540449188" target="_blank">+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 <[hidden email]> 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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/20fb06a5-b95b-49f1-8734-4ecb2584bc80%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAGY%2BWWRuPsRmgAQTam%2BRfuKbVGjXNnoKKKu0vVkWMN7BdeOTxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to internationalize javascript messages in Grails 2.3

menilub
This post has NOT been accepted by the mailing list yet.
In reply to this post by Pavel Zakharov
two options

1. as already suggested here if you are using assets you can use - https://github.com/dellermann/i18n-asset-pipeline

2. i was using in onw of my projects JS plugin like https://github.com/jquery-i18n-properties/jquery-i18n-properties
same convention like grails properties file - you will need to add a script (in script section that will trigger during compile or build) that copies the properties files from the grails-app to the web-app. the advantage is managing one set of i18n properties file

Meni