[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] Re: [Enlightenment-intl] Bug?

On 3/10/06, Aleksej Struk <astruk@gmail.com> wrote:
Hi David,

I tried to reproduce such behaviour on my sistem. Unfortunatelly I
failed. I tried to make a swedish/japanese locale. But this did not
create any effect. Still this bug is not reproducable on my sistem.

What is your locale config ? maybe I do something wrong.

Hey Aleksej,

Just straight Japanese locale here (LANG=ja_JP.EUC-JP).
But I've done some more gdb'ing and found the segv bug.

The crash was occuring when acn = 72. This offset in the array is out of bounds.
The "Run Command" action is actually about #22 in the array, so the for loop is spinning off the end of the array without matching the string.


As you can see, currently only the "Run Command" string is actually getting localized.

(line 623)
            e_widget_ilist_append(cfdata->gui.action_ilist, ic,
                                  NULL, NULL, NULL);

The labels on screen are getting set as above, using the _() i18n macro.

When we are doing the comparisons though, we are comparing with the original english string (thus matching was failing)

(line 845 of the keybindings.c)
  label = strdup(e_widget_ilist_selected_label_get(obj));
  for (acn = 0; strcasecmp(label, actions_predefined_names[acn].action_name == NULL ? "" :
                           actions_predefined_names[acn].action_name) != 0; acn++ );

Wrapping the action_names there inside the _() macro fixes the segv problem (very simple change, so I've committed it myself)
Another approach would have been to move to matching based on something other than the localized strings, like the action_cmd strings perhaps... but, this simple fix works.

Also, about the problem of the key binding strings displayed on screen not getting localized.
When using _(string) for i18n purposes, the string arg needs to have been marked such that xgettext can spot it when it creates the enlightenment.pot file.
In this case, the strings are all defined in actions_predefined_name, but as they aren't marked with _() none of them are in enlightenment.pot - "Run Command" is the only one displayed here because the exact same string is also used in e_int_menus.c (some kind of luck, good or bad, that it works :))

I think what needs to happen is any string that needs translation should be wrapped directly using _(), rather than putting the string in a variable then passing that variable to _(). Localization for all the keybinding strings should then be possible, as well.

There is also a similar problem elsewhere that I noticed a while back for the desktop names (like "Desktop 1,1" etc). I'll possibly take a look at that sometime shortly, unless someone else beats me to it :-)