Back to index

plone3  3.1.7
fr.py
Go to the documentation of this file.
00001 # -*- coding: UTF-8 -*-
00002 
00003 from plone.i18n.normalizer.interfaces import INormalizer
00004 from zope.interface import implements
00005 from plone.i18n.normalizer.base import mapUnicode
00006 
00007 # French character mapping
00008 mapping = {
00009     339: 'oe'
00010 }
00011 
00012 class Normalizer(object):
00013     """
00014     This normalizer can normalize any unicode string and returns a version
00015     that only contains of ASCII characters.
00016 
00017     Let's make sure that this implementation actually fulfills the API.
00018 
00019       >>> from zope.interface.verify import verifyClass
00020       >>> verifyClass(INormalizer, Normalizer)
00021       True
00022     """
00023     implements(INormalizer)
00024 
00025     def normalize(self, text, locale=None, max_length=None):
00026         """
00027         Returns a normalized text. text has to be a unicode string.
00028         """
00029         return mapUnicode(text, mapping=mapping)
00030 
00031 normalizer = Normalizer()