Created
September 6, 2013 16:43
-
-
Save Fintan/6466424 to your computer and use it in GitHub Desktop.
Internationalising a Marionette application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Support for internationalisation - beginning | |
| //filter strings with 'Interp' in name and register them as partials | |
| _.each(Strings, function(str, key) { | |
| if(key.indexOf('Interp') > -1) { | |
| Handlebars.registerPartial(key.substr(0, key.indexOf('Interp')), str); | |
| } | |
| }); | |
| Backbone.Marionette.ItemView.prototype.serializeData = _.wrap(Backbone.Marionette.ItemView.prototype.serializeData, function(_serializeData) { | |
| return _.extend(_serializeData.apply(this, arguments), Strings); | |
| }); | |
| //internationalisation support - end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define({ | |
| "root": { | |
| "red": "red", | |
| "blue": "blue", | |
| "green": "green", | |
| "yellow": "yellow", | |
| "greetingInterp": "hello {{profileId}}, how's it going?", | |
| "greeting2Interp": "hello, how's it going {{profileId}}?" | |
| }, | |
| "fr-fr": true | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment