Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation #375

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions dnf/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def setup_stdout():


def ucd_input(ucstring):
# :api, deprecated in 2.0.0, will be erased when python2 is abandoned
""" It uses print instead of passing the prompt to raw_input.

raw_input doesn't encode the passed string and the output
Expand All @@ -110,6 +111,7 @@ def ucd_input(ucstring):


def ucd(obj):
# :api, deprecated in 2.0.0, will be erased when python2 is abandoned
""" Like the builtin unicode() but tries to use a reasonable encoding. """
if dnf.pycomp.PY3:
if dnf.pycomp.is_py3bytes(obj):
Expand Down Expand Up @@ -277,7 +279,15 @@ def _indent_at_beg(line):

return '\n'.join(ret)

# setup translation
t = dnf.pycomp.gettext.translation('dnf', fallback=True)
_, P_ = dnf.pycomp.gettext_setup(t)

def translation(name):
# :api, deprecated in 2.0.0, will be erased when python2 is abandoned
""" Easy gettext translations setup based on given domain name """

def ucd_wrapper(fnc):
return lambda *w: ucd(fnc(*w))
t = dnf.pycomp.gettext.translation(name, fallback=True)
return map(ucd_wrapper, dnf.pycomp.gettext_setup(t))

# setup translations
_, P_ = translation("dnf")