1 |
zzam 08/04/21 02:45:45 |
2 |
|
3 |
Modified: vdr-plugin.eclass |
4 |
Log: |
5 |
Modularized i18n handling. |
6 |
|
7 |
Revision Changes Path |
8 |
1.56 eclass/vdr-plugin.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/vdr-plugin.eclass?rev=1.56&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/vdr-plugin.eclass?rev=1.56&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/vdr-plugin.eclass?r1=1.55&r2=1.56 |
13 |
|
14 |
Index: vdr-plugin.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v |
17 |
retrieving revision 1.55 |
18 |
retrieving revision 1.56 |
19 |
diff -u -r1.55 -r1.56 |
20 |
--- vdr-plugin.eclass 13 Apr 2008 16:26:05 -0000 1.55 |
21 |
+++ vdr-plugin.eclass 21 Apr 2008 02:45:45 -0000 1.56 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2005 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.55 2008/04/13 16:26:05 zzam Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/vdr-plugin.eclass,v 1.56 2008/04/21 02:45:45 zzam Exp $ |
27 |
# |
28 |
# Author: |
29 |
# Matthias Schwarzott <zzam@g.o> |
30 |
@@ -215,42 +215,78 @@ |
31 |
fi |
32 |
} |
33 |
|
34 |
-vdr_i18n() { |
35 |
- if [[ ${USE_GETTEXT} = 0 ]]; then |
36 |
- # Remove i18n Target if using older vdr |
37 |
- sed -i Makefile \ |
38 |
- -e '/^all:/s/ i18n//' |
39 |
- elif [[ ${USE_GETTEXT} = 1 && ! -d po && ${NO_GETTEXT_HACK} != 1 ]]; then |
40 |
- einfo "Plugin is not yet changed for new translation system." |
41 |
- einfo "Auto converting translations to gettext" |
42 |
- |
43 |
- local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl" |
44 |
- if [[ ! -x ${i18n_tool} ]]; then |
45 |
- eerror "Missing ${i18n_tool}" |
46 |
- eerror "Please re-emerge vdr" |
47 |
- die "Missing ${i18n_tool}" |
48 |
- fi |
49 |
+vdr_has_gettext() { |
50 |
+ has_version ">=media-video/vdr-1.5.7" |
51 |
+} |
52 |
|
53 |
- # call i18n-to-gettext tool |
54 |
- # take all texts missing tr call into special file |
55 |
- "${i18n_tool}" 2>/dev/null \ |
56 |
- |sed -e '/^"/!d' \ |
57 |
- -e '/^""$/d' \ |
58 |
- -e 's/\(.*\)/trNOOP(\1)/' \ |
59 |
- > dummy-translations-trNOOP.c |
60 |
- |
61 |
- # if there were untranslated texts just run it again |
62 |
- # now the missing calls are listed in |
63 |
- # dummy-translations-trNOOP.c |
64 |
- if [[ -s dummy-translations-trNOOP.c ]]; then |
65 |
- "${i18n_tool}" &>/dev/null |
66 |
- fi |
67 |
+plugin_has_gettext() { |
68 |
+ [[ -d po ]] |
69 |
+} |
70 |
+ |
71 |
+vdr_i18n_convert_to_gettext() { |
72 |
+ local i18n_tool="${ROOT}/usr/share/vdr/bin/i18n-to-gettext.pl" |
73 |
+ |
74 |
+ if [[ ${NO_GETTEXT_HACK} == "1" ]]; then |
75 |
+ ewarn "Conversion to gettext disabled in ebuild" |
76 |
+ return 1 |
77 |
+ fi |
78 |
+ |
79 |
+ if [[ ! -x ${i18n_tool} ]]; then |
80 |
+ eerror "Missing ${i18n_tool}" |
81 |
+ eerror "Please re-emerge vdr" |
82 |
+ die "Missing ${i18n_tool}" |
83 |
+ fi |
84 |
+ |
85 |
+ ebegin "Auto converting translations to gettext" |
86 |
+ # call i18n-to-gettext tool |
87 |
+ # take all texts missing tr call into special file |
88 |
+ "${i18n_tool}" 2>/dev/null \ |
89 |
+ |sed -e '/^"/!d' \ |
90 |
+ -e '/^""$/d' \ |
91 |
+ -e 's/\(.*\)/trNOOP(\1)/' \ |
92 |
+ > dummy-translations-trNOOP.c |
93 |
+ |
94 |
+ # if there were untranslated texts just run it again |
95 |
+ # now the missing calls are listed in |
96 |
+ # dummy-translations-trNOOP.c |
97 |
+ if [[ -s dummy-translations-trNOOP.c ]]; then |
98 |
+ "${i18n_tool}" &>/dev/null |
99 |
+ fi |
100 |
|
101 |
- # now use the modified Makefile |
102 |
- if [[ -f Makefile.new ]]; then |
103 |
- mv Makefile.new Makefile |
104 |
+ # now use the modified Makefile |
105 |
+ if [[ -f Makefile.new ]]; then |
106 |
+ mv Makefile.new Makefile |
107 |
+ eend 0 "" |
108 |
+ else |
109 |
+ eend 1 "Conversion to gettext failed. Plugin needs fixing." |
110 |
+ return 1 |
111 |
+ fi |
112 |
+} |
113 |
+ |
114 |
+vdr_i18n_disable_gettext() { |
115 |
+ # Remove i18n Target if using older vdr |
116 |
+ sed -i Makefile \ |
117 |
+ -e '/^all:/s/ i18n//' |
118 |
+ eend 0 |
119 |
+} |
120 |
+ |
121 |
+vdr_i18n() { |
122 |
+ if vdr_has_gettext; then |
123 |
+ einfo "VDR has gettext support" |
124 |
+ if plugin_has_gettext; then |
125 |
+ einfo "Plugin has gettext support, fine" |
126 |
else |
127 |
- ewarn "Conversion to gettext failed. Plugin needs fixing." |
128 |
+ vdr_i18n_convert_to_gettext |
129 |
+ if [[ $? != 0 ]]; then |
130 |
+ ewarn "" |
131 |
+ ewarn "Plugin will have only english OSD texts" |
132 |
+ ewarn "it needs manual fixing." |
133 |
+ fi |
134 |
+ fi |
135 |
+ else |
136 |
+ einfo "VDR has no gettext support" |
137 |
+ if plugin_has_gettext; then |
138 |
+ vdr_i18n_disable_gettext |
139 |
fi |
140 |
fi |
141 |
} |
142 |
@@ -306,11 +342,6 @@ |
143 |
|
144 |
TMP_LOCALE_DIR="${WORKDIR}/tmp-locale" |
145 |
LOCDIR="/usr/share/vdr/locale" |
146 |
- if has_version ">=media-video/vdr-1.5.7"; then |
147 |
- USE_GETTEXT=1 |
148 |
- else |
149 |
- USE_GETTEXT=0 |
150 |
- fi |
151 |
|
152 |
VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
153 |
APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h) |
154 |
@@ -414,7 +445,7 @@ |
155 |
insinto "${VDR_PLUGIN_DIR}" |
156 |
doins libvdr-*.so.* |
157 |
|
158 |
- if [[ ${USE_GETTEXT} = 1 && -d ${TMP_LOCALE_DIR} ]]; then |
159 |
+ if vdr_has_gettext && [[ -d ${TMP_LOCALE_DIR} ]]; then |
160 |
einfo "Installing locales" |
161 |
cd "${TMP_LOCALE_DIR}" |
162 |
insinto "${LOCDIR}" |
163 |
|
164 |
|
165 |
|
166 |
-- |
167 |
gentoo-commits@l.g.o mailing list |