Thoughts on localisation using a database

Hi team,
I’m getting to the stage where adding language support to my application is getting troublesome and I’m thinking of getting to the stage of writing my own language system.

The problem is that by using dynamic constants and Lingua etc, means that if I change the app I have to push out to my users for feedback and correction.

I’d like to implement a user modifiable system using something standard like an Excel sheet that has columns representing each language offered so that end users could tweak interface text if required that is read at runtime.

My question is, has anyone implemented something like this? Is there a way to output all captions etc and then read them in programatically without having a class that lists all controls and their captions/text and cross reference at load?

Dont know if you have the back issues of Xdev but Trisha Duke did an article on a database localisation system for apps which was quite comprehensive. Can’t remember issue number of the top of my head.

Lingua is just terrible. I have a version with Deepl of Open Lingua from Thomas Tempelmann which exports to csv. If you have a license for Einhugur I can send you a version with Excel export and import.

the URL for the issue is http://www.xdevmag.com/browse/12.1/12106/

I am still using the same method… but instead of reading the data from the database every single time , I put the data into in memory db first and only for build. it still read the data when in debug mode so I can change the translation ad-hoc without start the debug again.

1 Like

I use a hybrid system.
All words and sentences are stored as string constants in the app (using Lingua).

And I also use an online database that lets me update or fix any string constant for all 29 languages I support.

and how did you get to the online db from your app ??

I was typing from my iPhone earlier so I couldn’t give a detailed response.

Each time the app is opened, it connects to my online DB through a REST API to load all localisations in the currently selected App’s language.

All localisations are then stored to a dictionary, lets call it dicLocalisation in a Module and also saved “on disk” using NSUserDefaults.
Saving to NSUserDefaults enables me to re-load the localisation into dicLocalisation, if the app fails to access my online DB the next time the app is opened.

Then comes the most cumbersome part.
In the Open event of each screen, I have to add code to set the titles and captions of all elements that need to display a localised string.
I do it like this:

label1.caption = OnlineLoc("KeyToLocalisedString", KeyToLocalisedString)

KeytoLocalisedString is the String constant to display. It is also the key to the localised string in the dicLocalisation Dictionary and online DB.

The OnlineLoc method first checks if there is an entry for “Key” in dicLocalisation and returns it, if not it returns the value of KeytoLocalisedString defined in Lingua.

The main reason for using such a hybrid system is the amount of languages the app supports. I can not expect my 25+ translators to deliver the updated translation on time for the release of an update.
I usually hide un-translated features (when possible) and the online localisation system enables me to display the feature without the user installing an update.

what do I need to do to setup a db and use Rest API to access the db??

Would be great thanks Beatrix. I have the pluggin;)

Thanks all. Will have a look at all replies this morning.

Please download a newer version of “OpenLingua with Deepl” from http://www.mothsoftware.com/downloads/openlingua_deepl.zip .

Version 1.3 add exporting to and importing from Excel. This needs the Excel plugin and the Einhugur Excel reader from Einhugur. Both are not supplied with Open Lingua. For this reason the Excel code is commented out.

There are many open source APIs for this.

One of them is GitHub - ilausuch/ArrestDB: RESTful PHP API for SQLite, MySQL and PostgreSQL Databases