repo.or.cz
/
aur.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Make the locale directory configurable
[aur.git]
/
aurweb
/
l10n.py
blob
a7c0103e7f2fded1ff031929dd69bfa3c3ac63bc
1
import
gettext
2
3
import
aurweb
.
config
4
5
6
class
Translator
:
7
def
__init__
(
self
):
8
self
._l
ocaledir
=
aurweb
.
config
.
get
(
'options'
,
'localedir'
)
9
self
._
translator
= {}
10
11
def
translate
(
self
,
s
,
lang
):
12
if
lang
==
'en'
:
13
return
s
14
if
lang
not in
self
._
translator
:
15
self
._
translator
[
lang
] =
gettext
.
translation
(
"aurweb"
,
16
self
._l
ocaledir
,
17
languages
=[
lang
])
18
self
._
translator
[
lang
].
install
()
19
return
_
(
s
)