Don't merge translations back into GConf schemas
This commit is contained in:
parent
65fc15feb6
commit
e696ee55a9
@ -4,7 +4,7 @@
|
|||||||
Name: intltool
|
Name: intltool
|
||||||
Summary: Utility for internationalizing various kinds of data files
|
Summary: Utility for internationalizing various kinds of data files
|
||||||
Version: 0.40.6
|
Version: 0.40.6
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPLv2 with exceptions
|
License: GPLv2 with exceptions
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
Source: http://download.gnome.org/sources/intltool/0.40/%{name}-%{version}.tar.bz2
|
Source: http://download.gnome.org/sources/intltool/0.40/%{name}-%{version}.tar.bz2
|
||||||
@ -20,6 +20,8 @@ Provides: xml-i18n-tools = 0.11
|
|||||||
Requires: perl(XML::Parser)
|
Requires: perl(XML::Parser)
|
||||||
BuildRequires: perl(XML::Parser)
|
BuildRequires: perl(XML::Parser)
|
||||||
BuildRequires: gettext
|
BuildRequires: gettext
|
||||||
|
# http://bugzilla.gnome.org/show_bug.cgi?id=568845
|
||||||
|
Patch0: schemas-merge.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
This tool automatically extracts translatable strings from oaf, glade,
|
This tool automatically extracts translatable strings from oaf, glade,
|
||||||
@ -28,11 +30,12 @@ them in the po files.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch0 -p1 -b .schemas-merge
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure
|
%configure
|
||||||
|
|
||||||
make
|
make
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
@ -51,6 +54,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Apr 27 2009 Matthias Clasen <mclasen@redhat.com> - 0.40.6-2
|
||||||
|
- Don't merge translations back into GConf schemas
|
||||||
|
|
||||||
* Mon Mar 16 2009 Matthias Clasen <mclasen@redhat.com> - 0.40.6-1
|
* Mon Mar 16 2009 Matthias Clasen <mclasen@redhat.com> - 0.40.6-1
|
||||||
- Update to 0.40.6
|
- Update to 0.40.6
|
||||||
|
|
||||||
|
153
schemas-merge.patch
Normal file
153
schemas-merge.patch
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
diff -up intltool-0.40.6/intltool-merge.in.schemas intltool-0.40.6/intltool-merge.in
|
||||||
|
--- intltool-0.40.6/intltool-merge.in.schemas 2009-02-14 17:12:28.000000000 -0500
|
||||||
|
+++ intltool-0.40.6/intltool-merge.in 2009-04-27 01:41:11.099450891 -0400
|
||||||
|
@@ -38,8 +38,9 @@ my $PACKAGE = "@PACKAGE@";
|
||||||
|
my $VERSION = "@VERSION@";
|
||||||
|
|
||||||
|
## Loaded modules
|
||||||
|
-use strict;
|
||||||
|
+use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
+use Cwd;
|
||||||
|
use Text::Wrap;
|
||||||
|
use File::Basename;
|
||||||
|
use Encode;
|
||||||
|
@@ -68,6 +69,9 @@ my $PASS_THROUGH_ARG = 0;
|
||||||
|
my $UTF8_ARG = 0;
|
||||||
|
my $MULTIPLE_OUTPUT = 0;
|
||||||
|
my $cache_file;
|
||||||
|
+my $GETTEXT_PACKAGE = "";
|
||||||
|
+my %varhash = ();
|
||||||
|
+my $SRCDIR = $ENV{"srcdir"} || ".";
|
||||||
|
|
||||||
|
## Handle options
|
||||||
|
GetOptions
|
||||||
|
@@ -87,7 +91,8 @@ GetOptions
|
||||||
|
"pass-through|p" => \$PASS_THROUGH_ARG,
|
||||||
|
"utf8|u" => \$UTF8_ARG,
|
||||||
|
"multiple-output|m" => \$MULTIPLE_OUTPUT,
|
||||||
|
- "cache|c=s" => \$cache_file
|
||||||
|
+ "cache|c=s" => \$cache_file,
|
||||||
|
+ "gettext-package|g=s" => \$GETTEXT_PACKAGE
|
||||||
|
) or &error;
|
||||||
|
|
||||||
|
my $PO_DIR;
|
||||||
|
@@ -103,6 +108,8 @@ my $w = "[-A-Za-z0-9._:]";
|
||||||
|
# XML quoted string contents
|
||||||
|
my $q = "[^\\\"]*";
|
||||||
|
|
||||||
|
+my $MODULE = $GETTEXT_PACKAGE || FindPackageName() || "unknown";
|
||||||
|
+
|
||||||
|
## Check for options.
|
||||||
|
|
||||||
|
if ($VERSION_ARG)
|
||||||
|
@@ -216,6 +223,8 @@ Other options:
|
||||||
|
a single file containing all localized elements
|
||||||
|
-c, --cache=FILE specify cache file name
|
||||||
|
(usually \$top_builddir/po/.intltool-merge-cache)
|
||||||
|
+ -g, --gettext-package=NAME
|
||||||
|
+ specify gettext domain, needed for --schemas-style
|
||||||
|
-q, --quiet suppress most messages
|
||||||
|
--help display this help and exit
|
||||||
|
--version output version information and exit
|
||||||
|
@@ -241,6 +250,25 @@ sub print_message
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+sub FindPackageName
|
||||||
|
+{
|
||||||
|
+ my $name = "";
|
||||||
|
+
|
||||||
|
+ my $conf_source; {
|
||||||
|
+ local (*IN);
|
||||||
|
+ open (IN, "<Makefile") || return $name;
|
||||||
|
+ seek (IN, 0, 0);
|
||||||
|
+ local $/; # slurp mode
|
||||||
|
+ $conf_source = <IN>;
|
||||||
|
+ close IN;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ $name = $1 if $conf_source =~ /^GETTEXT_PACKAGE = \[?([^\n\]]+)/m;
|
||||||
|
+
|
||||||
|
+ return $name if $name;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
sub preparation
|
||||||
|
{
|
||||||
|
$PO_DIR = $ARGV[0];
|
||||||
|
@@ -1246,50 +1274,41 @@ sub schemas_merge_translations
|
||||||
|
my $short_string = $9 ? $9 : '';
|
||||||
|
my $long_string = $12 ? $12 : '';
|
||||||
|
|
||||||
|
- print OUTPUT "$locale_start_spaces$c_default_block";
|
||||||
|
-
|
||||||
|
$default_string =~ s/\s+/ /g;
|
||||||
|
- $default_string = entity_decode($default_string);
|
||||||
|
$short_string =~ s/\s+/ /g;
|
||||||
|
- $short_string = entity_decode($short_string);
|
||||||
|
$long_string =~ s/\s+/ /g;
|
||||||
|
- $long_string = entity_decode($long_string);
|
||||||
|
|
||||||
|
- for my $lang (sort keys %po_files_by_lang)
|
||||||
|
- {
|
||||||
|
- my $default_translation = $translations{$lang, $default_string};
|
||||||
|
- my $short_translation = $translations{$lang, $short_string};
|
||||||
|
- my $long_translation = $translations{$lang, $long_string};
|
||||||
|
-
|
||||||
|
- next if (!$default_translation && !$short_translation &&
|
||||||
|
- !$long_translation);
|
||||||
|
-
|
||||||
|
- print OUTPUT "\n$locale_start_spaces<locale name=\"$lang\">";
|
||||||
|
+ print OUTPUT "$locale_start_spaces<gettext_domain>$MODULE</gettext_domain>";
|
||||||
|
|
||||||
|
+ print OUTPUT "$locale_start_spaces<locale name=\"C\">";
|
||||||
|
print OUTPUT "$default_spaces";
|
||||||
|
-
|
||||||
|
- if ($default_translation)
|
||||||
|
- {
|
||||||
|
- $default_translation = entity_encode($default_translation);
|
||||||
|
- print OUTPUT "<default>$default_translation</default>";
|
||||||
|
+ if ($default_string) {
|
||||||
|
+ print OUTPUT "<default>$default_string</default>";
|
||||||
|
}
|
||||||
|
+ print OUTPUT "$short_spaces";
|
||||||
|
+ if ($short_string) {
|
||||||
|
+ print OUTPUT "<short>$short_string</short>";
|
||||||
|
+ }
|
||||||
|
+ print OUTPUT "$long_spaces";
|
||||||
|
+ if ($long_string) {
|
||||||
|
+ print OUTPUT "<long>$long_string</long>";
|
||||||
|
+ }
|
||||||
|
+ print OUTPUT "$locale_end_spaces</locale>";
|
||||||
|
|
||||||
|
- print OUTPUT "$short_spaces";
|
||||||
|
+ $default_string = entity_decode($default_string);
|
||||||
|
+ $short_string = entity_decode($short_string);
|
||||||
|
+ $long_string = entity_decode($long_string);
|
||||||
|
|
||||||
|
- if ($short_translation)
|
||||||
|
- {
|
||||||
|
- $short_translation = entity_encode($short_translation);
|
||||||
|
- print OUTPUT "<short>$short_translation</short>";
|
||||||
|
- }
|
||||||
|
+ for my $lang (sort keys %po_files_by_lang)
|
||||||
|
+ {
|
||||||
|
+ my $default_translation = $translations{$lang, $default_string};
|
||||||
|
|
||||||
|
- print OUTPUT "$long_spaces";
|
||||||
|
+ next if (!$default_translation || ($default_translation eq $default_string));
|
||||||
|
|
||||||
|
- if ($long_translation)
|
||||||
|
- {
|
||||||
|
- $long_translation = entity_encode($long_translation);
|
||||||
|
- print OUTPUT "<long>$long_translation</long>";
|
||||||
|
- }
|
||||||
|
+ $default_translation = entity_encode($default_translation);
|
||||||
|
|
||||||
|
+ print OUTPUT "\n$locale_start_spaces<locale name=\"$lang\">";
|
||||||
|
+ print OUTPUT "$default_spaces<default>$default_translation</default>";
|
||||||
|
print OUTPUT "$locale_end_spaces</locale>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff -up intltool-0.40.6/tests/results/test.schemas intltool-0.40.6/tests/results/test
|
Loading…
Reference in New Issue
Block a user