User menu l10n



I've got something to start with. I added the code to translate
each string before sending it to the listbox.

On the other hand I did some sed work to have strings added in
the usual po-gettext format.

Beware that I'm not good with sed and I'm worse with Makefiles.

Pending:
1) Rewrite menu file reading and replace the listbox size
calculation with locali2ed strings.

2) I don't know how standard GNU sed is.

*8-) David




_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
diff -uPr mc-4.6.0/po/addumenu.sed mc.new/po/addumenu.sed
--- mc-4.6.0/po/addumenu.sed	1970-01-01 01:00:00.000000000 +0100
+++ mc.new/po/addumenu.sed	2003-02-09 17:49:15.000000000 +0100
@@ -0,0 +1,14 @@
+#n
+# Search menu entries
+/^+/{
+# Next line is the text
+n
+# Add location comment and 'msgid ""' envelope
+s/^.*$/\
+\#: lib\/mc.menu:\
+msgid "&"/
+# Add 'msgstr ""'
+a\
+msgstr ""
+p
+}
diff -uPr mc-4.6.0/po/Makefile.in.in mc.new/po/Makefile.in.in
--- mc-4.6.0/po/Makefile.in.in	2003-02-05 19:08:56.000000000 +0100
+++ mc.new/po/Makefile.in.in	2003-02-09 17:45:08.000000000 +0100
@@ -50,6 +50,8 @@
 
 POTFILES = \
 
+MENUFILE = ../lib/mc.menu
+
 CATALOGS = @CATALOGS@
 
 # Makevars gets inserted here. (Don't remove this line!)
@@ -81,11 +83,12 @@
 # otherwise packages like GCC can not be built if only parts of the source
 # have been downloaded.
 
-$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
+$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in addumenu.sed remove-potcdate.sed
 	$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
 	  --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
 	  --files-from=$(srcdir)/POTFILES.in \
 	  --copyright-holder='$(COPYRIGHT_HOLDER)'
+	sed -f addumenu.sed < $(MENUFILE) >> $(DOMAIN).po
 	test ! -f $(DOMAIN).po || { \
 	  if test -f $(srcdir)/$(DOMAIN).pot; then \
 	    sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
diff -uPr mc-4.6.0/po/update.sh mc.new/po/update.sh
--- mc-4.6.0/po/update.sh	2002-10-14 23:41:26.000000000 +0200
+++ mc.new/po/update.sh	2003-02-09 17:08:52.000000000 +0100
@@ -44,7 +44,8 @@
   --files-from=./POTFILES.in \
 && test ! -f $PACKAGE.po \
    || ( rm -f ./$PACKAGE.pot \
-&& mv $PACKAGE.po ./$PACKAGE.pot );
+&& mv $PACKAGE.po ./$PACKAGE.pot \
+&& sed -f addumenu.sed < ../lib/mc.menu >> ./$PACKAGE.pot );
 
 else
 
@@ -55,7 +56,8 @@
   --files-from=./POTFILES.in \
 && test ! -f $PACKAGE.po \
    || ( rm -f ./PACKAGE.pot \
-&& mv $PACKAGE.po ./$PACKAGE.pot );
+&& mv $PACKAGE.po ./$PACKAGE.pot \
+&& sed -f addumenu.sed < ../lib/mc.menu >> ./$PACKAGE.pot );
 
 echo "Building the $PACKAGE.pot ..."
 echo "Now merging $1.po with $PACKAGE.pot, and creating an updated $1.po ..." 
diff -uPr mc-4.6.0/src/user.c mc.new/src/user.c
--- mc-4.6.0/src/user.c	2002-11-29 04:03:53.000000000 +0100
+++ mc.new/src/user.c	2003-02-09 14:42:57.000000000 +0100
@@ -673,6 +673,7 @@
 {
     char *p;
     char *data, **entries;
+    char *i18n_str;
     int  max_cols, menu_lines, menu_limit;
     int  col, i, accept_entry = 1;
     int  selected, old_patterns;
@@ -789,9 +790,8 @@
     /* insert all the items found */
     for (i = 0; i < menu_lines; i++) {
 	p = entries [i];
-	LISTBOX_APPEND_TEXT (listbox, (unsigned char) p[0],
-			     extract_line (p, p + MAX_ENTRY_LEN), p
-			    );
+	i18n_str = extract_line (p, p + MAX_ENTRY_LEN);
+	LISTBOX_APPEND_TEXT (listbox, (unsigned char) p[0], _(i18n_str), p);
     }
     /* Select the default entry */
     listbox_select_by_number (listbox->list, selected);



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