function GetText ($) { var self = this; this.texts = {"Accept":"Aceptar","Acceptar":"Acceptar","Cancel":"Cancelar"}; this.text = function (text) { if(self.texts.hasOwnProperty(text)) { return self.texts[text]; } console.warn ('Text not defined! Go to getText function'); return text; } } jQuery(document).ready(function($){ PageController.require([],function() { PageController.registerController('GetText', new GetText($)) }); });