equal
deleted
inserted
replaced
95 __version__ = "$Revision: 1.5 $" |
95 __version__ = "$Revision: 1.5 $" |
96 |
96 |
97 # ----------------------------------------------------------------------------- |
97 # ----------------------------------------------------------------------------- |
98 |
98 |
99 |
99 |
|
100 def getSupportedLanguageDict(appname): |
|
101 """ |
|
102 Returns dictionary with languages already supported |
|
103 by given application |
|
104 |
|
105 param: appname: |
|
106 name of application |
|
107 """ |
|
108 languageDict = {} |
|
109 ext = '.po' |
|
110 files = [x for x in os.listdir('.') |
|
111 if x.startswith(appname) and x.endswith(ext)] |
|
112 |
|
113 langs = [x.split(appname + '_')[1].split(ext)[0] for x in files] |
|
114 for lang in langs: |
|
115 languageDict[lang] = lang |
|
116 |
|
117 return languageDict |
|
118 |
|
119 |
100 def getlanguageDict(): |
120 def getlanguageDict(): |
101 languageDict = {} |
121 languageDict = {} |
102 |
122 getSupportedLanguageDict('Beremiz') |
103 if wx.VERSION >= (3, 0, 0): |
123 if wx.VERSION >= (3, 0, 0): |
104 _app = wx.App() |
124 _app = wx.App() |
105 else: |
125 else: |
106 _app = wx.PySimpleApp() |
126 _app = wx.PySimpleApp() |
107 |
127 |
203 # generate messages.po |
223 # generate messages.po |
204 cmd = 'msginit --no-wrap --no-translator -i %s -l en_US.UTF-8 -o messages.po' % (fileout) |
224 cmd = 'msginit --no-wrap --no-translator -i %s -l en_US.UTF-8 -o messages.po' % (fileout) |
205 verbosePrint(verbose, cmd) |
225 verbosePrint(verbose, cmd) |
206 os.system(cmd) |
226 os.system(cmd) |
207 |
227 |
208 languageDict = getlanguageDict() |
228 languageDict = getSupportedLanguageDict(applicationName) |
209 |
229 |
210 for langCode in languageDict.keys(): |
230 for langCode in languageDict.keys(): |
211 if langCode == 'en': |
231 if langCode == 'en': |
212 pass |
232 pass |
213 else: |
233 else: |
228 else: |
248 else: |
229 applicationName = applicationDomain |
249 applicationName = applicationDomain |
230 currentDir = os.getcwd() |
250 currentDir = os.getcwd() |
231 os.chdir(applicationDirectoryPath) |
251 os.chdir(applicationDirectoryPath) |
232 |
252 |
233 languageDict = getlanguageDict() |
253 languageDict = getSupportedLanguageDict(applicationName) |
234 |
254 |
235 for langCode in languageDict.keys(): |
255 for langCode in languageDict.keys(): |
236 if langCode == 'en': |
256 if langCode == 'en': |
237 pass |
257 pass |
238 else: |
258 else: |
282 else: |
302 else: |
283 applicationName = applicationDomain |
303 applicationName = applicationDomain |
284 currentDir = os.getcwd() |
304 currentDir = os.getcwd() |
285 os.chdir(applicationDirectoryPath) |
305 os.chdir(applicationDirectoryPath) |
286 |
306 |
287 languageDict = getlanguageDict() |
307 languageDict = getSupportedLanguageDict(applicationName) |
288 |
308 |
289 for langCode in languageDict.keys(): |
309 for langCode in languageDict.keys(): |
290 if (langCode == 'en') and (forceEnglish == 0): |
310 if (langCode == 'en') and (forceEnglish == 0): |
291 pass |
311 pass |
292 else: |
312 else: |