44from transifex .native import tx
55
66
7- def translate (string , _context = None , escape = True , ** params ):
7+ def translate (_string , _context = None , _escape = True , ** params ):
88 """Translate the given source string to the current language.
99
1010 A convenience wrapper that uses the current language of a Django app.
1111
1212 If there are any placeholders to replace, they need to be passed as kwargs.
1313
14- :param unicode string : the source string to get the translation for
14+ :param unicode _string : the source string to get the translation for
1515 :param unicode _context: an optional context that gives more information
1616 about the source string
17- :param bool escape : if True, the returned string will be HTML-escaped,
17+ :param bool _escape : if True, the returned string will be HTML-escaped,
1818 otherwise it won't
1919 :return: the final translation in the current language
2020 :rtype: unicode
2121 """
2222 is_source = get_language () == settings .LANGUAGE_CODE
2323 locale = to_locale (get_language ()) # e.g. from en-us to en_US
2424 return tx .translate (
25- string ,
25+ _string ,
2626 locale ,
2727 _context = _context ,
2828 is_source = is_source ,
29- escape = escape ,
29+ escape = _escape ,
3030 params = params ,
3131 )
3232
3333
34- def lazy_translate (string , _context = None , escape = True , ** params ):
34+ def lazy_translate (_string , _context = None , _escape = True , ** params ):
3535 """Lazily translate the given source string to the current language.
3636
3737 Delays the evaluation of translating the given string until necessary.
@@ -41,21 +41,21 @@ def lazy_translate(string, _context=None, escape=True, **params):
4141
4242 See translate() for more details.
4343
44- :param unicode string : the source string to get the translation for
44+ :param unicode _string : the source string to get the translation for
4545 :param unicode _context: an optional context that gives more information
4646 about the source string
47- :param bool escape : if True, the returned string will be HTML-escaped,
47+ :param bool _escape : if True, the returned string will be HTML-escaped,
4848 otherwise it won't
4949 :return: an object that when evaluated as a string will return
5050 the final translation in the current language
5151 :rtype: LazyString
5252 """
5353 return LazyString (
54- translate , string , _context = _context , escape = escape , ** params
54+ translate , _string , _context = _context , escape = _escape , ** params
5555 )
5656
5757
58- def utranslate (string , _context = None , ** params ):
58+ def utranslate (_string , _context = None , ** params ):
5959 """Translate the given source string to the current language, without HTML
6060 escaping.
6161
@@ -66,10 +66,10 @@ def utranslate(string, _context=None, **params):
6666
6767 If there are any placeholders to replace, they need to be passed as kwargs.
6868
69- :param unicode string : the source string to get the translation for
69+ :param unicode _string : the source string to get the translation for
7070 :param unicode _context: an optional context that gives more information
7171 about the source string
7272 :return: the final translation in the current language
7373 :rtype: unicode
7474 """
75- return translate (string , _context , escape = False , ** params )
75+ return translate (_string , _context , escape = False , ** params )
0 commit comments