[GRASS-dev] Some string not translated in wxGUI

Hi,

some messages (see below/screenshot) are not shown in translation. They are
coming from grasslibs_XX.po and are translated in JA and DE but still appear
in English. Somehow the translations are not propagated to the wxGUI.

Martin has indicated to me differences between
grass64/lib/gis/locale.c
and
grass70/lib/gis/locale.c

Anything to sync here?

Markus

(attachments)

msg_i18n_problem.jpg

Markus Neteler wrote:

some messages (see below/screenshot) are not shown in translation. They are
coming from grasslibs_XX.po and are translated in JA and DE but still appear
in English. Somehow the translations are not propagated to the wxGUI.

In 6.x, those strings aren't localised in G_usage_xml(). Try r41031
(for 6.5).

--
Glynn Clements <glynn@gclements.plus.com>

On Mon, Feb 15, 2010 at 3:02 PM, Glynn Clements
<glynn@gclements.plus.com> wrote:

Markus Neteler wrote:

some messages (see below/screenshot) are not shown in translation. They are
coming from grasslibs_XX.po and are translated in JA and DE but still appear
in English. Somehow the translations are not propagated to the wxGUI.

In 6.x, those strings aren't localised in G_usage_xml(). Try r41031
(for 6.5).

This helps, backported.

Yet another one is there (DE example):

#: ../gui/wxpython/gui_modules/menuform.py:871
#: ../gui/wxpython/gui_modules/preferences.py:1131
msgid "Close dialog on finish"
msgstr "Schließe den Dialog beim Beenden"

But they are indicated correctly:
[neteler@north grass64]$ grep 'Close dialog on f' gui/*/*/*
gui/wxpython/gui_modules/menuform.py:
      label=_('Close dialog on finish'), style = wx.NO_BORDER)
gui/wxpython/gui_modules/preferences.py:
label=_("Close dialog on finish"),

To get things like
   'label=_("Close dialog on finish")'
shown translated in the file preferences.py, I had to add the "import gettext"
stuff (yet unsubmitted).

Looking around I found other .py files lacking the gettext stuff.
What's the right way to do it? Add everywhere or is there a better way?
Or can it be inherited from globalvar.py or another file?

Before cluttering files, I thought to ask.

Markus

Markus Neteler wrote:

>> some messages (see below/screenshot) are not shown in translation. They are
>> coming from grasslibs_XX.po and are translated in JA and DE but still appear
>> in English. Somehow the translations are not propagated to the wxGUI.
>
> In 6.x, those strings aren't localised in G_usage_xml(). Try r41031
> (for 6.5).

This helps, backported.

Yet another one is there (DE example):

#: ../gui/wxpython/gui_modules/menuform.py:871
#: ../gui/wxpython/gui_modules/preferences.py:1131
msgid "Close dialog on finish"
msgstr "Schließe den Dialog beim Beenden"

But they are indicated correctly:
[neteler@north grass64]$ grep 'Close dialog on f' gui/*/*/*
gui/wxpython/gui_modules/menuform.py:
      label=_('Close dialog on finish'), style = wx.NO_BORDER)
gui/wxpython/gui_modules/preferences.py:
label=_("Close dialog on finish"),

To get things like
   'label=_("Close dialog on finish")'
shown translated in the file preferences.py, I had to add the "import gettext"
stuff (yet unsubmitted).

Looking around I found other .py files lacking the gettext stuff.
What's the right way to do it? Add everywhere or is there a better way?
Or can it be inherited from globalvar.py or another file?

For any process, the __main__ module (the one which is executed rather
than "import"ed) should call gettext.install. This inserts the "_"
function into the global namespace.

The call in wxgui.py should be sufficient for the GUI itself, but
menuform.py also requires it for the case where it is executed from
G_gui().

IOW, any module which uses:

  if __name__ == '__main__':
      ....

(other than for debug/test/demonstration purposes) should call
gettext.install within that section of code (calling it from the top
level is suboptimal, but probably harmless).

--
Glynn Clements <glynn@gclements.plus.com>

On Wed, Feb 17, 2010 at 8:10 PM, Glynn Clements
<glynn@gclements.plus.com> wrote:

Markus Neteler wrote:

>> some messages (see below/screenshot) are not shown in translation.

...

Looking around I found other .py files lacking the gettext stuff.
What's the right way to do it? Add everywhere or is there a better way?
Or can it be inherited from globalvar.py or another file?

For any process, the __main__ module (the one which is executed rather
than "import"ed) should call gettext.install. This inserts the "_"
function into the global namespace.

The call in wxgui.py should be sufficient for the GUI itself, but
menuform.py also requires it for the case where it is executed from
G_gui().

IOW, any module which uses:

   if \_\_name\_\_ == &#39;\_\_main\_\_&#39;:
       \.\.\.\.

(other than for debug/test/demonstration purposes) should call
gettext.install within that section of code (calling it from the top
level is suboptimal, but probably harmless).

So, I would add it after __main__ in:

svn status gui/wxpython/
M gui/wxpython/gui_modules/location_wizard.py
M gui/wxpython/gui_modules/mcalc_builder.py
M gui/wxpython/gui_modules/render.py

? This would also activate preferences.py?
I am not on my development machine, so I cannot test.

Markus

Markus Neteler wrote:

>> Looking around I found other .py files lacking the gettext stuff.
> IOW, any module which uses:
>
> if __name__ == '__main__':
> ....
>
> (other than for debug/test/demonstration purposes) should call
> gettext.install within that section of code (calling it from the top
> level is suboptimal, but probably harmless).

So, I would add it after __main__ in:

svn status gui/wxpython/
M gui/wxpython/gui_modules/location_wizard.py
M gui/wxpython/gui_modules/mcalc_builder.py
M gui/wxpython/gui_modules/render.py

I don't know enough about the GUI and GUI-based startup to know which
files are executed. The GUI itself is wxgui.py, while G_parser()
executes menuform.py. Other than that, I don't know.

? This would also activate preferences.py?

gettext.install makes "_" a built-in function, so it's then available
for all modules.

--
Glynn Clements <glynn@gclements.plus.com>

On Thu, Feb 18, 2010 at 9:49 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:

Markus Neteler wrote:

>> Looking around I found other .py files lacking the gettext stuff.
> IOW, any module which uses:
>
> if __name__ == '__main__':
> ....
>
> (other than for debug/test/demonstration purposes) should call
> gettext.install within that section of code (calling it from the top
> level is suboptimal, but probably harmless).

So, I would add it after __main__ in:

svn status gui/wxpython/
M gui/wxpython/gui_modules/location_wizard.py
M gui/wxpython/gui_modules/mcalc_builder.py
M gui/wxpython/gui_modules/render.py

I don't know enough about the GUI and GUI-based startup to know which
files are executed. The GUI itself is wxgui.py, while G_parser()
executes menuform.py. Other than that, I don't know.

? This would also activate preferences.py?

gettext.install makes "_" a built-in function, so it's then available
for all modules.

I have submitted the fixes, now missing strings are translated.

Markus