Exemple #1
0
def get_translator_for_lang(cache, bcp_47_code):
    try:
        return cache[bcp_47_code]
    except KeyError:
        pass
    cache[bcp_47_code] = ans = get_translator(bcp_47_code)
    return ans
Exemple #2
0
def get_translator_for_lang(cache, bcp_47_code):
    try:
        return cache[bcp_47_code]
    except KeyError:
        pass
    cache[bcp_47_code] = ans = get_translator(bcp_47_code)
    return ans
Exemple #3
0
 def test(al, q):
     conn.request('GET', '/', headers={'Accept-Language': al})
     r = conn.getresponse()
     self.ae(r.status, http_client.OK)
     q += getattr(
         get_translator(q)[-1],
         'gettext' if ispy3 else 'ugettext')('Unknown')
     self.ae(r.read(), q.encode('utf-8'))
Exemple #4
0
 def test(al, q):
     conn.request('GET', '/', headers={'Accept-Language': al})
     r = conn.getresponse()
     self.ae(r.status, httplib.OK)
     q += get_translator(q)[-1].ugettext('Unknown')
     self.ae(r.read(), q)
Exemple #5
0
 def test(al, q):
     conn.request('GET', '/', headers={'Accept-Language': al})
     r = conn.getresponse()
     self.ae(r.status, httplib.OK)
     q += get_translator(q)[-1].ugettext('Unknown')
     self.ae(r.read(), q)
Exemple #6
0
 def test(al, q):
     conn.request('GET', '/', headers={'Accept-Language': al})
     r = conn.getresponse()
     self.ae(r.status, http_client.OK)
     q += getattr(get_translator(q)[-1], 'gettext' if ispy3 else 'ugettext')('Unknown')
     self.ae(r.read(), q.encode('utf-8'))