Back to index

plone3  3.1.7
Functions | Variables
Archetypes.generator.i18n Namespace Reference

Functions

def translate_wrapper
def null_translate
def initialize
def initial_translate

Variables

 service = None
 translate = None

Detailed Description

IMPORTANT: this module is unusable before initialize is called
    this must be so because we want to make sure all products
    (eg, whatever translation service we're supposed to use)
    is already there and ready

Function Documentation

def Archetypes.generator.i18n.initial_translate (   domain,
  msgid,
  mapping = None,
  context = None,
  target_language = None,
  default = None 
)

Definition at line 46 of file i18n.py.

00046 
00047                       target_language=None, default=None):
00048     initialize()
00049     deprecated('Archetypes.generator.i18n.translate is deprecated and will be '
00050                'removed in Archetypes 1.6. Please use "from zope.i18n import '
00051                'translate" instead.')
00052     return translate(domain, msgid, mapping, context, target_language, default)

Here is the call graph for this function:

Here is the caller graph for this function:

Must be called after Products are there and ready.

Definition at line 33 of file i18n.py.

00033 
00034 def initialize():
00035     """Must be called after Products are there and ready."""
00036     global service, translate
00037     service = getGlobalTranslationService()
00038     if service is DummyTranslationService:
00039         translate = null_translate
00040     elif hasattr(service, '_fallbacks'):
00041         # It accepts the "default" argument
00042         translate = service.translate
00043     else:
00044         translate = translate_wrapper

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.generator.i18n.null_translate (   domain,
  msgid,
  mapping = None,
  context = None,
  target_language = None,
  default = None 
)

Definition at line 30 of file i18n.py.

00030 
00031                    target_language=None, default=None):
00032     return default

Here is the caller graph for this function:

def Archetypes.generator.i18n.translate_wrapper (   domain,
  msgid,
  mapping = None,
  context = None,
  target_language = None,
  default = None 
)
Wrapper for calling the translate() method with a fallback value.

Definition at line 19 of file i18n.py.

00019 
00020                       target_language=None, default=None):
00021     """Wrapper for calling the translate() method with a fallback value."""
00022     res = service.translate(domain, msgid, mapping=mapping, context=context,
00023                             target_language=target_language,
00024                             default=default)
00025 
00026     if res is None or res is msgid:
00027         return default
00028     return res

Here is the call graph for this function:


Variable Documentation

Definition at line 15 of file i18n.py.

Definition at line 16 of file i18n.py.