Serves up i18n bundle to javascript
- In your plugins section of
BuildConfig.groovy
add this
For use with the (now deprecated) resources plugin,
compile ":grails-i18n-resources:0.1"
For use with the asset-pipeline plugin,
compile ":grails-i18n-resources:0.2"
- In your
*Resources.groovy
, add dependencyi18n
to modules that need i18n. - In your page, you can setup a callback in which you can execute code like this
$.i18n.properties({
name: 'messages',
path: '<g:resource dir="i18n/"/>',
mode: 'map',
callback: function() {
// your code here
},
cache: true
});
Take a look at jquery-i18n-properties for more on the syntax.
- Checkout source
- Package plugin
grails package-plugin