Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Anti-censorship
BridgeDB
Commits
7bde75e2
Commit
7bde75e2
authored
Jun 27, 2013
by
aagbsn
Browse files
Use fallback languages
parent
d07a2b9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/bridgedb/HTTPServer.py
View file @
7bde75e2
...
...
@@ -282,9 +282,13 @@ def setLocaleFromRequestHeader(request):
localedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'i18n/'
)
if
langs
:
langs
=
filter
(
lambda
x
:
re
.
match
(
'^[a-z
_
]{1,5}$'
,
x
),
langs
)
langs
=
filter
(
lambda
x
:
re
.
match
(
'^[a-z
\-
]{1,5}$'
,
x
),
langs
)
logging
.
debug
(
"Languages: %s"
%
langs
)
map
(
lambda
x
:
x
.
replace
(
"-"
,
"_"
).
lower
(),
langs
)
# add fallback languages
langs_only
=
filter
(
lambda
x
:
'-'
in
x
,
langs
)
langs
.
extend
(
map
(
lambda
x
:
x
.
split
(
'-'
)[
0
],
langs_only
))
# gettext wants _, not -
map
(
lambda
x
:
x
.
replace
(
'-'
,
'_'
),
langs
)
lang
=
gettext
.
translation
(
"bridgedb"
,
localedir
=
localedir
,
languages
=
langs
,
fallback
=
True
)
languages
=
langs
,
fallback
=
True
)
lang
.
install
(
True
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment