Search code examples
programming-languagesmessageinno-setup

Inno Setup - Change the MessageBox language


i have this problem... i did a personal messagebox... i put in a very funny way english and spanish... but i want my installer to display only one language... like... when i choose in the menu selector spanish... in that messagebox shows spanish... if a choose italian in the menu selector... let that messagebox show itallian.

[code]
function NextButtonClick1(PageId: Integer): Boolean;
begin
    Result := True;
    if (PageId = wpSelectDir) and not FileExists(ExpandConstant('{app}\xxx.exe')) then begin
        MsgBox('"Thi App" does not seem to be installed in that folder.  Please select the correct folder. [Selecciona la Carpeta de Instalación de la Aplicación]', mbError, MB_OK);
        Result := False;
        exit;
    end;
end;

Solution

  • Use the [CustomMessages] section and prefix the message names there with the internal name of the language like shown in the following script:

    [Setup]
    AppName=My Program
    AppVersion=1.5
    DefaultDirName={pf}\My Program
    OutputDir=userdocs:Inno Setup Examples Output
    
    [Languages]
    Name: en; MessagesFile: "compiler:Default.isl"
    Name: es; MessagesFile: "compiler:Languages\Spanish.isl"
    
    [CustomMessages]
    en.AppCheckError=Select the application folder!
    es.AppCheckError=Selecciona la Carpeta de Instalación de la Aplicación!
    
    [Code]
    procedure InitializeWizard;
    begin
      MsgBox(ExpandConstant('{cm:AppCheckError}'), mbInformation, MB_OK);
    end;