Skip to content

Instantly share code, notes, and snippets.

@robertomiranda
Last active October 30, 2015 13:31
Show Gist options
  • Save robertomiranda/86b72d159a6ee7213b40 to your computer and use it in GitHub Desktop.
Save robertomiranda/86b72d159a6ee7213b40 to your computer and use it in GitHub Desktop.
Keep.Behaviors.Internationalization = Marionette.Behavior.extend({
initialize: function(){
var currentStore = "us";
var currentView = this[ currentStore + "Behavior"];
if(typeof currentView != "undefined"){
$.extend(true, this.prototype, currentView)
}
},
templateHelpers: function(){
return{
t: function(message){
//Decide here which polygolt to use
var currentPolyglot = Seetings["polyglot"+ currentStore];
return currentPolyglot.t(message);
}
}
}
});
// Contact View
View.View = Backbone.Marionette.ItemView.extend({
template: "contacts/view.html",
ui: {
"info": "#info-block",
"creditInfo": "#credits-block",
},
behaviors: {
Internationalization: {},
},
usBehavior: {
onDestroy: function(){
console.log("destroyed from USa");
}
},
caBehavior:{
onDestroy: function(){
console.log("destroyed from Canada");
}
},
onDestroy: function(){
console.log("fallback destroy")
this.orderRegion.destroy();
this.creditRegion.destroy();
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment