How can I access this.resources.language
in the setLanguage()
function, with property current language that is one of those four from resources?
myLanguage = new Language( 'en' );
function Language (currentLanguage) {
this.currentLanguage = currentLanguage;
this.resources = {
en: {
latest_songs_heading: "Latest",
popular_songs_heading: "Popular",
},
de: {
latest_songs_heading: "Neueste",
popular_songs_heading: "Beliebteste",
},
es: {
latest_songs_heading: "Más reciente",
popular_songs_heading: "El mas popular",
},
po: {
latest_songs_heading: "Mais recentes",
popular_songs_heading: "O mais popular",
}
},
this.getLanguage = function() {
return 'Current language: ' + this.currentLanguage;
}
this.setLanguage = function() {
var language = this.currentLanguage;
return this.resources.language;
}
}