database collections based on language

This forum contains topics that were moved from Get Satisfaction
Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

database collections based on language

Post by Yurii Orishchuk »

Hi Dennis,

Not sure about problem you have.

Please specify about it more details.

Thanks.

Dennis
Posts: 0
Joined: Tue May 05, 2015 1:29 pm

database collections based on language

Post 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?

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

database collections based on language

Post 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.

Dennis
Posts: 0
Joined: Tue May 05, 2015 1:29 pm

database collections based on language

Post 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)

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

database collections based on language

Post 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.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

database collections based on language

Post 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.

Dennis
Posts: 0
Joined: Tue May 05, 2015 1:29 pm

database collections based on language

Post by Dennis »

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

But how can I select this?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

database collections based on language

Post 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.

Dennis
Posts: 0
Joined: Tue May 05, 2015 1:29 pm

database collections based on language

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

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

database collections based on language

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

Post Reply