[PATCH] Re: Introducing separate strings for quick bar items
Egmont Koblinger wrote: On Wed, Jul 13, 2005 at 04:17:19AM +0200, Roland Illig wrote: This would result in a function like this: const char *translate_ui (const char *s) With a simpler name, of course :-))) I'm just wondering whether __() is fair, or should be treated as it belonged to glibc private namespace. [ISO C99] 7.1.3p1: All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use. (Similarly for underscore followed by anything.) So I've chosen gettext_ui() as the name, because I couldn't find any better one. Please tell me how you would call it. So you only chop the first *| if the string wasn't translated. I think it's better to always chop it since then translators can use Ctrl+Space in KBabel or any other hotkeys to quickly tell that the translation happens to be the same as the original text (which is quite often in en_GB, but also happens for other languages). But if the real string doesn't contain a '|', which is very likely, then omitting the prefix in the translation would also work. I've done that. Roland ? mc.patch Index: po/Makevars === RCS file: /cvsroot/mc/mc/po/Makevars,v retrieving revision 1.4 diff -u -p -r1.4 Makevars --- po/Makevars 3 Jul 2005 21:34:44 - 1.4 +++ po/Makevars 18 Jul 2005 11:10:32 - @@ -8,7 +8,7 @@ subdir = po top_builddir = .. # These options get passed to xgettext. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=gettext_ui # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding Index: po/de.po === RCS file: /cvsroot/mc/mc/po/de.po,v retrieving revision 1.76 diff -u -p -r1.76 de.po --- po/de.po19 May 2005 11:12:53 - 1.76 +++ po/de.po18 Jul 2005 11:10:38 - @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: mc 4.6.x\n" -"POT-Creation-Date: 2005-05-19 12:27+0200\n" +"POT-Creation-Date: 2005-07-18 12:43+0200\n" "PO-Revision-Date: 2005-05-19 12:57+0100\n" "Last-Translator: Roland Illig <[EMAIL PROTECTED]>\n" "Language-Team: German \n" @@ -49,6 +49,9 @@ msgstr " Die Datei »%s« ist zu groß " msgid "Macro recursion is too deep" msgstr "Makros sind zu tief verschachtelt" +msgid "&Dismiss" +msgstr "&Schließen" + msgid " Enter file name: " msgstr " Dateiname eingeben: " @@ -752,8 +755,11 @@ msgstr "Codepage eingeben / anzeigen:" msgid "&Select" msgstr "&Auswahl " +msgid "Use passive mode over pro&xy" +msgstr "FTP-Proxy im passiven Modus benutzen" + msgid "Use &passive mode" -msgstr "Passiver modus benutzen" +msgstr "Passiven Modus benutzen" msgid "&Use ~/.netrc" msgstr "~/.netrc benutzen" @@ -1887,6 +1893,10 @@ msgid "Created: %s" msgstr "Erzeugt: %s" #, c-format +msgid "Dev. type: major %lu, minor %lu" +msgstr "Gerätetyp: %lu/%lu" + +#, c-format msgid "Size: %s" msgstr "Größe: %s" @@ -2811,24 +2821,8 @@ msgstr " Pipe fehlgeschlagen " msgid " Dup failed " msgstr " Dup fehlgeschlagen" -#, c-format -msgid "" -" Error while closing the file: \n" -" %s \n" -" Data may have been written or not. " -msgstr "" -" Fehler beim Schließen der Datei: \n" -" %s \n" -" Die Daten könnten gespeichert sein oder auch nicht." - -#, c-format -msgid "" -" Cannot save file: \n" -" %s " -msgstr " Datei »%s« konnte nicht gespeichert werden " - -msgid " Cannot spawn child program " -msgstr " Kann Tochterprozeß nicht erzeugen " +msgid " Cannot spawn child process " +msgstr " Kann Kindprozess nicht ausführen " msgid "Empty output from child filter" msgstr "Der Filter gab nichts aus" @@ -2872,6 +2866,22 @@ msgstr "%s Bytes" msgid ">= %s bytes" msgstr ">= %s Bytes" +#, c-format +msgid "" +" Error while closing the file: \n" +" %s \n" +" Data may have been written or not. " +msgstr "" +" Fehler beim Schließen der Datei: \n" +" %s \n" +" Die Daten könnten gespeichert sein oder auch nicht." + +#, c-format +msgid "" +" Cannot save file: \n" +" %s " +msgstr " Datei »%s« konnte nicht gespeichert werden " + msgid "Invalid hex search expression" msgstr " Ungültiger hex-Suchausdruck " @@ -2900,41 +2910,59 @@ msgstr " Gehe zu Adresse " msgid " Enter regexp:" msgstr " Regulärer Ausdruck:" -msgid "Ascii" -msgstr "Ascii" +msgid "ButtonBar|Help" +msgstr "Hilfe" + +msgid "ButtonBar|Quit" +msgstr "Beend" + +msgid "ButtonBar|Ascii" +msgstr "ASCII" -msgid "Hex" +msgid "ButtonBar|Hex" msgstr "Hex" -msgid "Goto" -msgstr "Gehe zu" +msgid "ButtonBar|Goto" +msgstr "GeheZu" -msgid "Line" +msgid "ButtonBar|Line" msgstr "Zeile" -msgid "RxSrch" -msgstr "RxSuche" +msgid "ButtonBar|Save" +msgstr "Speich" -msgid "UnWrap" -msgstr "Anti-Umbruch" +msgid "ButtonBar|RxSrch" +msgstr "RxSuch" -msgid "Wrap" -msgstr "Umbruch" +msgid "ButtonBar|View" +msgstr "An
Re: Introducing separate strings for quick bar items
On Wed, Jul 13, 2005 at 04:17:19AM +0200, Roland Illig wrote: > This would result in a function like this: > > const char *translate_ui (const char *s) With a simpler name, of course :-))) I'm just wondering whether __() is fair, or should be treated as it belonged to glibc private namespace. Or we can just have a function that doesn't call gettext(), only strips, then maybe you could write stripwhatever(_("...")). This way I guess the source becomes more readable, and no extra command line option is needed for msg* to recognise one more function name. > { > const char *result = _(s); > if (result == s) { > result = strchr(s, '|'); > return (result != NULL) ? result + 1 : s; > } > return result; > } So you only chop the first *| if the string wasn't translated. I think it's better to always chop it since then translators can use Ctrl+Space in KBabel or any other hotkeys to quickly tell that the translation happens to be the same as the original text (which is quite often in en_GB, but also happens for other languages). But if the real string doesn't contain a '|', which is very likely, then omitting the prefix in the translation would also work. > It is not needed. N_ is just an indicator for gettext(1) for considering > which strings should be translated. Finally, each string declared using > N_ must be passed through gettext() anyway. Yep, thanks for refreshing my memories, now I remember how it works. :-)) -- Egmont ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Introducing separate strings for quick bar items
Egmont Koblinger wrote: On Tue, Jul 12, 2005 at 08:18:20PM +0200, Roland Illig wrote: What about "ButtonBar:Quit" or "ButtonBar|Quit"? This scheme would also be extensible to other special cases, like menu strings, dialog boxes, etc. Nice idea. If it gets widely used in mc, we could even introduce wrapper functions around _() that return a pointer skipping up to (including) the first separator character so that we don't have to type "strchr(s, '|') + 1" over and over again. This would result in a function like this: const char *translate_ui (const char *s) { const char *result = _(s); if (result == s) { result = strchr(s, '|'); return (result != NULL) ? result + 1 : s; } return result; } I'm not sure at this moment (it's too late in the evening) whether such things can be done around N_(). Doesn't seem to be trivial. It is not needed. N_ is just an indicator for gettext(1) for considering which strings should be translated. Finally, each string declared using N_ must be passed through gettext() anyway. Roland ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Introducing separate strings for quick bar items
On Tue, Jul 12, 2005 at 08:18:20PM +0200, Roland Illig wrote: > I suggest another naming scheme for it, as the "1" has no intuitive > interpretation for me in this case. You're right, I just wrote it because I remember I saw it somewhere (I don't know where). > What about "ButtonBar:Quit" or > "ButtonBar|Quit"? This scheme would also be extensible to other special > cases, like menu strings, dialog boxes, etc. Nice idea. If it gets widely used in mc, we could even introduce wrapper functions around _() that return a pointer skipping up to (including) the first separator character so that we don't have to type "strchr(s, '|') + 1" over and over again. I'm not sure at this moment (it's too late in the evening) whether such things can be done around N_(). Doesn't seem to be trivial. -- Egmont ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Introducing separate strings for quick bar items
Egmont Koblinger wrote: A more generic approach is to add the same prefix to all these strings (e.g. "1Quit"), make a comment for translators to leave that prefix as it is (e.g. "1Afsltn") and strip that prefix at runtime. I suggest another naming scheme for it, as the "1" has no intuitive interpretation for me in this case. What about "ButtonBar:Quit" or "ButtonBar|Quit"? This scheme would also be extensible to other special cases, like menu strings, dialog boxes, etc. Roland ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Introducing separate strings for quick bar items
Hello, On Tue, 12 Jul 2005, Egmont Koblinger wrote: > By the way: the bottom right corner of mc has "Quit" while the File menu > contains "eXit" associated to F10. Shouldn't they be called the same? Good catch! Just checked Volkov Commander and it has Quit in both places. But what should MC do in this case. If we put Quit in the menu, the hot key (X) should be changed to something else :( Bad thing is that 'Q' is already used by 'Quick cd'. ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Introducing separate strings for quick bar items
Hi Egmont, On Tue, 2005-07-12 at 13:13, Egmont Koblinger wrote: > Quite ugly approach since it relies on "Quit" actually being shorter than 6 > chars. The quick bar strings all have a maximum length of 6 chars. > And what do you do at RenMov, Delete, PullDn? I think the former and the latter are quickbar specific strings already. "Delete" is a tricky one though. Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: Introducing separate strings for quick bar items
On Mon, Jul 11, 2005 at 11:02:31PM +0200, Leonard den Ottolander wrote: > F.e. I've translated N_("Quit") to "Afsltn" in Dutch. This is short for > "Afsluiten". Now this string fits nicely in the quick bar, but it's > quite ugly as a header in the quit dialog. By defining the quit string > for the quick bar as "Quit " it can be translated separately. Quite ugly approach since it relies on "Quit" actually being shorter than 6 chars. And what do you do at RenMov, Delete, PullDn? A more generic approach is to add the same prefix to all these strings (e.g. "1Quit"), make a comment for translators to leave that prefix as it is (e.g. "1Afsltn") and strip that prefix at runtime. By the way: the bottom right corner of mc has "Quit" while the File menu contains "eXit" associated to F10. Shouldn't they be called the same? -- Egmont ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel