Localization Example

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Locked
elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

Localization Example

Post by elanorb » Thu Sep 12, 2013 10:33 am

Hi

As requested here is a very simple example of localiztion. The stack reads the file of transaltions into an array and allows the user to switch the selected language. The unicodeText property of a label field and unicodeLabel property of a button are used to display the text correctly.

The strings.txt file is a UTF8 file which is why the byte order mark needs to be removed, the UTF8 text also needs to be converted to unicode using the uniEncode function before it can be used to set the unicodeText or unicodeLabel property.

Please let me know if you have any questions.

Kind regards

Elanor
Attachments
localizationExample.zip
(1.12 KiB) Downloaded 388 times
Elanor Buchanan
Software Developer
LiveCode

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Localization Example

Post by bangkok » Thu Sep 12, 2013 12:40 pm

Nice example.

I would suggest you to expand the script, in order to deal with many objects, on many cards. The idea is to avoid to maintain the list of objects in the selectLanguage script .

-a custom property into the object : to be translated, yes or no

-in the file, add the ID of the object, in order to make the link with translations, rather than the name of the object

-3 loops, to browse all cards, all objects (fields and buttons)

See a quick modification in the stack attached.
Attachments
localization2.zip
(1.7 KiB) Downloaded 375 times

Locked

Return to “Summer School 2013”