Merge lp:~dobey/intltool/remove-unicodify into lp:intltool

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 695
Merged at revision: not available
Proposed branch: lp:~dobey/intltool/remove-unicodify
Merge into: lp:intltool
Diff against target: None lines
To merge this branch: bzr merge lp:~dobey/intltool/remove-unicodify
Reviewer Review Type Date Requested Status
intltool Developers Pending
Review via email: mp+8620@code.launchpad.net

Commit message

Remove intltool-unicodify

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile.am'
--- Makefile.am 2009-04-26 19:15:06 +0000
+++ Makefile.am 2009-07-11 17:03:43 +0000
@@ -14,9 +14,6 @@
14 intltoolize \14 intltoolize \
15 intltool-prepare15 intltool-prepare
1616
17# Deprecated:
18EXTRA_SCRIPTS = intltool-unicodify
19
20# These are required by intltoolize17# These are required by intltoolize
21dist_pkgdata_DATA = Makefile.in.in18dist_pkgdata_DATA = Makefile.in.in
2219
@@ -29,8 +26,7 @@
2926
30EXTRA_DIST = \27EXTRA_DIST = \
31 $(distributed_scripts:=.in) \28 $(distributed_scripts:=.in) \
32 intltool-prepare.in \29 intltool-prepare.in
33 intltool-unicodify.in
3430
35edit = sed -e 's|[@]PACKAGE@|$(PACKAGE)|g' \31edit = sed -e 's|[@]PACKAGE@|$(PACKAGE)|g' \
36 -e 's|[@]VERSION@|$(VERSION)|g' \32 -e 's|[@]VERSION@|$(VERSION)|g' \
3733
=== removed file 'intltool-unicodify.in'
--- intltool-unicodify.in 2008-04-12 01:45:49 +0000
+++ intltool-unicodify.in 1970-01-01 00:00:00 +0000
@@ -1,172 +0,0 @@
1#!@INTLTOOL_PERL@ -w
2
3#
4# The i18n Unicode Encoding Utility
5#
6# Copyright (C) 2001 Free Software Foundation.
7#
8# This library is free software; you can redistribute it and/or
9# modify it under the terms of the GNU General Public License as
10# published by the Free Software Foundation; either version 2 of the
11# License, or (at your option) any later version.
12#
13# This script is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this library; if not, write to the Free Software
20# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21#
22# Authors: Kenneth Christiansen <kenneth@gnu.org>
23#
24
25## Release information
26my $PROGRAM = "intltool-unicodify";
27my $VERSION = "@VERSION@";
28my $PACKAGE = "@PACKAGE@";
29
30## Loaded modules
31use strict;
32use Getopt::Long;
33use Cwd;
34use File::Copy;
35
36## Scalars used by the option stuff
37my $LANG = $ARGV[0];
38my $HELP_ARG = 0;
39my $VERSION_ARG = 0;
40my $OVERWRITE_ARG = 0;
41my $VERBOSE = 0;
42
43## Always print as the first thing
44$| = 1;
45
46## Handle options
47GetOptions
48(
49 "help" => \$HELP_ARG,
50 "version" => \$VERSION_ARG,
51 "verbose|v" => \$VERBOSE,
52 "overwrite|o" => \$OVERWRITE_ARG,
53 ) or &print_error_invalid_option;
54
55sub split_on_argument
56{
57 if ($VERSION_ARG) {
58 &print_version;
59 }
60 elsif ($HELP_ARG) {
61 &print_help;
62 }
63
64 ## Give error if script is run without an argument
65 if (! $LANG){
66 print "${PROGRAM}: missing file arguments\n";
67 print "Try `${PROGRAM} --help' for more information.\n";
68 exit;
69 }
70}
71
72&split_on_argument;
73&main;
74
75sub print_version
76{
77 ## Print version information
78 print "${PROGRAM} (${PACKAGE}) $VERSION\n";
79 print "Written by Kenneth Christiansen\n\n";
80 print "Copyright (C) 2001-2002 Free Software Foundation, Inc.\n";
81 print "This is free software; see the source for copying conditions. There is NO\n";
82 print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
83 exit;
84}
85
86sub print_help
87{
88 ## Print usage information
89 print "Usage: ${PROGRAM} [OPTIONS] ...LANGCODE\n";
90 print "Convert PO files containing translations to UTF8.\n\n";
91 print " -o, --owerwrite overwrite original file\n";
92 print " -x, --verbose display lots of feedback\n";
93 print " --help display this help and exit\n";
94 print " --version output version information and exit\n";
95 print "\nExamples of use:\n";
96 print "${PROGRAM} da ports da.po to UTF8 and saves as da.po-1\n\n";
97 print "Report bugs to bugzilla.gnome.org, module 'intltool'.\n";
98 exit;
99}
100
101sub get_local_charset
102{
103 my ($encoding) = @_;
104 my $alias_file = $ENV{"G_CHARSET_ALIAS"} || "@INTLTOOL_LIBDIR@/charset.alias";
105
106 # seek character encoding aliases in charset.alias (glib)
107
108 if (open CHARSET_ALIAS, $alias_file)
109 {
110 while (<CHARSET_ALIAS>)
111 {
112 next if /^\#/;
113 return $1 if (/^\s*([-._a-zA-Z0-9]+)\s+$encoding\b/i)
114 }
115
116 close CHARSET_ALIAS;
117 }
118
119 # if not found, return input string
120
121 return $encoding;
122}
123
124sub main
125{
126 my $encoding_code_orig;
127
128 open IN, "$LANG.po";
129
130 while (<IN>)
131 {
132 ## example: "Content-Type: text/plain; charset=ISO-8859-1\n"
133 if (/Content-Type\:.*charset=(.*)\\n/)
134 {
135 $encoding_code_orig = $1;
136 last;
137 }
138 }
139
140 close IN;
141
142 $encoding_code_orig = get_local_charset($encoding_code_orig);
143
144 print "Converting from $encoding_code_orig\n" if $VERBOSE;
145
146 my $extern_conv="iconv -f $encoding_code_orig "
147 ."-t UTF-8 $LANG.po > $LANG.po-1";
148
149 system ($extern_conv);
150
151 my $source_orig;
152 {
153 local (*IN);
154 local $/; #slurp mode
155 open (IN, "<$LANG.po-1") || die "can't open $LANG.po-1: $!";
156 $source_orig = <IN>;
157 }
158
159 $source_orig =~ s/Content-Type\:(.*)$encoding_code_orig/Content-Type\:$1UTF-8/;
160
161 close IN;
162 open OUT, ">$LANG.po-1";
163
164 print OUT $source_orig;
165 close OUT;
166
167 if ($OVERWRITE_ARG)
168 {
169 copy ("$LANG.po-1", "$LANG.po");
170 system ("rm -rf $LANG.po-1");
171 }
172}

Subscribers

People subscribed via source and target branches

to all changes: