Last active
October 30, 2015 13:31
-
-
Save robertomiranda/86b72d159a6ee7213b40 to your computer and use it in GitHub Desktop.
This file contains 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
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