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 = <web2py.gluon.custom_import._Web2pyImporter object at...
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]

is_gae

PyMySQL: A pure-Python drop-in replacement for MySQLdb.

Copyright (c) 2010 PyMySQL contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Value:
global_settings.applications_parent

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]+)?$')