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

GeanyPy: plugins has no translation strings #272

Open
scriptum opened this issue Jul 13, 2015 · 2 comments
Open

GeanyPy: plugins has no translation strings #272

scriptum opened this issue Jul 13, 2015 · 2 comments

Comments

@scriptum
Copy link
Member

While GeanyPy itself translatable, plugins included in it have no translation strings. It's easy to localize python:

import gettext
_ = lambda x: gettext.ldgettext("geany-plugins", x)

or

from gettext import gettext as _

Upd: parts of GeanyPy written in Python aren't translatable too:

        lbl = gtk.Label("Choose plugins to load or unload:")
@frlan
Copy link
Member

frlan commented Jul 13, 2015

Would this approach need any changes on update-po procedure?

@b4n
Copy link
Member

b4n commented Jan 18, 2016

@frlan no, it would work just fine as is, just listing python files in POTFILES.in and marking strings with _()

I gave this a quick shot, and the extraction process works fine, but I can't seem to get the translations from Python, as it makes it crash somehow:

Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "/tmp/_install_gtk2/lib/geany/geanypy/geany/__init__.py", line 20, in <module>
    import manager
  File "/tmp/_install_gtk2/lib/geany/geanypy/geany/manager.py", line 7, in <module>
    t = gettext.translation('geany-plugins', '/tmp/_install_gtk2/share/locale')
  File "/usr/lib/python2.7/gettext.py", line 481, in translation
    t = _translations.setdefault(key, class_(fp))
  File "/usr/lib/python2.7/gettext.py", line 182, in __init__
    self._parse(fp)
  File "/usr/lib/python2.7/gettext.py", line 317, in _parse
    plural = v[1].split('plural=')[1]
IndexError: list index out of range

either using the recommend

import gettext
t = gettext.translation('geany-plugins', '...')
_ = t.gettext

or the one here after binding the textdomain with gettext.bindtextdomain().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants