summaryrefslogtreecommitdiff
path: root/packages/win32/gcs_lang.nsh
blob: 42ca6a6aae138068e1a0bdddfa472b10269c970d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
;Title          Lang support for GCstar installer. Made from AbiWord one.
;FileDesc       functions/macros/etc for supporting multi-language text within installer


!ifndef _GCS_LANG_NSH_
!define _GCS_LANG_NSH_

  ; Languages, include MUI & NSIS language support
  ; then include app install specific language support

    ; indicate default language definitions to use if a translation is missing a string
    !define DEF_LANG "ENGLISH"

    ; actually sets the LangString
    !macro SETLSTR NAME VALUE	; e.g. English sectID sectDesc
	!echo "${LANG} ( ${LANG_${LANG}} )"
      !define "STRING_ISSET_${LANG}_${NAME}"
      LangString "${NAME}" "${LANG_${LANG}}" "${VALUE}"
    !macroend
    !define SETLSTR "!insertmacro SETLSTR"

    ; macro to set string, assumes LANG already defined (call within context of LANG_LOAD)
    !macro LSTR NAME VALUE	; e.g. sectID sectDesc
      !ifdef SETDEFLANG
        ; if string is already set, we do nothing, otherwise we set to default value and warn user
        !ifndef "STRING_ISSET_${LANG}_${NAME}"
          !ifndef APPSET_LANGUAGEFILE_DEFAULT_USED     ; flag default value must be used
            !define APPSET_LANGUAGEFILE_DEFAULT_USED
          !endif
          ${SETLSTR} "${NAME}" "${VALUE}"  ; set to default value
        !endif
      !else ; just set the value
        ${SETLSTR} "${NAME}" "${VALUE}"
      !endif
    !macroend
    !define LSTR "!insertmacro LSTR"

    ; macro to include necessary language files
    ; Usage: 
    ;       ${LANG_LOAD} "<nsis language name>"
    ;  e.g. ${LANG_LOAD} "English"
    ;
    !macro LANG_LOAD LANG
      !insertmacro MUI_LANGUAGE "${LANG}"
      !echo "Loading language ${LANG} ( ${LANG_${LANG}} )"
      ; Specify the license text to use (for multilang support, must come after MUI_LANGUAGE)
      ;LicenseLangString LicenseTXT "${LANG_${LANG}}" "..\AbiSuite\Copying"
      !verbose push
      !verbose 3
      !include "langs\gcs_${LANG}.nsh"   ; Localized Installer Messages (Language Strings)
      !define SETDEFLANG
      ;!include "gcs_${DEF_LANG}.nsh"
      !verbose pop
      !ifdef APPSET_LANGUAGEFILE_DEFAULT_USED
        !undef APPSET_LANGUAGEFILE_DEFAULT_USED
        !warning "${LANG} Installation language file incomplete.  Using default texts for missing strings."
      !endif
      !undef SETDEFLANG
      !echo "End loading language ${LANG}"
      !undef LANG
    !macroend
    !define LANG_LOAD "!insertmacro LANG_LOAD"

!endif ; _GCS_LANG_NSH_
; End of file