jeudi 16 avril 2015

Emberjs managing multi-language contents

I'm making a dashboard of an application using emberjs, and I've got a content that should be localized, I don't know If I'm stupid and I don't see how can I localize, or If there is nothing on internet about that. I only found this link http://ift.tt/1b63bQT talking about that.


My usually aproach when I'm using mobile devices, was to use a json data like the following:



{"template":{
"name":{
"es":"Prueba multi-idioma 1"
"en":"Multi language test 1"
},
...
}


In the case you only need one language, you can request to the server with a header or a get parameter using that.


In the link I found, I understand the second approach was something like:



{"template":{
"name":[
{"lang":"es", "content":"Prueba multi-idioma 1"}
{"lang":"en", "content":"Multi language test 1"}
},
...
}


This means that to found a language, you should made a search (I know is not difficult on emberjs), but If I understand correctly, It means every language entry for the content, is an ember object, and if I'm not wrong, ember require an ID for every object you create, and the {"lang":"es", "content":"somecontent"} it's an object.


Thanks everyone, and sorry If this is a stupid question.





Aucun commentaire:

Enregistrer un commentaire