~openerp-dev/openobject-client-web/6.0-opw-598313-msh

« back to all changes in this revision

Viewing changes to openerp/__init__.py

  • Committer: ame (Tiny/Axelor)
  • Date: 2009-04-20 18:37:57 UTC
  • Revision ID: ame@tinyerp.com-20090420183757-fb6f9253vjybgry3
* Implemented core i18n & l18n api.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import os
 
2
import sys
 
3
 
 
4
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'lib')
 
5
if os.path.exists(libdir) and libdir not in sys.path:
 
6
    sys.path.insert(0, libdir)
 
7
 
 
8
del os
 
9
del sys
 
10
del libdir
 
11
 
 
12
 
1
13
def ustr(value):
2
14
    """This method is similar to the builtin `str` method, except
3
15
    it will return Unicode string.
31
43
    from locale import getlocale
32
44
    return unicode(value, getlocale()[1])
33
45
 
 
46
from i18n import gettext
 
47
 
 
48
__builtins__['_'] = gettext
34
49
__builtins__['ustr'] = ustr
35
 
__builtins__['_'] = lambda v: v #TODO: implement lazy gettext
 
50
 
36
51
 
37
52
# vim: ts=4 sts=4 sw=4 si et
38
53