Package web2py :: Package gluon :: Module languages
[hide private]
[frames] | no frames]

Module languages

source code

This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)

Classes [hide private]
  lazyT
never to be called explicitly, returned by translator.__call__
  translator
this class is instantiated by gluon.compileapp.build_environment as the T object
Functions [hide private]
 
read_dict_aux(filename) source code
 
read_dict(filename) source code
 
utf8_repr(s)
# note that we use raw strings to avoid having to use double back slashes below
source code
 
write_dict(filename, contents) source code
 
findT(path, language='en-us')
must be run by the admin app
source code
 
lazyT_unpickle(data) source code
 
lazyT_pickle(data) source code
 
update_all_languages(application_path) source code
Variables [hide private]
  is_gae = 1
PyMySQL: A pure-Python drop-in replacement for MySQLdb.
  PY_STRING_LITERAL_RE = '(?<=[^\\w]T\\()(?P<name>[uU]?[rR]?(?:\...
  regex_translate = re.compile(r'(?s)(?<=[^\w]T\()(?P<name>[uU]?...
  regex_language = re.compile(r'^[a-zA-Z]{2}(-[a-zA-Z]{2})?(-[a-...
Function Details [hide private]

utf8_repr(s)

source code 

# note that we use raw strings to avoid having to use double back slashes below

utf8_repr() works same as repr() when processing ascii string >>> utf8_repr('abc') == utf8_repr("abc") == repr('abc') == repr("abc") == "'abc'" True >>> utf8_repr('a"b"c') == repr('a"b"c') == '\'a"b"c\'' True >>> utf8_repr("a'b'c") == repr("a'b'c") == '"a\'b\'c"' True >>> utf8_repr('a\'b"c') == repr('a\'b"c') == utf8_repr("a'b\"c") == repr("a'b\"c") == '\'a\\\'b"c\'' True >>> utf8_repr('a\r\nb') == repr('a\r\nb') == "'a\\r\\nb'" # Test for \r, \n True

Unlike repr(), utf8_repr() remains utf8 content when processing utf8 string >>> utf8_repr('中文字') == utf8_repr("中文字") == "'中文字'" != repr('中文字') True >>> utf8_repr('中"文"字') == "'中\"文\"字'" != repr('中"文"字') True >>> utf8_repr("中'文'字") == '"中\'文\'字"' != repr("中'文'字") True >>> utf8_repr('中\'文"字') == utf8_repr("中'文\"字") == '\'中\\\'文"字\'' != repr('中\'文"字') == repr("中'文\"字") True >>> utf8_repr('中\r\n文') == "'中\\r\\n文'" != repr('中\r\n文') # Test for \r, \n True

Variables Details [hide private]

PY_STRING_LITERAL_RE

Value:
'(?<=[^\\w]T\\()(?P<name>[uU]?[rR]?(?:\'\'\'(?:[^\']|\'{1,2}(?!\'))*\'\
\'\')|(?:\'(?:[^\'\\\\]|\\\\.)*\')|(?:"""(?:[^"]|"{1,2}(?!"))*""")|(?:\
"(?:[^"\\\\]|\\\\.)*"))'

regex_translate

Value:
re.compile(r'(?s)(?<=[^\w]T\()(?P<name>[uU]?[rR]?(?:\'\'\'(?:[^\']|\'{\
1,2}(?!\'))*\'\'\')|(?:\'(?:[^\'\\]|\\.)*\')|(?:"""(?:[^"]|"{1,2}(?!")\
)*""")|(?:"(?:[^"\\]|\\.)*"))')

regex_language

Value:
re.compile(r'^[a-zA-Z]{2}(-[a-zA-Z]{2})?(-[a-zA-Z]+)?$')