I use this script, that I found on the web, and it works very well on desktop app (don't know on mobile).
Code: Select all
function getUserLang
local tAppLangs = "en,fr,de,es,it,pt,zh,zh,zh,zh,ja,ko,ru" --> LANGUAGE CODES THAT WILL BE RETURNED BY FUNCTION
local tAppLangsMac = "en,fr,de,es,it,pt,zh-Hans,zh-Hant,zh_TW,zh_CN,ja,ko,ru" --> LANGUAGE CODES THAT MAC OS RETURNS
local tAppLangsWin = "9,12,7,10,16,22,4,4,4,4,17,18,25" --> DECIMAL REPRESENTATIONS OF PRIMARY LANGUAGE CODES WINDOWS RETURNS
local tUserLangs
local i
set wholeMatches to true
if platform() is "MacOS" then
put replaceText(shell("defaults read NSGlobalDomain AppleLanguages"),"(\s|\(|\))","") into tUserLangs
repeat for each item tLang in tUserLangs
put itemOffset(tLang, tAppLangsMac) into i
if i > 0 then exit repeat
end repeat
else if platform() is "Win32" then
put queryRegistry("HKEY_CURRENT_USER\Control Panel\International\Locale") into tUserLangs
put baseConvert(tUserLangs,16,10) bitAND 1023 into tUserLangs
repeat for each item tLang in tUserLangs
put itemOffset(tLang, tAppLangsWin) into i
if i > 0 then exit repeat
end repeat
end if
if i > 0 then
return item i of tAppLangs
else
return "en"
end if
end getUserLang
Detecting the language is not a problem for me. And sure, you can save everything on a file.
But suppose you have a stack with 10 substacks, btns, fields, dialogs, error caching, etc.
Once detected the language (or from a user choice), your script has to pinpoint each and every control in order to change the label of the content of the dialog (the property of control X of card yy of stack ZZ) before showing the app to the user.
If you misplace a path to a control, your app will bomb.And this operation, on the standalone, will have to be done at each launch. Not very speedy. In my case I also have to handle the date and time change across the application...
My point is that "Properties profile" is a good idea. But it must be fixed, work on mobile and somehow to be able to get the content from a file or global var