Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.2:Staging:A
xdg-menu
xdg-menu-translation-bnc463972.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xdg-menu-translation-bnc463972.patch of Package xdg-menu
--- xdg_menu +++ xdg_menu @@ -10,6 +10,7 @@ use Getopt::Long; use Encode; use I18N::Langinfo qw(langinfo CODESET); +use Locale::gettext; use POSIX qw(locale_h); my $Version = "0.2"; @@ -23,6 +24,7 @@ my $language = ''; my $charset = 'iso-8859-1'; my $root_cmd = 'xdg_menu_su'; +my $default_textdomain; my $die_on_error = 0; my $verbose = 0; @@ -1228,7 +1230,23 @@ return $desktop->{$loc_entry} if defined $desktop->{$loc_entry} && $desktop->{$loc_entry} !~ /^\s*$/; } - return $desktop->{$entry}; + my $textdomain = $default_textdomain; + + if ($desktop->{'X-SUSE-Gettext-Domain'}) { + $textdomain = Locale::gettext->domain_raw($desktop->{'X-SUSE-Gettext-Domain'}); + $textdomain->codeset('UTF-8'); + } + + my $key = $desktop->{$entry}; + my $file = $desktop->{'id'}; + my $key_context = "$entry($file): $key"; + + my $translated = $textdomain->get($key_context); + if ($translated eq $key_context) { + $translated = $textdomain->get($key); + } + + return $translated; } sub preprocess_menu ($) @@ -2094,6 +2113,16 @@ "help" => \$help ); +if (!setlocale(LC_MESSAGES, $language)) + { + print STDERR "WARNING: invalid language '$language'\n"; + $language = setlocale(LC_MESSAGES); + print STDERR "Falling back to '$language'\n"; + } + +$default_textdomain = Locale::gettext->domain_raw("desktop_translations"); +$default_textdomain->codeset('UTF-8'); + @language_keys = prepare_language_keys($language); $desktop_name = $format unless defined $desktop_name;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor