]>
git.saurik.com Git - wxWidgets.git/blob - misc/languages/genlang.py
4 # Generates wxLanguage enum (to be cut&pasted to include/wx/intl.h)
5 # and convertion tables (ditto to src/common/intl.cpp)
12 f
= open('langtabl.txt')
13 for i
in f
.readlines():
15 table
.append((ispl
[0], ispl
[1], ispl
[2], ispl
[3], string
.join(ispl
[4:])))
21 f
= open('_wxlang.h', 'wt')
24 // --- --- --- generated code begins here --- --- ---
26 // This enum is generated by misc/languages/genlang.py
27 // When making changes, please put them into misc/languages/langtabl.txt
30 // user's default/preffered language as got from OS:
32 // unknown language, if wxLocale::GetSystemLanguage fails:
37 f
.write(' %s,\n' % i
[0])
39 // for custom, user-defined languages:
40 wxLANGUAGE_USER_DEFINED
43 // --- --- --- generated code ends here --- --- ---
50 f
= open('_wxlang.tex', 'wt')
53 %% --- --- --- generated code begins here --- --- ---
55 %% This enum is generated by misc/languages/genlang.py
56 %% When making changes, please put them into misc/languages/langtabl.txt
57 \\begin{itemize}\\itemsep=0pt
58 \\item wxLANGUAGE_DEFAULT -- user's default language as obtained from the operating system
59 \\item wxLANGUAGE_UNKNOWN -- returned by \\helpref{GetSystemLanguage}{wxlocalegetsystemlanguage}
60 if it fails to detect the default language
61 \\item wxLANGUAGE_USER_DEFINED -- user defined languages' integer identifiers should start from
65 f
.write('\\item %s\n' % (i
[0].replace('_','\\_')))
66 f
.write("""\\end{itemize}
68 %% --- --- --- generated code ends here --- --- ---
85 if ican
== '"-"': ican
= '""'
87 if ilang
== '-': ilang
= '0'
89 if isublang
== '-': isublang
= '0'
90 lngtable
+= ' LNG(%-38s %-7s, %-15s, %-34s, %s)\n' % \
91 ((i
[0]+','), ican
, ilang
, isublang
, i
[4])
92 if ilang
not in all_langs
: all_langs
.append(ilang
)
93 if isublang
not in all_sublangs
: all_sublangs
.append(isublang
)
97 ifdefs
+= '#ifndef %s\n#define %s (0)\n#endif\n' % (s
, s
)
98 for s
in all_sublangs
:
99 if s
!= '0' and s
!= 'SUBLANG_DEFAULT':
100 ifdefs
+= '#ifndef %s\n#define %s SUBLANG_DEFAULT\n#endif\n' % (s
, s
)
102 f
= open('_wxlang.cpp', 'wt')
104 // --- --- --- generated code begins here --- --- ---
106 // This table is generated by misc/languages/genlang.py
107 // When making changes, please put them into misc/languages/langtabl.txt
111 #define SETWINLANG(info,lang,sublang)
115 #define SETWINLANG(info,lang,sublang) \\
116 info.WinLang = lang, info.WinSublang = sublang;
122 #define LNG(wxlang, canonical, winlang, winsublang, desc) \\
123 info.Language = wxlang; \\
124 info.CanonicalName = wxT(canonical); \\
125 info.Description = desc; \\
126 SETWINLANG(info, winlang, winsublang) \\
129 void wxLocale::InitLanguagesDB()
132 wxStringTokenizer tkn;
138 // --- --- --- generated code ends here --- --- ---
140 """ % (ifdefs
, lngtable
))