]>
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')
23 // This enum is generated by misc/languages/genlang.py
24 // When making changes, please put them into misc/languages/langtabl.txt
27 // user's default/preffered language as got from OS:
29 // unknown language, if wxLocale::GetSystemLanguage fails:
34 f
.write(' %s,\n' % i
[0])
36 // for custom, user-defined languages:
37 wxLANGUAGE_USER_DEFINED
44 f
= open('_wxlang.tex', 'wt')
46 %% This enum is generated by misc/languages/genlang.py
47 %% When making changes, please put them into misc/languages/langtabl.txt
48 \\begin{itemize}\\itemsep=0pt
49 \\item wxLANGUAGE_DEFAULT -- user's default language as obtained from the operating system
50 \\item wxLANGUAGE_UNKNOWN -- returned by \\helpref{GetSystemLanguage}{wxlocalegetsystemlanguage}
51 if it fails to detect the default language
52 \\item wxLANGUAGE_USER_DEFINED -- user defined languages' integer identifiers should start from
56 f
.write('\\item %s\n' % (i
[0].replace('_','\\_')))
57 f
.write("""\\end{itemize}
73 if ican
== '"-"': ican
= '""'
75 if ilang
== '-': ilang
= '0'
77 if isublang
== '-': isublang
= '0'
78 lngtable
+= ' LNG(%-38s %-7s, %-15s, %-34s, %s)\n' % \
79 ((i
[0]+','), ican
, ilang
, isublang
, i
[4])
80 if ilang
not in all_langs
: all_langs
.append(ilang
)
81 if isublang
not in all_sublangs
: all_sublangs
.append(isublang
)
85 ifdefs
+= '#ifndef %s\n#define %s (0)\n#endif\n' % (s
, s
)
86 for s
in all_sublangs
:
87 if s
!= '0' and s
!= 'SUBLANG_DEFAULT':
88 ifdefs
+= '#ifndef %s\n#define %s SUBLANG_DEFAULT\n#endif\n' % (s
, s
)
90 f
= open('_wxlang.cpp', 'wt')
92 // This table is generated by misc/languages/genlang.py
93 // When making changes, please put them into misc/languages/langtabl.txt
97 #define SETWINLANG(info,lang,sublang)
101 #define SETWINLANG(info,lang,sublang) \\
102 info.WinLang = lang, info.WinSublang = sublang;
108 #define LNG(wxlang, canonical, winlang, winsublang, desc) \\
109 info.Language = wxlang; \\
110 info.CanonicalName = wxT(canonical); \\
111 info.Description = desc; \\
112 SETWINLANG(info, winlang, winsublang) \\
115 void wxLocale::InitLanguagesDB()
118 wxStringTokenizer tkn;
123 """ % (ifdefs
, lngtable
))