Open fellipejsousa opened 7 years ago
Same issue !
Me to... How can i call an object in object, like content.title
The error message "Uncaught TypeError: message.indexOf is not a function" is thrown when you try to use the indexOf() method on a variable that is not a string. It seems like you are trying to use this method on an object. The Friends library does support objects inside objects. You can access the nested object by using dot notation or bracket notation. Here's an example of how you can access the nested object:
var json = {
"en": {
"appname-title": "Example Application",
"appname-sub-title": "An example application with jquery.i18n",
"appname-header-introduction": "Introduction",
"example": {
"appname-title": "Example Application",
"appname-sub-title": "An example application with jquery.i18n"
},
"appname-about": "About this application",
"appname-footer": "Footer text"
},
"ml": {
"appname-title": "അപ്ലിക്കേഷന് ഉദാഹരണം",
"appname-sub-title": "jquery.i18n ഉപയോഗിച്ചുള്ള അപ്ലിക്കേഷന് ഉദാഹരണം",
"appname-header-introduction": "ആമുഖം",
"example": {
"appname-title": "Example Application",
"appname-sub-title": "An example application with jquery.i18n"
},
"appname-about": "ഈ അപ്ലിക്കേഷനെപ്പറ്റി",
"appname-footer": "അടിക്കുറിപ്പു്"
}
};
console.log(json.en.example["appname-title"]); // Output: Example Application
console.log(json.ml["appname-footer"]); // Output: അടിക്കുറിപ്പു്
Friends library has support for objects inside objects because my script is criticizing: Uncaught TypeError: message.indexOf is not a function
example json: