Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

i18next and collections

thanks Nikita, kind of you to ask,
I just want to clarify some things about this plugin.

am I correct that this plugin does not machine translate?

if thats correct and Its bind translation,
I create a set of spanish collections,
do I have to implement all of the collection read services and mapping for this language?
or with code can we substitute the english collection for the spanish collection and use the same services and mapping?

cheers

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

i18next and collections

Hi,

This plugin doesn't translate text. If your data aren't related to the language, you should use the same service and a collection for all the languages. If you've created for each language a separated collection with similar structure, then you should use following URL in service settings:
{database_url}/collections/{collectionName}/
and pass to request-parameter "collectionName" collection name for particular language.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

i18next and collections

Cheers Nikita,
thats what I need to be clear on, if there are any other info available please post it.

So is this the sequence
plugin detects spanish language,
some js runs and saves collection url in localstorage
map local storage to what?
invoke service with new collection url
were now in spanish

thanks again
theres very little info available for this

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

i18next and collections

Hi Michael,

Yes, you understand it right. You need to associate localStorage variable and collectionName parameter of this service by mapping. Appery.io will automatically replace collection name in service URL with this value.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

i18next and collections

Great stuff Nikita,

I will research this, a tutorial on collections for i18 would be good, it will help lots of users.

But can I ask this,

the code above is run on deviceready to id the language,
then with js the a request parameter with the collection id is set and service is invoked, and collection for identifed lang is used

so it must need an if and else for all the langs you have collections for,

for example
meatpizzaEN
meatpizzaES
meatpizzaGER

if you have a sample of the code needed or a link it would help alot

really appreciate your time on this

thanks again

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

i18next and collections

Hi,

Just save collection name in localStorage:
localStorage.setItem("language", "meatpizzaES");
Then bind variable language with request-parameter collectionName by mapping:
http://docs.appery.io/documentation/r...

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

i18next and collections

AAAAHHH!
got ya,
so the code looks for the lang on device and for variable it sets the collection for the lang identified,
I'm always thinking it more complicated than it is

cheers Nikita,

Return to “Issues”