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
Localization Example
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Localization Example
- Attachments
-
- localizationExample.zip
- (1.12 KiB) Downloaded 407 times
Elanor Buchanan
Software Developer
LiveCode
Software Developer
LiveCode
Re: Localization Example
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.
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 392 times