changeset 4515:04f3cfbf446a

use per-wiki i18n cache (fixes wrong links to other farm wikis)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 28 Jan 2009 17:06:22 +0100
parents af09c1b3a153
children f4e745c7f8e8 0d03855518a4
files MoinMoin/i18n/__init__.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/i18n/__init__.py	Wed Jan 28 16:42:21 2009 +0100
+++ b/MoinMoin/i18n/__init__.py	Wed Jan 28 17:06:22 2009 +0100
@@ -60,7 +60,10 @@
     request.clock.start('i18n_init')
     if languages is None:
         logging.debug("trying to load translations from cache")
-        meta_cache = caching.CacheEntry(request, 'i18n', 'meta', scope='farm', use_pickle=True)
+        # the scope of the i18n cache needs to be per-wiki, because some translations
+        # have http links (to some help pages) and they must not point to another
+        # wiki in the farm (confusing and maybe not even readable due to ACLs):
+        meta_cache = caching.CacheEntry(request, 'i18n', 'meta', scope='wiki', use_pickle=True)
         i18n_dir = os.path.join(request.cfg.moinmoin_dir, 'i18n')
         if meta_cache.needsUpdate(i18n_dir):
             logging.debug("cache needs update")
@@ -199,7 +202,8 @@
 
     def loadLanguage(self, request, trans_dir="i18n"):
         request.clock.start('loadLanguage')
-        cache = caching.CacheEntry(request, arena='i18n', key=self.language, scope='farm', use_pickle=True)
+        # see comment about per-wiki scope above
+        cache = caching.CacheEntry(request, arena='i18n', key=self.language, scope='wiki', use_pickle=True)
         langfilename = po_filename(request, self.language, self.domain, i18n_dir=trans_dir)
         needsupdate = cache.needsUpdate(langfilename)
         if not needsupdate: