Jump to content
Advert

Recommended Posts

Posted

I'm building a GUI and I want to add support for 12 languages. The problem I'm running into is say I have a radio control and I want to change the text depending on what language is being used. The characters being rendered are not what I expect. I'm saving my text strings in an INI file. 

Quote

[languageSelect]
language=0
ENGLISH=Select this for English
FRENCH=Sélectionnez ceci pour le français
GERMAN=Wählen Sie dies für Deutsch aus.
CHINESE=选择此项以使用中文
HINDI=हिंदी के लिए इसे चुनें
SPANISH=Seleccione esta opción para español
ARABIC=اختر هذا للغة العربية
PORTUGUESE=Selecione isto para português
RUSSIAN=Выберите этот вариант для русского языка
JAPANESE=日本語にする場合はこれを選択してください
ITALIAN=Seleziona questa opzione per l'italiano
VIETNAMESE=Chọn mục này cho tiếng Việt

This is my script I'm using:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $sIniFile2 = @ScriptDir & "\VQData\settings.ini"
Global $defaultwintitle = "VollyQuizzer - Select your language"

$FormLS1     = GUICreate($defaultwintitle, 763, 323, 311, 365)
               GUISetFont(12, 400, 0, "MS Sans Serif")
$iniReadLS1  = IniRead($sIniFile2,"languageSelect","ENGLISH","English")
$RadioLS1    = GUICtrlCreateRadio($iniReadLS1, 24, 16, 290, 25)
$iniReadLS2  = IniRead($sIniFile2,"languageSelect","FRENCH","French")
$RadioLS2    = GUICtrlCreateRadio($iniReadLS2, 24, (16*3), 290, 25)
$iniReadLS3  = IniRead($sIniFile2,"languageSelect","GERMAN","German")
$RadioLS3    = GUICtrlCreateRadio($iniReadLS3, 24, (16*5), 290, 25)
$iniReadLS4  = IniRead($sIniFile2,"languageSelect","CHINESE","Chinese")
$RadioLS4    = GUICtrlCreateRadio($iniReadLS4, 24, (16*7), 290, 25)
$iniReadLS5  = IniRead($sIniFile2,"languageSelect","HINDI","Hindi")
$RadioLS5    = GUICtrlCreateRadio($iniReadLS5, 24, (16*9), 290, 25)
$iniReadLS6  = IniRead($sIniFile2,"languageSelect","SPANISH","Spanish")
$RadioLS6    = GUICtrlCreateRadio($iniReadLS6, 24, (16*11), 290, 25)

$iniReadLS7  = IniRead($sIniFile2,"languageSelect","ARABIC","Arabic")
$RadioLS7    = GUICtrlCreateRadio($iniReadLS7, 344, 16, 410, 25)
$iniReadLS8  = IniRead($sIniFile2,"languageSelect","PORTUGUESE","Portuguese")
$RadioLS8    = GUICtrlCreateRadio($iniReadLS8, 344, (16*3), 410, 25)
$iniReadLS9  = IniRead($sIniFile2,"languageSelect","RUSSIAN","Russian")
$RadioLS9    = GUICtrlCreateRadio($iniReadLS9, 344, (16*5), 410, 25)
$iniReadLS10 = IniRead($sIniFile2,"languageSelect","JAPANESE","Japanese")
$RadioLS10   = GUICtrlCreateRadio($iniReadLS10, 344, (16*7), 410, 25)
$iniReadLS11 = IniRead($sIniFile2,"languageSelect","ITALIAN","Italian")
$RadioLS11   = GUICtrlCreateRadio($iniReadLS11, 344, (16*9), 410, 25)
$iniReadLS12 = IniRead($sIniFile2,"languageSelect","VIETNAMESE","Vietnamese")
$RadioLS12   = GUICtrlCreateRadio($iniReadLS12, 344, (16*11), 410, 25)

$ButtonLS1   = GUICtrlCreateButton("Continue", 272, 256, 145, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $iniReadLS2
            $INIL1 = IniRead($sIniFile2,"languageSelect", "French1","Fail")
            $defaultwintitle = $INIL1


    EndSwitch
WEnd

When I run the script, this is the result (which is not what it should be). For example the Arabic (right column, top) is completely wrong. 

image.png.eded0039fb54811c5b9b82057e13939f.png

I'm thinking this is a Windows limitation (Character support) and I need a different approach. In any case my main script has a number of controls that I would like to be able to change the language to the operator's preference. 
If what I have in mind won't work, is there a different approach I could try? Not sure what to do here. Thanks. 

Advert
Posted (edited)

In SciTE select UTF-8 encoding to save the script, while to save the .ini file with Notepad, select UTF-16 LE encoding

Edited by Gianni

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

Try saving ini file with UTF 8, but I am almost certain that it will not work. I can bot test that. If that fails there are is some ini file udf which should resolve that issue.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...