database collections based on language

This forum contains topics that were moved from Get Satisfaction
Dennis
Posts: 0
Joined: Tue May 05, 2015 1:29 pm

database collections based on language

Post by Dennis »

Can I choose between different database collections based on what language my phone is set to? Using this guide for different labels today: https://devcenter.appery.io/tutorials...

Really hope someone can help me.

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

database collections based on language

Post by Serhii Kulibaba »

Hello,

Sure, you can change collection based on language.
1) Change url for service from
{database_url}/collections/collection1
to
{database_url}/collections/{collection_name}

2) add request parameter collection_name to this service

3) set this parameter based on your language. Appery.io automativcally change {collection_name} to it's value

Dennis Nygaard Nielsen
Posts: 0
Joined: Fri May 01, 2015 9:34 pm

database collections based on language

Post by Dennis Nygaard Nielsen »

I just can't get it to work...

Right now it is just displaying the collection name instead of the content of the DB.
I have edited my query to collectionName, the service and the translation file...

Hope you can see what I am doing wrong.

For the translation file I have:

{
"collectionName":"Nozzles_EU",
"second_input":"Another input text"
}

Image Image Image

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

database collections based on language

Post by Yurii Orishchuk »

Hi Dennis,

You should move this parameter to "Query String" subTab.

See details on screen shot: http://prntscr.com/72sejj/direct

Then don't forget to link correct value to this parameter in service "before send" mapping.

Regards.

Dennis Nygaard Nielsen
Posts: 0
Joined: Fri May 01, 2015 9:34 pm

database collections based on language

Post by Dennis Nygaard Nielsen »

Thank you so much! did the trick :)

What if I then would like a label shown in the same specific language?
I choose the language from a drop-down list

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

database collections based on language

Post by Yurii Orishchuk »

Hi Dennis,

Please clarify your question with more details.

Regards.

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

database collections based on language

Post by Dennis »

I would just like to use my translation files by using the same drop down language chooser I made for selection of databases, for the rest of the text in my app.
Today I use the browser language, but how can I choose to use the chooser instead?

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

database collections based on language

Post by Yurii Orishchuk »

Hi Dennis,

If you talk about static text on the labels buttons and other components you need to use i18n.

Please pass the tutorial below to understand how it works:
https://devcenter.appery.io/tutorials...

Regards

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

database collections based on language

Post by Dennis »

I am already. Followed the guide, but instead of using the browser language, I want the users to choose their language from a drop down menu

Dennis Nygaard Nielsen
Posts: 0
Joined: Fri May 01, 2015 9:34 pm

database collections based on language

Post by Dennis Nygaard Nielsen »

Ok. My language selection is now working.
I have a dropdown with the different languages which is working fine. I would though also like my database to change according to this.
My dropdown has the following values:
Image

And in my translation files I have:

"collectionName":"Nozzles_EU", as one of the lines to choose my DB.

For my dropdown I have value change JS:

var val = Appery("mobileselectmenu10").val();
var option = {lng: val, resGetPath: 'locales/lng/ns.json', fallbackLng: 'en-GB'};//set the translation files path and fallback language
$.i18n.init(option, function(t) {
$(document).i18n(); //Once the translations are loaded translate the whole document
});

As request string for my query I have collectionName as name and nothing as value. If I put in the value Nozzles_EU or Nozzles_US, everything works great. But I would like it to take these values from the translation files instead.

Should this not be enough?

Check out the app here. Type in 20 in both input fields: http://appery.io/app/mobile-frame?src...

Post Reply