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) | Plural subsystem is created by Vladyslav Kozlovskyy (Ukraine) <dbdevelop@gmail.com>

Translation system --------------------------------------------

Classes [hide private]
  lazyT
Never to be called explicitly, returned by translator.__call__() or translator.M()
  translator
This class is instantiated by gluon.compileapp.build_environment as the T object
Functions [hide private]
 
DEFAULT_GET_PLURAL_ID(n) source code
 
DEFAULT_CONSTRUCT_PLURAL_FORM(word, plural_id) source code
 
is_writable()
returns True if and only if the filesystem is writable
source code
 
safe_eval(text) source code
 
markmin(s) source code
 
upper_fun(s) source code
 
title_fun(s) source code
 
cap_fun(s) source code
 
get_from_cache(cache, val, fun) source code
 
clear_cache(filename) source code
 
read_dict_aux(filename) source code
 
read_dict(filename)
Returns dictionary with translation messages
source code
 
read_possible_plural_rules()
Creates list of all possible plural rules files The result is cached in PLURAL_RULES dictionary to increase speed
source code
 
read_possible_languages_aux(langdir) source code
 
read_possible_languages(langpath) source code
 
read_plural_dict_aux(filename) source code
 
read_plural_dict(filename) source code
 
write_plural_dict(filename, contents) source code
 
sort_function(x, y) source code
 
write_dict(filename, contents) source code
 
pickle_lazyT(c) source code
 
findT(path, language='en')
Note:...
source code
 
update_all_languages(application_path)
Note:...
source code
Variables [hide private]
  DEFAULT_LANGUAGE = 'en'
  DEFAULT_LANGUAGE_NAME = 'English'
  DEFAULT_NPLURALS = 1
  NUMBERS = (<type 'int'>, <type 'long'>, <type 'float'>)
  PY_STRING_LITERAL_RE = '(?<=[^\\w]T\\()(?P<name>[uU]?[rR]?(?:\...
  regex_translate = re.compile(r'(?s)(?<=[^\w]T\()(?P<name>[uU]?...
  regex_param = re.compile(r'\{(?P<s>.+?)\}')
  regex_language = re.compile(r'([a-z]{2,3}(?:-[a-z]{2})?(?:-[a-...
  regex_langfile = re.compile(r'^[a-z]{2,3}(-[a-z]{2})?\.py$')
  regex_backslash = re.compile(r'\\([\\\{\}%])')
  regex_plural = re.compile(r'%(\{.+?\})')
  regex_plural_dict = re.compile(r'^\{(?P<w>[^\(\)\[\]][^\(\)\[\...
  regex_plural_tuple = re.compile(r'^\{(?P<w>[^\[\]\(\)]+)(?:\[(...
  regex_plural_file = re.compile(r'^plural-[a-zA-Z]{2}(-[a-zA-Z]...
  ttab_in = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\...
  ttab_out = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r...
  global_language_cache = {}
  PLURAL_RULES = {'af': ('af', 2, <function <lambda> at 0x27af39...
  __package__ = 'gluon'
Function Details [hide private]

findT(path, language='en')

source code 

Note:
    Must be run by the admin app

update_all_languages(application_path)

source code 

Note:
    Must be run by the admin app


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-z]{2,3}(?:-[a-z]{2})?(?:-[a-z]{2})?)(?:[,;]|$)')

regex_plural_dict

Value:
re.compile(r'^\{(?P<w>[^\(\)\[\]][^\(\)\[\]]*?)\((?P<n>[^\(\)\[\]]+)\)\
\}$')

regex_plural_tuple

Value:
re.compile(r'^\{(?P<w>[^\[\]\(\)]+)(?:\[(?P<i>\d+)\])?\}$')

regex_plural_file

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

ttab_in

Value:
'''\x00\x01\x02\x03\x04\x05\x06\x07\x08\t
\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\
\x1d\x1e\x1f !"#$\x1d&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU\
VWXYZ[\x1c]^_`abcdefghijklmnopqrstuvwxyz\x1e|\x1f~\x7f\x80\x81\x82\x83\
\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x\
95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\
\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\x\
b8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\
...

ttab_out

Value:
'''\x00\x01\x02\x03\x04\x05\x06\x07\x08\t
\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\\%{\
} !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`ab\
cdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x\
89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\
\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\x\
ac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\
\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\x\
...

PLURAL_RULES

Value:
read_possible_plural_rules()