06-26-2013 07:30 PM
I'm in the process of trying to localise my app into another language, my app uses an internal Sqlite database among other things to read the contents of a category table in order to display avaiable categoriesvia a listview. What I would like to know is if anything exists similar to QsTr("") where I could easier tell the app to pull the contents for the categories from a different field in the same table based upon the language being used.. This way I could have a CategoryNameEng field, a CategoryNameFr field etc...
If this doesn't exist any recommendation on how best to handle this would be great..
Solved! Go to Solution.
06-27-2013 12:55 AM
create yourn table structure so you have those localized text in an extra table together with the locale itself as key ('de' 'en' ...)
then use the current locale as part of your query to find the right one
only one way to do this
always not easy to localize content from databases
06-27-2013 11:28 AM
As ekke says plenty of ways to do this but none particularly nice.
You might like to separate the 'translatable' tables out in to separate databases, doing it this way would improve the access speed and minimise memory use. You would just select and load the correct database once when the language check is done rather than putting it in to a query.
Also the translation process wouldn't risk corrupting the other data then as well.
06-27-2013 11:55 AM
for your suggestions and using them, I going to try the following:
-1- I created an addtional field named i.e "fr" within my table.
-2- then I use the alias name in my ListItemData.NametoUse
-3- and then my query is something like this: Select fr AS NametoUse,* from Categories and the 'fr' is being passed as whatever the current locale should I want to with from the default "en"