-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set the options parameter to initialize. #18
Comments
Hi there, I should update the documentation to explain better what you could pass as If you look here, you could override these options: What I think you want is to load translations catalogue like this: // i18n.setMessages(domain, locale, messages, plural_form);
i18n.setMessages('messages', 'fr', {
"Welcome": "Bienvenue",
"There is %1 apple": [
"Il y a %1 pomme",
"Il y a %1 pommes"
]
}, 'nplurals=2; plural=n>1;'); or with a JSON: // i18n.loadJSON(jsonData /*, domain */);
var json = {
"": {
"language": "fr",
"plural-forms": "nplurals=2; plural=n>1;"
},
"Welcome": "Bienvenue",
"There is %1 apple": [
"Il y a %1 pomme",
"Il y a %1 pommes"
]
};
i18n.loadJSON(json, 'messages'); Then call |
in the webpage header and then access I need to translate something in an existing script and have added this to the script:
But I am getting a console error I don't know that that e is or where it is comming from. Is there something I may have missed? note: the linter wanted me to put strings in single quotes. |
Hi.
I was reading the documentation but I'm not able to find how to set the options parameter to begin getting texts.
var i18n = window.i18n(options);
I think it is just a JSON with some values, but I don't know what key, value pairs.
I hope you could help me.
The text was updated successfully, but these errors were encountered: