Page 3 of 4

database collections based on language

Posted: Mon Jun 08, 2015 1:26 am
by Yurii Orishchuk

Hi Dennis,

Not sure about problem you have.

Please specify about it more details.

Thanks.


database collections based on language

Posted: Tue Jun 09, 2015 7:26 pm
by Dennis

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?


database collections based on language

Posted: Wed Jun 10, 2015 1:55 pm
by Serhii Kulibaba

it crashes the drop down menu.
Could you check are there any errors in console? This (http://devcenter.appery.io/documentat...) should help.


database collections based on language

Posted: Thu Jun 11, 2015 12:22 pm
by Dennis

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)


database collections based on language

Posted: Thu Jun 11, 2015 2:34 pm
by Alena Prykhodko

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.


database collections based on language

Posted: Tue Jun 16, 2015 2:53 am
by Yurii Orishchuk

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.


database collections based on language

Posted: Tue Jun 16, 2015 5:31 am
by Dennis

"inside this event handler you can access current language..."

But how can I select this?


database collections based on language

Posted: Wed Jun 17, 2015 4:09 am
by Yurii Orishchuk

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.


database collections based on language

Posted: Wed Jun 17, 2015 6:34 pm
by Dennis

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
});


database collections based on language

Posted: Tue Jun 30, 2015 4:24 pm
by Serhii Kulibaba

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"
};