Re: gtk vs qt accelerators.

"Igx, The Dreaming Drummer..." <[email protected]>
Newsgroups gmane.games.freeciv.internationalization
Message-ID <[email protected]>
Updated French translations have been committed, that cope with 
accelerators discrepancies.

But, as Sini noted, I can't see what the menus will look like when I 
translate.
I tried to run the resulting Freeciv 2.5 (using GTK 2 & 3) and don't 
really see any changes... On the other hand, I don't use Qt. So, if 
anyone wishes to give it a try, the correction can be seen in version 
r27911.

Anyhow, I also attach a small C program that tries to guess which 
strings have accelerator discrepancies. It's a quick and dirty hack, and 
gives _many_ false positives - but it helped me a lot to find the 
offending strings.
It is simply meant to be run like that : fc-acc < fr.po
Hope this helps,

Best regards,

Le 30/01/2015 22:17, Hubert Kowalewski a écrit :
> Hi all,
>
> I'm also for forbididing accelerators. It looks like a clean and
> fuss-free solution without a big loss in functionality. I tend to drop
> acceletators in the translation, but I admit I haven't removed the old
> ones. I should get down to it at some point.
>
> Hubert
>
> On 30/01/2015, Sini Ruohomaa <[email protected]> wrote:
>> I'd certainly prefer to not have to think about accelerators at all,
>> because I don't have the context for collisions when I do those.
>>
>> I even left the accelerators out of the translators at some point, but
>> gave up to the urge to tinker later and started putting them back again.
>>
>> The only argument I could see to having language-specific thought in
>> accelerators is on what kinds of stuff is a 'logical' letter for things,
>> but a lot of the time we don't really get to go with those either
>> because of collisions.
>>
>> Br,
>>
>> --Sini
>>
>> On 01/30/2015 09:39 AM, Igx, The Dreaming Drummer... wrote:
>>> Hello all,
>>>
>>> To me the simplest solution would be to forbid the added accelerators -
>>> no work for developers, none for most translators also (at least, those
>>> that did not introduce such accelerators).
>>>
>>> I'll try and suppress all remaining accelerators I left in the French
>>> translation.
>>>
>>> Best regards,
>>>
>>>
>>> Le 30/01/2015 08:22, Marko Lindqvist a écrit :
>>>> There's a S2_5 bug report that seems to be related to translations,
>>>> reported specifically against fr.po:
>>>> http://gna.org/bugs/index.php?23008
>>>>
>>>> The problem is that gtk and qt use different syntax to mark
>>>> accelerators. As long as the original texts have accelerators, there
>>>> are client specific msgstrs differing by the accelerator. Strings that
>>>> do not have accelerators in the original text, are identical between
>>>> the clients and thus currently have only one msgstr. The problem is
>>>> when the translation adds accelerator suitable for one client but not
>>>> the other to such a string.
>>>> At least in some cases accelerators are pointless in that the
>>>> activities already have another key combination assigned.
>>>> Would you translators prefer that such strings get qualified by the
>>>> gui -> same string needs to be translated separately for both clients,
>>>> or that it's forbidden to add accelerators to them?
>>>>
>>>>
>>>>    - ML
>>>>
>>>> _______________________________________________
>>>> Freeciv-i18n mailing list
>>>> Freeciv-i18n-8nu/[email protected]
>>>> https://mail.gna.org/listinfo/freeciv-i18n
>>>>
>>>>
>>>> --
>>>> ------------------------------------------------------------------------
>>>> *Igx, The Dreaming Drummer...*([email protected]
>>>> <mailto:[email protected]>)
>>>> Freeciv French translator
>>>
>>>
>>> _______________________________________________
>>> Freeciv-i18n mailing list
>>> Freeciv-i18n-8nu/[email protected]
>>> https://mail.gna.org/listinfo/freeciv-i18n
>>>
>>
>> _______________________________________________
>> Freeciv-i18n mailing list
>> Freeciv-i18n-8nu/[email protected]
>> https://mail.gna.org/listinfo/freeciv-i18n
>>
>
>
> -- 
> ------------------------------------------------------------------------
> *Igx, The Dreaming Drummer...*([email protected] 
> <mailto:[email protected]>)
> Freeciv French translator

_______________________________________________
Freeciv-i18n mailing list
Freeciv-i18n-8nu/[email protected]
https://mail.gna.org/listinfo/freeciv-i18n
fc-acc.c (text/x-csrc, 1.8 KB)
/* Compile with :  gcc -O2 -Wall -Wextra -Werror fc-acc.c -o fc-acc */
#include <stdio.h>
#include <string.h>

#define STRING_SIZE 65536
typedef char string[STRING_SIZE];
#define ACC_SIZE 256
typedef char accel[STRING_SIZE];


string msgid;
string msgstr;
string line;

#define ID   1
#define STR  2
int    latest;

void append(char* dst, const char* src) {
  const char* s;
  char*       d;
  int   started = 0;
  int   mark='"';

  dst = strchr(dst, 0);
  for (s = src, d = dst ; *s ; ++s) {
    if (!started) {
      if (*s == mark) {
	if (*(s+1) == '?') mark = ':';
	else started = 1;
      }
      continue;
    }
    if (*s == '\n') continue;
    *d++ = *s;
  }
  if ((d > dst) && (*(d-1) == '"')) --d;
  *d = 0;
}

void get_acc(char* dst, const char *src) {
  const char *c;

  for (c = src ; *c ; ++c) {
    if ((*c == '_') || (*c == '&')) *dst++ = *c;
  }
  *dst = 0;
}
  

int main(void) {
  *msgid = *msgstr = 0;
  while (fgets(line, STRING_SIZE, stdin)) {
    // Comment
    if (*line == '#') continue;
    // String continuation
    if (*line == '"') {
      append((latest == ID) ? msgid : msgstr, line);
      continue;
    }
    // Untranslated (English) string
    if (!strncmp(line, "msgid", 5)) {
      append(msgid, line);
      latest = ID;
      continue;
    }
    // Translated string
    if (!strncmp(line, "msgstr", 6)) {
      append(msgstr, line);
      latest = STR;
      continue;
    }
    // End of block
    if ((*line == 0) || (*line == '\n')) {
      accel acc_id;
      accel acc_str;
      get_acc(acc_id , msgid );
      get_acc(acc_str, msgstr);
      if (strcmp(acc_id, acc_str)) 
	printf("'%s' -> '%s'\n", msgid, msgstr);
      /*
      else 
	printf("msgid = '%s' -> acc_id='%s'    msgstr='%s' -> acc_str='%s'\n", msgid, acc_id, msgstr, acc_str);
      */
      *msgid = *msgstr = 0;
    }
  }
  return 0;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.