database collections based on language
Hi Dennis,
Not sure about problem you have.
Please specify about it more details.
Thanks.
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hi Dennis,
Not sure about problem you have.
Please specify about it more details.
Thanks.
The dropdown I use for choosing collection, I would also like to use for choosing language, using my language files. How can I do this?
it crashes the drop down menu.
Could you check are there any errors in console? This (http://devcenter.appery.io/documentat...) should help.
I am a paying customer, and have tried to submit a request through the priority support, without any respons for a month now. How does this support work compared to the forum? I would like somebody to log in to my app and help me with this.
I have two translation files, en-GB and en-US
GET http://appery.io/app/view/af76e850-12... 404 (Not Found)
Hello Dennis,
Could you please email us directly on a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a with reference to this thread.
Hi Dennis,
You need to have select(dropdown) with values:
pre
view - value
"Britain": "en-GB",
"English": "en-US"
/pre
Then you need to add to this select component "change" event handler.
Inside this event handler you can access current language like "en-GB" or "en-US".
Then you can:
1 Translate page statics with this language.
2 Use needed collection in accordance to this language.
Regards.
"inside this event handler you can access current language..."
But how can I select this?
Hi Dennis,
You can access current value for "select" component on "value change" event handler with following JS code:
pre
var langCollectionMapping = {
"en-GB": "britanCollection",
"en-US": "britanCollection"
};
//Where "selectName" is your select name.
var currentLanguage = Apperyio("selectName").val();
alert("current language is = " + currentLanguage);
var currentCollection = langCollectionMapping[currentLanguage];
alert("current collection is = " + currentCollection);
/pre
Regards.
But where should I then put this? It makes the select menu crash if I put it together with your code.
var option = {lng: val, resGetPath: 'locales/lng/ns.json', fallbackLng: 'en-GB'}; //Pass the initialization language,
//set the translation files path and fallback language
$.i18n.init(option, function(t) {
$(document).i18n(); //Once the translations are loaded translate the whole document
});
We are very sorry for the radio silence here.
You should change "locales/lng/ns.json" to the real .json path:
"locales/"+ langCollectionMapping[currentLanguage] +"/translation.json";
Note: Use this code immediately after code provided by Yurii.
Also
please use:
var langCollectionMapping = {
"en-GB": "britanCollection",
"en-US": "americanCollection"
};
instead of:
var langCollectionMapping = {
"en-GB": "britanCollection",
"en-US": "britanCollection"
};