[GRASS-dev] Re: [GRASS-SVN] r40421 - grass/branches/develbranch_6/gui/wxpython

Hi,

these buttons should be translated by the system's locales. I am not
sure if it's good practice to translate them locally. At least you
disabled standard shortcuts, e.g. &Help.

Martin

2010/1/14 <svn_grass@osgeo.org>:

Author: neteler
Date: 2010-01-13 18:32:36 -0500 (Wed, 13 Jan 2010)
New Revision: 40421

Modified:
grass/branches/develbranch_6/gui/wxpython/gis_set.py
Log:
enable i18N for 'Quit' and 'Help'

Modified: grass/branches/develbranch_6/gui/wxpython/gis_set.py

--- grass/branches/develbranch_6/gui/wxpython/gis_set.py 2010-01-13 23:32:27 UTC (rev 40420)
+++ grass/branches/develbranch_6/gui/wxpython/gis_set.py 2010-01-13 23:32:36 UTC (rev 40421)
@@ -121,9 +121,11 @@
self.bstart = wx.Button(parent=self.panel, id=wx.ID_ANY,
label=_("Start GRASS"))
self.bstart.SetDefault()
- self.bexit = wx.Button(parent=self.panel, id=wx.ID_EXIT)
+ self.bexit = wx.Button(parent=self.panel, id=wx.ID_EXIT,
+ label=_("Quit"))
self.bstart.SetMinSize((180, self.bexit.GetSize()[1]))
- self.bhelp = wx.Button(parent=self.panel, id=wx.ID_HELP)
+ self.bhelp = wx.Button(parent=self.panel, id=wx.ID_HELP,
+ label=_("Help"))
self.bbrowse = wx.Button(parent=self.panel, id=wx.ID_ANY,
label=_("Browse"))
self.bmapset = wx.Button(parent=self.panel, id=wx.ID_ANY,

_______________________________________________
grass-commit mailing list
grass-commit@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-commit

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Hi Martin,

as proven on Linux and Windows, they are not automatically
translated. I would be glad to not clutter the code and to revert
this. The shortcuts should work as before, see
http://trac.osgeo.org/grass/changeset/40442

In the translations, it will be in any case another shortcut since
the words are different.

Are you sure that the buttons are translated on your machine
without these changes?

Markus

On Thu, Jan 14, 2010 at 10:50 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

these buttons should be translated by the system's locales. I am not
sure if it's good practice to translate them locally. At least you
disabled standard shortcuts, e.g. &Help.

Martin

2010/1/14 <svn_grass@osgeo.org>:

Author: neteler
Date: 2010-01-13 18:32:36 -0500 (Wed, 13 Jan 2010)
New Revision: 40421

Modified:
grass/branches/develbranch_6/gui/wxpython/gis_set.py
Log:
enable i18N for 'Quit' and 'Help'

Modified: grass/branches/develbranch_6/gui/wxpython/gis_set.py

--- grass/branches/develbranch_6/gui/wxpython/gis_set.py 2010-01-13 23:32:27 UTC (rev 40420)
+++ grass/branches/develbranch_6/gui/wxpython/gis_set.py 2010-01-13 23:32:36 UTC (rev 40421)
@@ -121,9 +121,11 @@
self.bstart = wx.Button(parent=self.panel, id=wx.ID_ANY,
label=_("Start GRASS"))
self.bstart.SetDefault()
- self.bexit = wx.Button(parent=self.panel, id=wx.ID_EXIT)
+ self.bexit = wx.Button(parent=self.panel, id=wx.ID_EXIT,
+ label=_("Quit"))
self.bstart.SetMinSize((180, self.bexit.GetSize()[1]))
- self.bhelp = wx.Button(parent=self.panel, id=wx.ID_HELP)
+ self.bhelp = wx.Button(parent=self.panel, id=wx.ID_HELP,
+ label=_("Help"))
self.bbrowse = wx.Button(parent=self.panel, id=wx.ID_ANY,
label=_("Browse"))
self.bmapset = wx.Button(parent=self.panel, id=wx.ID_ANY,

_______________________________________________
grass-commit mailing list
grass-commit@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-commit

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Hi,

2010/1/15 Markus Neteler <neteler@osgeo.org>:

[...]

Are you sure that the buttons are translated on your machine
without these changes?

yes. Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

On Fri, Jan 15, 2010 at 12:13 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2010/1/15 Markus Neteler <neteler@osgeo.org>:

[...]

Are you sure that the buttons are translated on your machine
without these changes?

yes. Martin

As mentioned: not on Mandriva, not on XP.
Confirmed also on Windows7 from another colleague.. Due you have
unsubmitted changes?

Markus

Hi,

2010/1/15 Markus Neteler <neteler@osgeo.org>:

Are you sure that the buttons are translated on your machine
without these changes?

yes. Martin

As mentioned: not on Mandriva, not on XP.
Confirmed also on Windows7 from another colleague.. Due you have
unsubmitted changes?

tested on Debian GNU/Linux and MS Windows XP with Czech locale.
Buttons are localized without need to define label manually (tomorrow
I will test on MS Windows Server 2008). I would incline to find out
why it's not working on your system and to revert your changes.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Martin Landa wrote:

>>> Are you sure that the buttons are translated on your machine
>>> without these changes?
>>
>> yes. Martin
>
> As mentioned: not on Mandriva, not on XP.
> Confirmed also on Windows7 from another colleague.. Due you have
> unsubmitted changes?

tested on Debian GNU/Linux and MS Windows XP with Czech locale.
Buttons are localized without need to define label manually (tomorrow
I will test on MS Windows Server 2008). I would incline to find out
why it's not working on your system and to revert your changes.

The built-in translations should be in e.g.:

C:\Program Files\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\locale\ja\LC_MESSAGES\wxstd.mo

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

On Fri, Jan 15, 2010 at 2:27 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:

Martin Landa wrote:

>>> Are you sure that the buttons are translated on your machine
>>> without these changes?
>>
>> yes. Martin
>
> As mentioned: not on Mandriva, not on XP.
> Confirmed also on Windows7 from another colleague.. Due you have
> unsubmitted changes?

tested on Debian GNU/Linux and MS Windows XP with Czech locale.
Buttons are localized without need to define label manually (tomorrow
I will test on MS Windows Server 2008). I would incline to find out
why it's not working on your system and to revert your changes.

The built-in translations should be in e.g.:

C:\Program Files\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\locale\ja\LC_MESSAGES\wxstd.mo

Linux:
- I found /usr/lib/wxPython/share/locale/ja/LC_MESSAGES/wxstd.mo to be
absent, after
  reinstallation of the RPM package the file is now available.
  Reverting locally to the previous version, recompilation: button
translation lost.
  I am speaking about "Quit" and "Help" in the entrance page and the
module dialog buttons.

  I have used strace and it does not open any wxpython locale file
(other JA files yes).
  This are the accesses to wx:

  strace grass70 -wx 2 > log
   grep wx log
execve("/usr/local/bin/grass70", ["grass70", "-wx"], [/* 86 vars */]) = 0
execve("/usr/bin/python", ["python", "/usr/local/bin/grass70", "-wx"],
[/* 86 vars */]) = 0
open("/usr/lib64/python2.6/site-packages/wx.pth", O_RDONLY) = 4
read(4, "wx-2.8-gtk2-unicode\n", 8192) = 20
stat("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode",
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode",
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode",
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/sitecustomize",
0x7fffcc543bd0) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/sitecustomize.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/sitecustomizemodule.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/sitecustomize.py",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/sitecustomize.pyc",
O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/usercustomize",
0x7fffcc543bd0) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/usercustomize.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/usercustomizemodule.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/usercustomize.py",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/usercustomize.pyc",
O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/org",
0x7fffcc5406e0) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/org.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/orgmodule.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/org.py",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/org.pyc",
O_RDONLY) = -1 ENOENT (No such file or directory)

Relevant excerpts:
...
mprotect(0x7f640cd31000, 16384, PROT_READ) = 0
mprotect(0x604000, 4096, PROT_READ) = 0
mprotect(0x7f640cf56000, 4096, PROT_READ) = 0
munmap(0x7f640cf32000, 138951) = 0
open("/usr/share/locale/locale-archive", O_RDONLY) = -1 ENOENT (No
such file or directory)
brk(0) = 0x638000
brk(0x659000) = 0x659000
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7f640cf53000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2570
read(3, "", 4096) = 0
close(3) = 0
...
open("/usr/share/locale/ja/LC_MESSAGES/SYS_LC_MESSAGES", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=95, ...}) = 0
mmap(NULL, 95, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f640cf4d000
close(3) = 0
...

munmap(0x7f21ba110000, 4096) = 0
open("/usr/lib64/python2.6/site-packages/wx.pth", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=20, ...}) = 0
fstat(4, {st_mode=S_IFREG|0644, st_size=20, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7f21ba110000
read(4, "wx-2.8-gtk2-unicode\n", 8192) = 20
read(4, "", 4096) = 0
stat("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode",
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
read(4, "", 8192) = 0
...
stat("/usr/lib64/python2.6/site-packages/gtk-2.0",
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/lib64/python2.6/site-packages/gtk-2.0",
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/lib64/python2.6/site-packages/gtk-2.0/sitecustomize",
0x7fffcc543bd0) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/gtk-2.0/sitecustomize.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
...
stat("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/usercustomize",
0x7fffcc543bd0) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/usercustomize.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/usercustomizemodule.so",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/usercustomize.py",
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/usercustomize.pyc",
O_RDONLY) = -1 ENOENT (No such file or directory)
...
open("/usr/lib64/python2.6/encodings/euc_jp.py", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1027, ...}) = 0
open("/usr/lib64/python2.6/encodings/euc_jp.pyc", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=1786, ...}) = 0
...
open("/usr/lib64/gconv/EUC-JP.so", O_RDONLY) = 5
...

Not sure what's going on: I don't see
/usr/lib/wxPython/share/locale/ja/LC_MESSAGES/wxstd.mo being
called. Only messages from the GRASS po files appear.

Windows XP:
- since we use winGRASS, it is here:
  C:\Program Files\GRASS-6.4-SVN\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\locale\ja\LC_MESSAGES\wxstd.mo

Apparently the same problem applies - wxstd.mo not considered?

Markus

Markus Neteler wrote:

  I am speaking about "Quit" and "Help" in the entrance page and the
module dialog buttons.

  I have used strace and it does not open any wxpython locale file
(other JA files yes).

Apparently the same problem applies - wxstd.mo not considered?

It appears that wxPython's NLS needs to be explicitly initialised by
creating a wx.Locale() object[1], and this isn't happening.

  http://wiki.wxpython.org/Internationalization

  http://docs.wxwidgets.org/stable/wx_wxlocale.html

[1] You don't need to *do* anything with the object; simply creating
it makes it active:

  The call of this function has several global side effects
  which you should understand: first of all, the application
  locale is changed - note that this will affect many of
  standard C library functions such as printf() or strftime().
  Second, this wxLocale object becomes the new current global
  locale for the application and so all subsequent calls to
  wxGetTranslation() will try to translate the messages using
  the message catalogs for this locale.

I'm guessing that we may need to explicitly revert e.g. LC_NUMERIC to
avoid writing files with a comma as the decimal separator.

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