Am Wed, 09 Jun 2004 01:56:15 +0200 schrieb Kim Woelders:

> The menu generation is done by a perl script named "e_gen_menu".
> I think it should be quite simple to change it to use current locale
> strings in stead of the english ones.

Ok, I changed it to use the current locale and some fallbacks. Here is 
a patch:

--- e_gen_menu_old      2004-06-10 01:44:23.000000000 +0200
+++ e_gen_menu  2004-06-10 13:33:23.706437904 +0200
@@ -42,6 +42,17 @@
 $EdirUser = "$ENV{'ECONFDIR'}";
 $EdirRoot = "$ENV{'EROOT'}";
 $EdirBin  = "$ENV{'EBIN'}";
+$Lang     = "$ENV{'LANG'}";
+
+# cut @euro 
+$locale = `echo $Lang | cut -d@ -f 1`;
+chomp($locale);
+chomp($locale);
+
+# cut _
+$locale_fallback = `echo $Lang | cut -d_ -f 1`;
+chomp($locale_fallback);
+chomp($locale_fallback);
 
 $EdirUser = "$ENV{'HOME'}/.enlightenment" unless $EdirUser;
 $EdirRoot = "/usr/share/enlightenment" unless $EdirRoot;
@@ -161,11 +172,27 @@
        $Name = $Exec = $Icon = "";
        $Cats = shift;
        $Type = shift;
-
+        
        open(FI,$f) or return;
        while (<FI>) {
-               if (/^Name=(.*)$/) {
+               if (/^Name\[$locale_fallback\]=(.*)/){  
                        $Name = $1;
+                        $Name = `echo "$Name" | iconv -f UTF-8`;
+                        chomp ($Name);
+                        chomp ($Name);
+                        $APP = "1";
+                } elsif  (/^Name\[$locale_fallback\]=(.*)/ &! defined $APP){   
+                        $Name = $1;
+                        $Name = `echo "$Name" | iconv -f UTF-8`;
+                        chomp ($Name);
+                        chomp ($Name);
+                        $APP = "1";
+                } elsif (/^Name=(.*)/ &! defined $APP){
+                       $Name = $1;
+                        $Name = `echo "$Name" | iconv -f UTF-8`;
+                        chomp ($Name);
+                        chomp ($Name);
+                        $APP = "1";
                } elsif (/^Exec=(.*)$/) {
                        $Exec = $1;
                } elsif (/^Icon=(.*)$/) {
@@ -182,6 +209,7 @@
                                last;
                        }
                }
+                undef $APP;
        }
        close FI;
 

I'm not very experienced with perl, so there are perhaps better
ways to cut strings and convert to UTF-8. But this seems to work.
If you like this I'll provide also an localized one like e_gen_menu.pl.
Does E automaticly exec the e_gen_menu.$locale?

And I don't see how you get the names of the Gnome Subdirs like "Application",
"AudioVideo", "Core" and "Development". Are this also .desktop files? Or only 
the names of the directory. Which would be the best way to translate this
to the current locale?

regards
Andreas


-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite!  GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
_______________________________________________
enlightenment-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to