Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Register an i18n directory 

        def registerTranslations(directory=None):
    ''' Register an i18n directory '''
    frame = sys._getframe(1)
    try:
        file_path = frame.f_locals['__file__']
    except KeyError:
        # Called from a function?
        file_path = frame.f_globals['__file__']
    base_path = os.path.dirname(file_path)
    if directory is None:
        directory = 'locales'
    directory = os.path.join(base_path, directory)
    # XXX we do not have function grokkers (yet) so we put the annotation
    # on the module and defer its registration.
    i18n_translations = frame.f_locals.get('__grok_i18n_translations__', None)
    if i18n_translations is None:
        frame.f_locals['__grok_i18n_translations__'] = i18n_translations = []

    i18n_translations.append(directory)
        


src/c/o/collective.grok-1.0a2/src/collective/grok/tests/i18n/translations.py   collective.grok(Download)
# -*- coding:utf-8 -*-
from collective.grok import i18n
 
i18n.registerTranslations(directory='locales')