Attachment 'MoinMoin.i18n.patch'
Download 1 --- MoinMoin/i18n/__init__.py 2009-12-03 22:26:52 +0000
2 +++ MoinMoin/i18n/__init__.py 2009-12-03 22:21:50 +0000
3 @@ -222,7 +222,7 @@
4 def loadLanguage(self, request, trans_dir="i18n"):
5 request.clock.start('loadLanguage')
6 # see comment about per-wiki scope above
7 - cache = caching.CacheEntry(request, arena='i18n', key=self.language, scope='wiki', use_pickle=True)
8 + cache = caching.CacheEntry(request, arena='i18n', key=('%s_%s' % (self.language, self.domain)), scope='wiki', use_pickle=True)
9 langfilename = po_filename(request, self.language, self.domain, i18n_dir=trans_dir)
10 needsupdate = cache.needsUpdate(langfilename)
11 if not needsupdate:
12 @@ -256,6 +256,18 @@
13 """ Return the text direction for a language, either 'ltr' or 'rtl'. """
14 return languages[lang]['x-direction']
15
16 +def loadAllDomains(request, lang):
17 + t = Translation(lang)
18 + t.loadLanguage(request)
19 + global translations
20 + translations[lang] = t
21 + for lang_file in glob.glob(po_filename(request, language=lang, domain='*')):
22 + domain = os.path.basename(lang_file).split('.')[1]
23 + if domain != 'MoinMoin':
24 + t = Translation(lang, domain)
25 + t.loadLanguage(request)
26 + translations[lang].raw.update(t.raw)
27 +
28 def getText(original, request, lang, **kw):
29 """ Return a translation of some original text.
30
31 @@ -279,9 +291,7 @@
32
33 global translations
34 if not lang in translations: # load translation if needed
35 - t = Translation(lang)
36 - t.loadLanguage(request)
37 - translations[lang] = t
38 + loadAllDomains(request, lang)
39
40 # get the matching entry in the mapping table
41 translated = original
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.