[Mailman-i18n] the internationalization patches

shawn Erdil cerdil@ttnet.net.tr
Sat Nov 9 10:42:34 2002


i  applied  the  latest patches  to  i18n.py  and  scrubber.py

but in  HyperachArch.py

3 out of 24 hunks FAILED --

i get these  rejections   , in  HyperArch.py ,  as  the result of  the
HyperArch.py patch.
instead  of  the patch,  would  the  latest   CVS  version  make  the
necessary  changes?
*i have  replaced  the  latest  cvs version already.

******My  only  problem at  the moment  is  to   strip  the  html,mime
multipart alternative   content & convert  to  plain  text  for
archiving,

but  i  am  not  succesfull at  doing  it.

thank  you,

shawn erdil
e-zbanner.com

***************
*** 162,168 ****
  # strings.  Keys are (templatefile, lang) tuples.
  _templatecache = {}

- def quick_maketext(templatefile, dict=None, raw=0, lang=None, mlist=None):
      if lang is None:
          lang = mlist.preferred_language
      template = _templatecache.get((templatefile, lang))
--- 178,185 ----
  # strings.  Keys are (templatefile, lang) tuples.
  _templatecache = {}

+ def quick_maketext(templatefile, dict=None, raw=0,
+                    lang=None, mlist=None, charset = None):
      if lang is None:
          lang = mlist.preferred_language
      template = _templatecache.get((templatefile, lang))
***************
*** 170,175 ****
          # Use the basic maketext, with defaults to get the raw template
          template = Utils.maketext(templatefile, lang=lang, raw=1)
          _templatecache[(templatefile, lang)] = template
      # Copied from Utils.maketext()
      text = template
      if dict is not None:
--- 187,210 ----
          # Use the basic maketext, with defaults to get the raw template
          template = Utils.maketext(templatefile, lang=lang, raw=1)
          _templatecache[(templatefile, lang)] = template
+     tcharset = Utils.GetCharSet(lang)
+     if charset and tcharset != charset and tcharset != 'us-ascii':
+         # Need to recode the template
+         try:
+             utemplate = unicode(template, tcharset)
+         except (LookupError, UnicodeError):
+             # template charset unknown, ignore
+             pass
+         else:
+             try:
+                 template = utemplate.encode(charset)
+             except LookupError:
+                 # target charset unknown, ignore
+                 pass
+             except UnicodeError:
+                 # template not encodable in target charset.
+                 # Use character references
+                 template = unicode_quote(utemplate)
      # Copied from Utils.maketext()
      text = template
      if dict is not None:
***************
*** 650,660 ****
                  d["archive_listing_start"] = quick_maketext(
                      'archliststart.html', raw=1,
                      lang=mlist.preferred_language,
-                     mlist=mlist)
                  d["archive_listing_end"] = quick_maketext(
                      'archlistend.html', raw=1,
                      lang=mlist.preferred_language,
-                     mlist=mlist)

                  accum = []
                  for a in self.archives:
--- 699,709 ----
                  d["archive_listing_start"] = quick_maketext(
                      'archliststart.html', raw=1,
                      lang=mlist.preferred_language,
+                     mlist=mlist, charset = self.charset)
                  d["archive_listing_end"] = quick_maketext(
                      'archlistend.html', raw=1,
                      lang=mlist.preferred_language,
+                     mlist=mlist, charset = self.charset)

                  accum = []
                  for a in self.archives:








More information about the Mailman-i18n mailing list