[PATCH] Re: Introducing separate strings for quick bar items
- From: Roland Illig <roland illig gmx de>
- To: Egmont Koblinger <egmont uhulinux hu>
- Cc: MC Devel <mc-devel gnome org>
- Subject: [PATCH] Re: Introducing separate strings for quick bar items
- Date: Mon, 18 Jul 2005 13:15:54 +0200
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 -0000 1.4
+++ po/Makevars 18 Jul 2005 11:10:32 -0000
@@ -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.po 19 May 2005 11:12:53 -0000 1.76
+++ po/de.po 18 Jul 2005 11:10:38 -0000
@@ -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 <roland illig gmx de>\n"
"Language-Team: German <gnome-de gnome org>\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 "Ansich"
-msgid "HxSrch"
-msgstr "HxSuche"
+msgid "ButtonBar|Edit"
+msgstr "Bearbe"
+
+msgid "ButtonBar|UnWrap"
+msgstr "KeinZU"
+
+msgid "ButtonBar|Wrap"
+msgstr "ZeilUm"
+
+msgid "ButtonBar|HxSrch"
+msgstr "HxSuch"
+
+msgid "ButtonBar|Search"
+msgstr "Suchen"
-msgid "Raw"
+msgid "ButtonBar|Raw"
msgstr "Roh"
-msgid "Parse"
-msgstr "Parsen"
+msgid "ButtonBar|Parse"
+msgstr "Parse"
-msgid "Unform"
-msgstr "Anti-Format"
+msgid "ButtonBar|Unform"
+msgstr "Unform"
-msgid "Format"
-msgstr "Formatieren"
+msgid "ButtonBar|Format"
+msgstr "Format"
msgid " History "
msgstr " Chronik "
Index: src/util.c
===================================================================
RCS file: /cvsroot/mc/mc/src/util.c,v
retrieving revision 1.131
diff -u -p -r1.131 util.c
--- src/util.c 18 Jul 2005 09:31:37 -0000 1.131
+++ src/util.c 18 Jul 2005 11:11:08 -0000
@@ -1464,3 +1464,13 @@ ascii_alpha_to_cntrl (int ch)
}
return ch;
}
+
+extern const char *
+gettext_ui (const char *s)
+{
+ const char *result, *sep;
+
+ result = _(s);
+ sep = strchr(result, '|');
+ return (sep != NULL) ? sep + 1 : result;
+}
Index: src/view.c
===================================================================
RCS file: /cvsroot/mc/mc/src/view.c,v
retrieving revision 1.309
diff -u -p -r1.309 view.c
--- src/view.c 18 Jul 2005 08:47:45 -0000 1.309
+++ src/view.c 18 Jul 2005 11:11:09 -0000
@@ -2799,42 +2799,55 @@ view_labels (WView *view)
{
Dlg_head *h = view->widget.parent;
- buttonbar_set_label (h, 1, _("Help"), view_help_cmd);
+ buttonbar_set_label (h, 1, gettext_ui("ButtonBar|Help"), view_help_cmd);
- my_define (h, 10, _("Quit"), view_quit_cmd, view);
- my_define (h, 4, view->hex_mode ? _("Ascii") : _("Hex"),
- toggle_hex_mode, view);
- my_define (h, 5, view->hex_mode ? _("Goto") : _("Line"),
- view->hex_mode ? goto_addr : goto_line, view);
- my_define (h, 6, view->hex_mode ? _("Save") : _("RxSrch"),
- regexp_search_cmd, view);
+ my_define (h, 10, gettext_ui("ButtonBar|Quit"), view_quit_cmd, view);
+ my_define (h, 4, view->hex_mode
+ ? gettext_ui("ButtonBar|Ascii")
+ : gettext_ui("ButtonBar|Hex"),
+ toggle_hex_mode, view);
+ my_define (h, 5, view->hex_mode
+ ? gettext_ui("ButtonBar|Goto")
+ : gettext_ui("ButtonBar|Line"),
+ view->hex_mode ? goto_addr : goto_line, view);
+ my_define (h, 6, view->hex_mode
+ ? gettext_ui("ButtonBar|Save")
+ : gettext_ui("ButtonBar|RxSrch"),
+ regexp_search_cmd, view);
if (view->hex_mode) {
if (view->hexedit_mode) {
- my_define (h, 2, _("View"), toggle_hexedit_mode, view);
+ my_define (h, 2, gettext_ui("ButtonBar|View"),
+ toggle_hexedit_mode, view);
} else if (view->datasource == DS_FILE) {
- my_define (h, 2, _("Edit"), toggle_hexedit_mode, view);
+ my_define (h, 2, gettext_ui("ButtonBar|Edit"),
+ toggle_hexedit_mode, view);
} else {
my_define (h, 2, "", NULL, view);
}
- } else
- my_define (h, 2, view->text_wrap_mode ? _("UnWrap") : _("Wrap"),
- toggle_wrap_mode, view);
-
- my_define (h, 7, view->hex_mode ? _("HxSrch") : _("Search"),
- normal_search_cmd, view);
-
- my_define (h, 8, view->magic_mode ? _("Raw") : _("Parse"),
- change_viewer, view);
+ } else {
+ my_define (h, 2, view->text_wrap_mode
+ ? gettext_ui("ButtonBar|UnWrap")
+ : gettext_ui("ButtonBar|Wrap"),
+ toggle_wrap_mode, view);
+
+ my_define (h, 7, view->hex_mode
+ ? gettext_ui("ButtonBar|HxSrch")
+ : gettext_ui("ButtonBar|Search"),
+ normal_search_cmd, view);
+ my_define (h, 8, view->magic_mode
+ ? gettext_ui("ButtonBar|Raw")
+ : gettext_ui("ButtonBar|Parse"),
+ change_viewer, view);
/* don't override the key to access the main menu */
if (!view_is_in_panel (view)) {
- my_define (h, 9,
- view->text_nroff_mode ? _("Unform") : _("Format"),
- change_nroff, view);
- my_define (h, 3, _("Quit"), view_quit_cmd, view);
+ my_define (h, 9, view->text_nroff_mode
+ ? gettext_ui("ButtonBar|Unform")
+ : gettext_ui("ButtonBar|Format"),
+ change_nroff, view);
+ my_define (h, 3, gettext_ui("ButtonBar|Quit"), view_quit_cmd, view);
}
-
buttonbar_redraw (h);
}
Index: src/util.h
===================================================================
RCS file: /cvsroot/mc/mc/src/util.h,v
retrieving revision 1.73
diff -u -p -r1.73 util.h
--- src/util.h 18 Jul 2005 09:31:37 -0000 1.73
+++ src/util.h 18 Jul 2005 11:11:08 -0000
@@ -259,4 +259,8 @@ void save_file_position (const char *fil
* else returns the argument. */
extern int ascii_alpha_to_cntrl (int ch);
+/* translates the string and returns the part after the first occurence
+ * of the ``|'' character. */
+extern const char *gettext_ui (const char *);
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]