Short description

With the current approach of listing all template pages in i18n.strings and their translations in i18n.system_pages we should be able to check for translated pages in wikiutil.isTemplatePage.

This will enable to write on all _(Template) pages Variables which weren't expanded by saving the page.

Currently we use a workaround of

@``ME@

which could be replaced on all _(Template) pages to

@``ME@  without the ``

   1 diff -r efde74175d2d MoinMoin/wikiutil.py
   2 --- a/MoinMoin/wikiutil.py	Sat Apr 25 00:45:21 2009 +0200
   3 +++ b/MoinMoin/wikiutil.py	Sat Apr 25 21:59:00 2009 +0200
   4 @@ -627,9 +627,16 @@
   5  
   6      @param pagename: the page name
   7      @rtype: bool
   8 -    @return: true if page is a template page
   9 +    @return: true if page is a template page or the translation of the page is a template page
  10      """
  11 -    return request.cfg.cache.page_template_regexact.search(pagename) is not None
  12 +    from MoinMoin import i18n
  13 +    en_pagename = ''
  14 +    try:
  15 +        en_pagename = i18n.system_pages[pagename][1]
  16 +    except KeyError:
  17 +        pass
  18 +
  19 +    return en_pagename.endswith('Template') or request.cfg.cache.page_template_regexact.search(pagename) is not None
  20  
  21  
  22  def isGroupPage(pagename, cfg):
isTemplatePage.patch


/!\ While that patch would be a nice hack for master wikis, it doesn't make too much sense in general IMHO.

For consistency, translated template pages should follow some pattern, e.g. if original template pages are all named *Template, then all german translations and also all german custom template pages should follow the same pattern, e.g. *Vorlage.

To have all those german pages recognized, admin needs to configure some appropriate template regex, matching all template pages.

This makes the above patch completely superfluous, because that configured regex will already match all pages, without any additional code.

The special problem on master wikis you are obviously trying to solve is that they have all languages, but I didn't configure a regex that matches all template pages (of all languages). That could be fixed though and would be a cleaner solution.

-- ThomasWaldmann 2009-04-26 13:24:00

The problem is currently that Template isn't translated in all languages moin supports. essential_template_pages doesn't show its translated name.


CategoryFeatureRejected

MoinMoin: FeatureRequest/Know_Alien_Template_Pages (last edited 2009-06-07 18:12:15 by ReimarBauer)