Archive: How to use a default translation when a string isn't yet translated?


How to use a default translation when a string isn't yet translated?
  I am trying to make my installer multi language. I use the langstring functionality. The problem is that although I have enabled all the languages for the installer itself(via the langdll) not all my strings are translated to all available languages. So when a user selects a language that I don't have translations for, the installer is translated but my own strings are appearing empty in that language. Is there any way to make NSIS use a default language (eg english) until I get these strings translated to other languages?

eg

LangString message $(LANG_ENGLISH) "blah"
LangString message $(LANG_ITALIAN) "blah"

but the user chooses as language Greek. Is there any way to make NSIS display the english version of message since it cannot find the Greek equivalent?

Thanks.


I suppose this is already implemented in NSIS.
The first language used is the default one.


I am not sure on how to do it. Here is sample NSIS script that displays the problem.


XPStyle on


>!include "MUI.nsh"

>OutFile "setup.exe"

>!define MUI_ABORTWARNING
>!define MUI_HEADERIMAGE
>!define MUI_COMPONENTSPAGE_NODESC
>!define MUI_LICENSEPAGE_CHECKBOX
>!define MUI_LANGDLL_ALLLANGUAGES

>;Installer Pages
>!insertmacro MUI_PAGE_WELCOME
>!insertmacro MUI_PAGE_COMPONENTS
>!insertmacro MUI_PAGE_INSTFILES

>;--------------------------------
;Uninstaller Pages
>!insertmacro MUI_UNPAGE_CONFIRM
>!insertmacro MUI_UNPAGE_COMPONENTS
>!insertmacro MUI_UNPAGE_INSTFILES

>!insertmacro MUI_LANGUAGE "English"
>!insertmacro MUI_LANGUAGE "Afrikaans"
>!insertmacro MUI_LANGUAGE "Albanian"
>!insertmacro MUI_LANGUAGE "Arabic"
>!insertmacro MUI_LANGUAGE "Basque"
>!insertmacro MUI_LANGUAGE "Belarusian"
>!insertmacro MUI_LANGUAGE "Bosnian"
>!insertmacro MUI_LANGUAGE "Breton"
>!insertmacro MUI_LANGUAGE "Bulgarian"
>!insertmacro MUI_LANGUAGE "Catalan"
>!insertmacro MUI_LANGUAGE "Croatian"
>!insertmacro MUI_LANGUAGE "Czech"
>!insertmacro MUI_LANGUAGE "Danish"
>!insertmacro MUI_LANGUAGE "Dutch"
>!insertmacro MUI_LANGUAGE "Esperanto"
>!insertmacro MUI_LANGUAGE "Estonian"
>!insertmacro MUI_LANGUAGE "Farsi"
>!insertmacro MUI_LANGUAGE "Finnish"
>!insertmacro MUI_LANGUAGE "French"
>!insertmacro MUI_LANGUAGE "Galician"
>!insertmacro MUI_LANGUAGE "German"
>!insertmacro MUI_LANGUAGE "Greek"
>!insertmacro MUI_LANGUAGE "Hebrew"
>!insertmacro MUI_LANGUAGE "Hungarian"
>!insertmacro MUI_LANGUAGE "Icelandic"
>!insertmacro MUI_LANGUAGE "Indonesian"
>!insertmacro MUI_LANGUAGE "Irish"
>!insertmacro MUI_LANGUAGE "Italian"
>!insertmacro MUI_LANGUAGE "Japanese"
>!insertmacro MUI_LANGUAGE "Korean"
>!insertmacro MUI_LANGUAGE "Kurdish"
>!insertmacro MUI_LANGUAGE "Latvian"
>!insertmacro MUI_LANGUAGE "Lithuanian"
>!insertmacro MUI_LANGUAGE "Luxembourgish"
>!insertmacro MUI_LANGUAGE "Macedonian"
>!insertmacro MUI_LANGUAGE "Malay"
>!insertmacro MUI_LANGUAGE "Mongolian"
>!insertmacro MUI_LANGUAGE "Norwegian"
>!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
>!insertmacro MUI_LANGUAGE "Polish"
>!insertmacro MUI_LANGUAGE "Portuguese"
>!insertmacro MUI_LANGUAGE "PortugueseBR"
>!insertmacro MUI_LANGUAGE "Romanian"
>!insertmacro MUI_LANGUAGE "Russian"
>!insertmacro MUI_LANGUAGE "Serbian"
>!insertmacro MUI_LANGUAGE "SerbianLatin"
>!insertmacro MUI_LANGUAGE "SimpChinese"
>!insertmacro MUI_LANGUAGE "Slovak"
>!insertmacro MUI_LANGUAGE "Slovenian"
>!insertmacro MUI_LANGUAGE "Spanish"
>!insertmacro MUI_LANGUAGE "SpanishInternational"
>!insertmacro MUI_LANGUAGE "Swedish"
>!insertmacro MUI_LANGUAGE "Thai"
>!insertmacro MUI_LANGUAGE "TradChinese"
>!insertmacro MUI_LANGUAGE "Turkish"
>!insertmacro MUI_LANGUAGE "Ukrainian"
>!insertmacro MUI_LANGUAGE "Uzbek"
>!insertmacro MUI_LANGUAGE "Welsh"

>LangString message ${LANG_ENGLISH} "english"
>LangString message ${LANG_ITALIAN} "italian"


>Section $(message)
>SectionEnd

>Function .onInit

!insertmacro MUI_LANGDLL_DISPLAY

FunctionEnd
>
If you choose either english or italian in the langdll the section name appears in the components page. If you choose any other eg greek the section name doesn't appear (not even in english).

Anyone?


The notes for LangString says that you should always set language strings for every language in your script.

Just fill in all the languages and use the english string for the languages you don't have a translation.

PaR