Backendless Support
 
Answered

Data structure localization

What is the correct way to make an localization in Backendless DataBase?

What is the correct data structure?

it is app for android and very important is localization

For example, I have field gender, the display value in English is (Male, Female), in Russian (Мужчина, Женщина), in Polish (Męski, Płeć żeńska)...

Leave a Comment

Comments (7)

photo
2

Hi,

we do not have a special functional for this, but as one of the options you can create a table for each field you need to localize and create columns for each language. In your case you will have table named Gender and columns `ru`, `en` `pl` with values for each language.

Alternatively you may do a localization on client side using some JS libraries for this purpose.

Regards,

Stanislaw

photo
1

Hi, I understand you

But should I make relationship, or only save filedKey and always make requests?

photo
photo
1

For example, I have a table User, and I need to download info about 1 user, and all almous all field have localization

I attached a screen with table language.

photo
1

Well, you can make `gender` property (and each other you need) as a One-to-Many relation to `Language` table, link to the corresponding rows for each language and filter the result on the client, depending on the chosen language (for example, an array of three objects for the gender field will come, and you will choose one by language)

photo
1

1. If I have properties: gender, status, region... which have localization, all of them should have ono-to-Many relation?

2. If I create a new User in gender field, I should add an array of three objects, like on photos?

photo
1

1) Yes, because you have more than one translation for each field.

2) That's right. But please, keep in mind that we do not have any best practices or rules for this, I only describe possible solutions of your problem and, perhaps, you can come up with something better or more convenient for you

photo
1

Thank you very much

I'll try