root / tmp / org.txm.setups / nsis / Include / LangFile.nsh @ 1105
Historique | Voir | Annoter | Télécharger (2,74 ko)
1 | 728 | mdecorde | /* |
---|---|---|---|
2 | 728 | mdecorde | |
3 | 728 | mdecorde | LangFile.nsh |
4 | 728 | mdecorde | |
5 | 728 | mdecorde | Header file to create langauge files that can be |
6 | 728 | mdecorde | included with a single command. |
7 | 728 | mdecorde | |
8 | 728 | mdecorde | Copyright 2008-2015 Joost Verburg |
9 | 728 | mdecorde | |
10 | 728 | mdecorde | * Either LANGFILE_INCLUDE or LANGFILE_INCLUDE_WITHDEFAULT |
11 | 728 | mdecorde | can be called from the script to include a language |
12 | 728 | mdecorde | file. |
13 | 728 | mdecorde | |
14 | 728 | mdecorde | - LANGFILE_INCLUDE takes the language file name as parameter. |
15 | 728 | mdecorde | - LANGFILE_INCLUDE_WITHDEFAULT takes as additional second |
16 | 728 | mdecorde | parameter the default language file to load missing strings |
17 | 728 | mdecorde | from. |
18 | 728 | mdecorde | |
19 | 728 | mdecorde | * A language file start with: |
20 | 728 | mdecorde | !insertmacro LANGFILE_EXT "English" |
21 | 728 | mdecorde | using the same name as the standard NSIS language file. |
22 | 728 | mdecorde | |
23 | 728 | mdecorde | * Language strings in the language file have the format: |
24 | 728 | mdecorde | ${LangFileString} LANGSTRING_NAME "Text" |
25 | 728 | mdecorde | |
26 | 728 | mdecorde | */ |
27 | 728 | mdecorde | |
28 | 728 | mdecorde | !ifndef LANGFILE_INCLUDED |
29 | 728 | mdecorde | !define LANGFILE_INCLUDED |
30 | 728 | mdecorde | |
31 | 728 | mdecorde | !macro LANGFILE_INCLUDE FILENAME |
32 | 728 | mdecorde | |
33 | 728 | mdecorde | ;Called from script: include a langauge file |
34 | 728 | mdecorde | |
35 | 728 | mdecorde | !ifdef LangFileString |
36 | 728 | mdecorde | !undef LangFileString |
37 | 728 | mdecorde | !endif |
38 | 728 | mdecorde | |
39 | 728 | mdecorde | !define LangFileString "!insertmacro LANGFILE_SETSTRING" |
40 | 728 | mdecorde | |
41 | 728 | mdecorde | !define LANGFILE_SETNAMES |
42 | 728 | mdecorde | !include "${FILENAME}" |
43 | 728 | mdecorde | !undef LANGFILE_SETNAMES |
44 | 728 | mdecorde | |
45 | 728 | mdecorde | ;Create language strings |
46 | 728 | mdecorde | |
47 | 728 | mdecorde | !undef LangFileString |
48 | 728 | mdecorde | !define LangFileString "!insertmacro LANGFILE_LANGSTRING" |
49 | 728 | mdecorde | !include "${FILENAME}" |
50 | 728 | mdecorde | |
51 | 728 | mdecorde | !macroend |
52 | 728 | mdecorde | |
53 | 728 | mdecorde | !macro LANGFILE_INCLUDE_WITHDEFAULT FILENAME FILENAME_DEFAULT |
54 | 728 | mdecorde | |
55 | 728 | mdecorde | ;Called from script: include a langauge file |
56 | 728 | mdecorde | ;Obtains missing strings from a default file |
57 | 728 | mdecorde | |
58 | 728 | mdecorde | !ifdef LangFileString |
59 | 728 | mdecorde | !undef LangFileString |
60 | 728 | mdecorde | !endif |
61 | 728 | mdecorde | |
62 | 728 | mdecorde | !define LangFileString "!insertmacro LANGFILE_SETSTRING" |
63 | 728 | mdecorde | |
64 | 728 | mdecorde | !define LANGFILE_SETNAMES |
65 | 728 | mdecorde | !include "${FILENAME}" |
66 | 728 | mdecorde | !undef LANGFILE_SETNAMES |
67 | 728 | mdecorde | |
68 | 728 | mdecorde | ;Include default language for missing strings |
69 | 728 | mdecorde | !include "${FILENAME_DEFAULT}" |
70 | 728 | mdecorde | |
71 | 728 | mdecorde | ;Create language strings |
72 | 728 | mdecorde | !undef LangFileString |
73 | 728 | mdecorde | !define LangFileString "!insertmacro LANGFILE_LANGSTRING" |
74 | 728 | mdecorde | !include "${FILENAME_DEFAULT}" |
75 | 728 | mdecorde | |
76 | 728 | mdecorde | !macroend |
77 | 728 | mdecorde | |
78 | 728 | mdecorde | !macro LANGFILE IDNAME NAME |
79 | 728 | mdecorde | |
80 | 728 | mdecorde | ;Start of standard NSIS language file |
81 | 728 | mdecorde | |
82 | 728 | mdecorde | !ifdef LANGFILE_SETNAMES |
83 | 728 | mdecorde | |
84 | 728 | mdecorde | !ifdef LANGFILE_IDNAME |
85 | 728 | mdecorde | !undef LANGFILE_IDNAME |
86 | 728 | mdecorde | !endif |
87 | 728 | mdecorde | |
88 | 728 | mdecorde | !define LANGFILE_IDNAME "${IDNAME}" |
89 | 728 | mdecorde | |
90 | 728 | mdecorde | !ifndef "LANGFILE_${IDNAME}_NAME" |
91 | 728 | mdecorde | !define "LANGFILE_${IDNAME}_NAME" "${NAME}" |
92 | 728 | mdecorde | !endif |
93 | 728 | mdecorde | |
94 | 728 | mdecorde | !endif |
95 | 728 | mdecorde | |
96 | 728 | mdecorde | !macroend |
97 | 728 | mdecorde | |
98 | 728 | mdecorde | !macro LANGFILE_EXT IDNAME |
99 | 728 | mdecorde | |
100 | 728 | mdecorde | ;Start of installer language file |
101 | 728 | mdecorde | |
102 | 728 | mdecorde | !ifdef LANGFILE_SETNAMES |
103 | 728 | mdecorde | |
104 | 728 | mdecorde | !ifdef LANGFILE_IDNAME |
105 | 728 | mdecorde | !undef LANGFILE_IDNAME |
106 | 728 | mdecorde | !endif |
107 | 728 | mdecorde | |
108 | 728 | mdecorde | !define LANGFILE_IDNAME "${IDNAME}" |
109 | 728 | mdecorde | |
110 | 728 | mdecorde | !endif |
111 | 728 | mdecorde | |
112 | 728 | mdecorde | !macroend |
113 | 728 | mdecorde | |
114 | 728 | mdecorde | !macro LANGFILE_SETSTRING NAME VALUE |
115 | 728 | mdecorde | |
116 | 728 | mdecorde | ;Set define with translated string |
117 | 728 | mdecorde | |
118 | 728 | mdecorde | !ifndef ${NAME} |
119 | 728 | mdecorde | !define "${NAME}" "${VALUE}" |
120 | 728 | mdecorde | !endif |
121 | 728 | mdecorde | |
122 | 728 | mdecorde | !macroend |
123 | 728 | mdecorde | |
124 | 728 | mdecorde | !macro LANGFILE_LANGSTRING NAME DUMMY |
125 | 728 | mdecorde | |
126 | 728 | mdecorde | ;Create a language string from a define and undefine |
127 | 728 | mdecorde | |
128 | 728 | mdecorde | LangString "${NAME}" "${LANG_${LANGFILE_IDNAME}}" "${${NAME}}" |
129 | 728 | mdecorde | !undef "${NAME}" |
130 | 728 | mdecorde | |
131 | 728 | mdecorde | !macroend |
132 | 728 | mdecorde | |
133 | 728 | mdecorde | !endif |