Jump to content

Please help me about MultiLanguage


meoit
 Share

Recommended Posts

My script have a problem about MultiLanguage. This is code:

Global $SelectedCodeLang, $Lng[13]
;
LANG_GUI()
;
Func LANG_GUI()
    Opt('GUICloseOnEsc', 1)
    Opt('TrayIconHide', 1)
    Local $LangGUI = GUICreate('Select Language', 440, 100, -1, -1)
    GUICtrlCreateLabel('Please select language.', 10, 15, 415, 45)
    GUICtrlSetFont(-1, 14, 400, 0, 'Tahoma')
    Local $LangCombo = GUICtrlCreateCombo('English', 35, 53, 250, 27, 0x0003)
    GUICtrlSetFont(-1, 14, 400, 0, 'Arial')
    GUICtrlSetData(-1, 'Russian')
    Local $ButtonOK = GUICtrlCreateButton('OK', 315, 50, 100, 35)
    GUICtrlSetFont(-1, 14, 400, 0, 'Tahoma')
    GUICtrlSetCursor(-1, 0)
    GUISetState(@SW_SHOW)
    WinSetOnTop($LangGUI, '', 1)
    While 1
        Local $nMsg = GUIGetMsg()
        Switch $nMsg
            Case -3, $ButtonOK
                ExitLoop
        EndSwitch
    WEnd
    Local $selected = GUICtrlRead($LangCombo)
    If $selected == 'English' Then
        $SelectedCodeLang = 'ENG'
    ElseIf $selected = 'Russian' Then
        $SelectedCodeLang = 'RUS'
    EndIf
    GUIDelete($LangGUI)
    GET_LANG()
    ;Show the MessageBox to test language strings
    MsgBox(64 + 8192 + 262144, 'Test language string 1', $Lng[1]) ;It is OK
    MsgBox(64 + 8192 + 262144, 'Test language string 2', $Lng[2]) ;It's go to wrong :(
EndFunc
;
Func GET_LANG()
    Switch $SelectedCodeLang
        Case 'ENG'
            $Lng[1] = "Sort by extension.@CRLFThis is a break line 1."
            $Lng[2] = "Status bar.@CRLFThis is a break line 2."
            $Lng[3] = "Source path (use drag-and-drop)"
            $Lng[4] = "Destination path (use drag-and-drop)"
            $Lng[5] = "Ignore file types"
            $Lng[6] = "If the field is a drop-down list is empty,"
            $Lng[7] = "then this item is ignored"
            $Lng[8] = "Remove file types"
            $Lng[9] = "Leave the box blank"
            $Lng[10] = "to ignore option"
            $Lng[11] = "Delete files less than the specified size, KB"
            $Lng[12] = "to ignore the size"
        Case 'RUS'
            $Lng[1] = "Сортировка по расширению"
            $Lng[2] = 'Строка состояния'
            $Lng[3] = "Путь - источник (используйте drag-and-drop)"
            $Lng[4] = "Путь - получатель (используйте drag-and-drop)"
            $Lng[5] = "Игнорировать типы файлов"
            $Lng[6] = "Если поле раскрывающегося списка"
            $Lng[7] = "пустое, то этот пункт не учитывается"
            $Lng[8] = "Удалять типы файлов"
            $Lng[9] = "Оставте поле пустым"
            $Lng[10] = "для игнорирования параметра"
            $Lng[11] = "Удалять файлы менее указанного размера, кб"
            $Lng[12] = "для игнорирования размера"
    EndSwitch
    For $i = 1 To UBound($Lng) - 1
        $Lng[$i] = StringStripWS($Lng[$i], 2)
        $Lng[$i] = StringReplace($Lng[$i], '@CRLF', @CRLF)
        $Lng[$i] = StringReplace($Lng[$i], '@LF', @LF)
        $Lng[$i] = StringReplace($Lng[$i], '@CR', @CR)
        Return $Lng[$i]
    Next
EndFunc

ok141smu.png

 

ok2lss2b.png

@Melba23 , @Danyfirex , @water

Please help me. How to fix the second messagebox which not break line ?.

Thank all.

Edited by meoit
Link to comment
Share on other sites

You have your Return statement in the GET_LANG function in the wrong place, returning the wrong thing. You don't need a Return in that function anyway, because you're not reading what you're returning.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...