On Monday 10 March 2008, Christian Perrier wrote:
> Interesting idea. I vote for the latter. Such file shouldn't be that hard
> to maintain. Only drawback: there's still the possibility that the backup
> language itself is incomplete and then the installer falls back to
> English...:-)
Attached a patch that implements this.
There are separate template files for each language that has multiple fall
backs defined. These only need to be translated for that specific language
and will thus not be included in the normal l10n infrastructure.
The templates are appended to the templates file at build time by a new
script: mktemplates.warnings. The script warns about languages for which
these strings are missing.
I've also split the 5 new templates from the previous patch into separate
strings. There are now only two templates which are "assembled" at run
time. In part this was needed for the language-specific templates anyway,
but it also prevents duplication of strings (and their translations) in the
templates file, and thus reduces initrd size and memory usage.
I'd like to get at least two languages translated for additional testing
before committing, but first is a review of the various English strings.
JFYI the changes in size (without translations for new strings) for
localechooser between 1.46 and 2.00:
./DEBIAN/templates [-343171-] {+338411+} <--- smaller, but will grow some
./etc/shortlists 66
./etc/SUPPORTED-short 3750
./usr/bin/languagemap [-905-] {+862+}
./usr/bin/localechooser [-15437-] {+16710
./usr/bin/translation-check 1279+} <--- new
./usr/lib/finish-install.d/05localechooser 2390
./usr/lib/post-base-installer.d/05localechooser [-3020-] {+3008+}
./usr/share/localechooser/languagelist [-2836-] {+2264 <--- smaller
./usr/share/localechooser/languagelist.data.gz 1439+} <--- new
Cheers,
FJP
commit 5ac1f5d6ccb159b7cbc7ff2f764dc9e5d94337aa
Author: Frans Pop <fjp@debian.org>
Date: Sat Mar 8 18:27:22 2008 +0100
Display warning if translation is not complete
Based on a translation status file included in the initrd at build time.
The severity of the warning depends on how much is untranslated based on
the D-I sublevels and taking into account what architecture is being
installed.
Note that incomplete translations in components not in D-I SVN are not
taken into account.
diff --git a/packages/localechooser/Makefile b/packages/localechooser/Makefile
index 452bbac..e8896d2 100644
--- a/packages/localechooser/Makefile
+++ b/packages/localechooser/Makefile
@@ -14,8 +14,9 @@ debian/iso-codes:
debian/iso-3166.tab:
./iso3166tab.py /usr/share/xml/iso-codes/iso_3166.xml >debian/iso-3166.tab
-debian/templates: debian/templates.base debian/short-tmp/shortlists
+debian/templates: $(LIST) debian/templates.base debian/short-tmp/shortlists
./mktemplates.shortlist
+ ./mktemplates.warnings $(LIST) debian/templates
debian/SUPPORTED-short:
./get-SUPPORTED
diff --git a/packages/localechooser/debian/localechooser.templates-in b/packages/localechooser/debian/localechooser.templates-in
index bc2eafb..aabc329 100644
--- a/packages/localechooser/debian/localechooser.templates-in
+++ b/packages/localechooser/debian/localechooser.templates-in
@@ -7,8 +7,9 @@ Type: text
# :sl1:
_Description: Choose language
-Template: localechooser/no-translations-yet
+Template: localechooser/translation/none-yet
Type: note
+# :sl1:
Description: Translations temporarily not available
Because of the low available space on the installation media, translations
will not be available immediately.
@@ -16,8 +17,9 @@ Description: Translations temporarily not available
The installation will continue in English until the installer
loads packages that include translations from a CD or the network.
-Template: localechooser/no-language-select
+Template: localechooser/translation/no-select
Type: note
+# :sl1:
Description: Language selection no longer possible
At this point it is no longer possible to change the language for the
installation, but you can still change the country or locale.
@@ -25,6 +27,64 @@ Description: Language selection no longer possible
To select a different language you will need to abort this installation
and reboot the installer.
+Template: localechooser/translation/warn-severe
+Type: boolean
+Default: false
+# :sl1:
+#flag:translate!:3,4
+Description: Continue the installation in the selected language?
+ The translation of the installer is incomplete for the selected language.
+ .
+ ${TXT-WARN}
+ .
+ ${TXT-ABORT}
+
+Template: localechooser/translation/warn-light
+Type: boolean
+Default: true
+# :sl1:
+#flag:translate!:3
+Description: Continue the installation in the selected language?
+ The translation of the installer is not fully complete for the selected
+ language.
+ .
+ ${TXT-WARN}
+
+Template: localechooser/translation/text/warn_incomplete
+Type: text
+# :sl1:
+Description: This means that there is a significant chance that some dialogs will be displayed in Englishinstead .
+
+Template: localechooser/translation/text/warn_normal-ok
+Type: text
+# :sl1:
+Description: If you do anything other than a purely default installation, there is a real chance that some dialogs will be displayed in English instead.
+
+Template: localechooser/translation/text/warn_partial
+Type: text
+# :sl1:
+Description: If you continue the installation in the selected language, most dialogs should be displayed correctly but - especially if you use the more advanced options of the installer - some may be displayed in English instead.
+
+Template: localechooser/translation/text/warn_mostly-ok
+Type: text
+# :sl1:
+Description: If you continue the installation in the selected language, dialogs should normally be displayed correctly but - especially if you use the more advanced options of the installer - there is a slight chance some may be displayed in English instead.
+
+Template: localechooser/translation/text/warn_exceptions
+Type: text
+# :sl1:
+Description: The chance that you will actually encounter a dialog that is not translated into the selected language is extremely small, but it cannot be ruled out completely.
+
+Template: localechooser/translation/text/abort
+Type: text
+# :sl1:
+Description: Unless you have a good understanding of the alternative language, it is recommended to either select a different language or abort the installation.
+
+Template: localechooser/translation/text/maybe-abort
+Type: text
+# :sl1:
+Description: If you chose not to continue, you will be given the option of selecting a different language, or you can abort the installation.
+
Template: languagechooser/languagelist
Type: select
Choices-C: ${CODES}
diff --git a/packages/localechooser/debian/localechooser.templates-nb_NO b/packages/localechooser/debian/localechooser.templates-nb_NO
new file mode 100644
index 0000000..a909b94
--- /dev/null
+++ b/packages/localechooser/debian/localechooser.templates-nb_NO
@@ -0,0 +1,36 @@
+# The commented text in the templates below should be translated into
+# *Norwegian Bokmaal* in the Description field (on a single line!).
+# After that has been done, the templates can be uncommented (the
+# example text should remain commented!).
+
+#Template: localechooser/translation/text/warn_incomplete/nb_NO
+#Type: text
+# This means that there is a significant chance that some dialogs will be
+# displayed in a different language. Fallback languages are (in order):
+# Nynorsk, Danish, Swedish, and English.
+#Description:
+
+#Template: localechooser/translation/text/warn_normal-ok/nb_NO
+#Type: text
+# If you do anything other than a purely default installation, there is a
+# real chance that some dialogs will be displayed in a different language.
+# Fallback languages are (in order): Nynorsk, Danish, Swedish, and English.
+#Description:
+
+#Template: localechooser/translation/text/warn_partial/nb_NO
+#Type: text
+# If you continue the installation in the selected language, most dialogs
+# should be displayed correctly but - especially if you use the more
+# advanced options of the installer - some may be displayed in a different
+# language. Fallback languages are (in order): Nynorsk, Danish, Swedish,
+# and English.
+#Description:
+
+#Template: localechooser/translation/text/warn_mostly-ok/nb_NO
+#Type: text
+# If you continue the installation in the selected language, dialogs
+# should normally be displayed correctly but - especially if you use the
+# more advanced options of the installer - there is a slight chance some
+# may be displayed in a different language. Fallback languages are (in
+# order): Nynorsk, Danish, Swedish, and English.
+#Description:
diff --git a/packages/localechooser/debian/localechooser.templates-nn_NO b/packages/localechooser/debian/localechooser.templates-nn_NO
new file mode 100644
index 0000000..f8ec6f5
--- /dev/null
+++ b/packages/localechooser/debian/localechooser.templates-nn_NO
@@ -0,0 +1,36 @@
+# The commented text in the templates below should be translated into
+# *Norwegian Nynorsk* in the Description field (on a single line!).
+# After that has been done, the templates can be uncommented (the
+# example text should remain commented!).
+
+#Template: localechooser/translation/text/warn_incomplete/nn_NO
+#Type: text
+# This means that there is a significant chance that some dialogs will be
+# displayed in a different language. Fallback languages are (in order):
+# Bokmaal, Danish, Swedish, and English.
+#Description:
+
+#Template: localechooser/translation/text/warn_normal-ok/nn_NO
+#Type: text
+# If you do anything other than a purely default installation, there is a
+# real chance that some dialogs will be displayed in a different language.
+# Fallback languages are (in order): Bokmaal, Danish, Swedish, and English.
+#Description:
+
+#Template: localechooser/translation/text/warn_partial/nn_NO
+#Type: text
+# If you continue the installation in the selected language, most dialogs
+# should be displayed correctly but - especially if you use the more
+# advanced options of the installer - some may be displayed in a different
+# language. Fallback languages are (in order): Bokmaal, Danish, Swedish,
+# and English.
+#Description:
+
+#Template: localechooser/translation/text/warn_mostly-ok/nn_NO
+#Type: text
+# If you continue the installation in the selected language, dialogs
+# should normally be displayed correctly but - especially if you use the
+# more advanced options of the installer - there is a slight chance some
+# may be displayed in a different language. Fallback languages are (in
+# order): Bokmaal, Danish, Swedish, and English.
+#Description:
diff --git a/packages/localechooser/debian/localechooser.templates-pt b/packages/localechooser/debian/localechooser.templates-pt
new file mode 100644
index 0000000..67444cd
--- /dev/null
+++ b/packages/localechooser/debian/localechooser.templates-pt
@@ -0,0 +1,35 @@
+# The commented text in the templates below should be translated into
+# *Portuguese* in the Description field (on a single line!).
+# After that has been done, the templates can be uncommented (the
+# example text should remain commented!).
+
+#Template: localechooser/translation/text/warn_incomplete/pt
+#Type: text
+# This means that there is a significant chance that some dialogs will be
+# displayed in Brazillian Portuguese or, if that is also not available, in
+# English.
+#Description:
+
+#Template: localechooser/translation/text/warn_normal-ok/pt
+#Type: text
+# If you do anything other than a purely default installation, there is a
+# real chance that some dialogs will be displayed in Brazillian Portuguese
+# or, if that is also not available, in English.
+#Description:
+
+#Template: localechooser/translation/text/warn_partial/pt
+#Type: text
+# If you continue the installation in the selected language, most dialogs
+# should be displayed correctly but - especially if you use the more
+# advanced options of the installer - some may be displayed in Brazillian
+# Portuguese or, if that is also not available, in English.
+#Description:
+
+#Template: localechooser/translation/text/warn_mostly-ok/pt
+#Type: text
+# If you continue the installation in the selected language, dialogs should
+# normally be displayed correctly but - especially if you use the more
+# advanced options of the installer - there is a slight chance some may be
+# displayed in Brazillian Portuguese or, if that is also not available, in
+# English.
+#Description:
diff --git a/packages/localechooser/debian/localechooser.templates-pt_BR b/packages/localechooser/debian/localechooser.templates-pt_BR
new file mode 100644
index 0000000..a205709
--- /dev/null
+++ b/packages/localechooser/debian/localechooser.templates-pt_BR
@@ -0,0 +1,34 @@
+# The commented text in the templates below should be translated into
+# *Brazillian Portuguese* in the Description field (on a single line!).
+# After that has been done, the templates can be uncommented (the
+# example text should remain commented!).
+
+#Template: localechooser/translation/text/warn_incomplete/pt_BR
+#Type: text
+# This means that there is a significant chance that some dialogs will be
+# displayed in Portuguese or, if that is also not available, in English.
+#Description:
+
+#Template: localechooser/translation/text/warn_normal-ok/pt_BR
+#Type: text
+# If you do anything other than a purely default installation, there is a
+# real chance that some dialogs will be displayed in Portuguese or, if that
+# is also not available, in English.
+#Description:
+
+#Template: localechooser/translation/text/warn_partial/pt_BR
+#Type: text
+# If you continue the installation in the selected language, most dialogs
+# should be displayed correctly but - especially if you use the more
+# advanced options of the installer - some may be displayed in Portuguese
+# or, if that is also not available, in English.
+#Description:
+
+#Template: localechooser/translation/text/warn_mostly-ok/pt_BR
+#Type: text
+# If you continue the installation in the selected language, dialogs
+# should normally be displayed correctly but - especially if you use the
+# more advanced options of the installer - there is a slight chance some
+# may be displayed in Portuguese or, if that is also not available, in
+# English.
+#Description:
diff --git a/packages/localechooser/debian/localechooser.templates-se_NO b/packages/localechooser/debian/localechooser.templates-se_NO
new file mode 100644
index 0000000..cd86366
--- /dev/null
+++ b/packages/localechooser/debian/localechooser.templates-se_NO
@@ -0,0 +1,37 @@
+# The commented text in the templates below should be translated into
+# *Northern Sami* in the Description field (on a single line!).
+# After that has been done, the templates can be uncommented (the
+# example text should remain commented!).
+
+#Template: localechooser/translation/text/warn_incomplete/se_NO
+#Type: text
+# This means that there is a significant chance that some dialogs will be
+# displayed in a different language. Fallback languages are (in order):
+# Bokmaal, Nynorsk, Danish, Swedish, and English.
+#Description:
+
+#Template: localechooser/translation/text/warn_normal-ok/se_NO
+#Type: text
+# If you do anything other than a purely default installation, there is a
+# real chance that some dialogs will be displayed in a different language.
+# Fallback languages are (in order): Bokmaal, Nynorsk, Danish, Swedish, and
+# English.
+#Description:
+
+#Template: localechooser/translation/text/warn_partial/se_NO
+#Type: text
+# If you continue the installation in the selected language, most dialogs
+# should be displayed correctly but - especially if you use the more
+# advanced options of the installer - some may be displayed in a different
+# language. Fallback languages are (in order): Bokmaal, Nynorsk, Danish,
+# Swedish, and English.
+#Description:
+
+#Template: localechooser/translation/text/warn_mostly-ok/se_NO
+#Type: text
+# If you continue the installation in the selected language, dialogs
+# should normally be displayed correctly but - especially if you use the
+# more advanced options of the installer - there is a slight chance some
+# may be displayed in a different language. Fallback languages are (in
+# order): Bokmaal, Nynorsk, Danish, Swedish, and English.
+#Description:
diff --git a/packages/localechooser/debian/localechooser.templates-wo b/packages/localechooser/debian/localechooser.templates-wo
new file mode 100644
index 0000000..cd075d3
--- /dev/null
+++ b/packages/localechooser/debian/localechooser.templates-wo
@@ -0,0 +1,33 @@
+# The commented text in the templates below should be translated into
+# *Wolof* in the Description field (on a single line!).
+# After that has been done, the templates can be uncommented (the
+# example text should remain commented!).
+# Note: only French is mentioned as the chance that that is not fully
+# translated is close to zero.
+
+#Template: localechooser/translation/text/warn_incomplete/wo
+#Type: text
+# This means that there is a significant chance that some dialogs will be
+# displayed in French.
+#Description:
+
+#Template: localechooser/translation/text/warn_normal-ok/wo
+#Type: text
+# If you do anything other than a purely default installation, there is a
+# real chance that some dialogs will be displayed in French.
+#Description:
+
+#Template: localechooser/translation/text/warn_partial/wo
+#Type: text
+# If you continue the installation in the selected language, most dialogs
+# should be displayed correctly but - especially if you use the more
+# advanced options of the installer - some may be displayed in French.
+#Description:
+
+#Template: localechooser/translation/text/warn_mostly-ok/wo
+#Type: text
+# If you continue the installation in the selected language, dialogs
+# should normally be displayed correctly but - especially if you use the
+# more advanced options of the installer - there is a slight chance some
+# may be displayed in French.
+#Description:
diff --git a/packages/localechooser/debian/localechooser.templates-zh_CN b/packages/localechooser/debian/localechooser.templates-zh_CN
new file mode 100644
index 0000000..b0c0b68
--- /dev/null
+++ b/packages/localechooser/debian/localechooser.templates-zh_CN
@@ -0,0 +1,35 @@
+# The commented text in the templates below should be translated into
+# *Simplified Chinese* in the Description field (on a single line!).
+# After that has been done, the templates can be uncommented (the
+# example text should remain commented!).
+
+#Template: localechooser/translation/text/warn_incomplete/zh_CN
+#Type: text
+# This means that there is a significant chance that some dialogs will be
+# displayed in Traditional Chinese or, if that is also not available, in
+# English.
+#Description:
+
+#Template: localechooser/translation/text/warn_normal-ok/zh_CN
+#Type: text
+# If you do anything other than a purely default installation, there is a
+# real chance that some dialogs will be displayed in Traditional Chinese or,
+# if that is also not available, in English.
+#Description:
+
+#Template: localechooser/translation/text/warn_partial/zh_CN
+#Type: text
+# If you continue the installation in the selected language, most dialogs
+# should be displayed correctly but - especially if you use the more
+# advanced options of the installer - some may be displayed in Traditional
+# Chinese or, if that is also not available, in English.
+#Description:
+
+#Template: localechooser/translation/text/warn_mostly-ok/zh_CN
+#Type: text
+# If you continue the installation in the selected language, dialogs
+# should normally be displayed correctly but - especially if you use the
+# more advanced options of the installer - there is a slight chance some
+# may be displayed in Traditional Chinese or, if that is also not available,
+# in English.
+#Description:
diff --git a/packages/localechooser/debian/localechooser.templates-zh_TW b/packages/localechooser/debian/localechooser.templates-zh_TW
new file mode 100644
index 0000000..b53bc51
--- /dev/null
+++ b/packages/localechooser/debian/localechooser.templates-zh_TW
@@ -0,0 +1,35 @@
+# The commented text in the templates below should be translated into
+# *Traditional Chinese* in the Description field (on a single line!).
+# After that has been done, the templates can be uncommented (the
+# example text should remain commented!).
+
+#Template: localechooser/translation/text/warn_incomplete/zh_TW
+#Type: text
+# This means that there is a significant chance that some dialogs will be
+# displayed in Simplified Chinese or, if that is also not available, in
+# English.
+#Description:
+
+#Template: localechooser/translation/text/warn_normal-ok/zh_TW
+#Type: text
+# If you do anything other than a purely default installation, there is a
+# real chance that some dialogs will be displayed in Simplified Chinese or,
+# if that is also not available, in English.
+#Description:
+
+#Template: localechooser/translation/text/warn_partial/zh_TW
+#Type: text
+# If you continue the installation in the selected language, most dialogs
+# should be displayed correctly but - especially if you use the more
+# advanced options of the installer - some may be displayed in Simplified
+# Chinese or, if that is also not available, in English.
+#Description:
+
+#Template: localechooser/translation/text/warn_mostly-ok/zh_TW
+#Type: text
+# If you continue the installation in the selected language, dialogs
+# should normally be displayed correctly but - especially if you use the
+# more advanced options of the installer - there is a slight chance some
+# may be displayed in Simplified Chinese or, if that is also not available,
+# in English.
+#Description:
diff --git a/packages/localechooser/debian/rules b/packages/localechooser/debian/rules
index ab29342..0f6c787 100755
--- a/packages/localechooser/debian/rules
+++ b/packages/localechooser/debian/rules
@@ -21,7 +21,7 @@ install: build
dh_testroot
dh_clean -k
dh_installdirs
- dh_install localechooser languagemap usr/bin
+ dh_install localechooser languagemap translation-check usr/bin
mkdir -p debian/$(PACKAGE)/DEBIAN
install -m0755 post-base-installer debian/$(PACKAGE)/usr/lib/post-base-installer.d/05localechooser
install -m0755 finish-install debian/$(PACKAGE)/usr/lib/finish-install.d/05localechooser
diff --git a/packages/localechooser/localechooser b/packages/localechooser/localechooser
index 7103ff4..2cd6bcc 100755
--- a/packages/localechooser/localechooser
+++ b/packages/localechooser/localechooser
@@ -154,6 +154,41 @@ set_debconf_language() {
fi
}
+# Determine which template to display to warn for incomplete translations
+# and fill in the variable contents
+warning_template() {
+ local status template tbase twarn tabort
+ status=$1
+ tbase=localechooser/translation
+
+ case $status in
+ 0) twarn=incomplete; tabort=abort ;;
+ 1) twarn=normal-ok; tabort=abort ;;
+ 2) twarn=partial; tabort=maybe-abort ;;
+ 3) twarn=mostly-ok ;;
+ 4) twarn=exceptions ;;
+ esac
+ if [ $status -le 3 ]; then
+ template=$tbase/warn-severe
+ db_metaget $tbase/text/$tabort description
+ db_subst $template TXT-ABORT "$RET"
+ else
+ template=$tbase/warn-light
+ fi
+
+ # Translation has fallback languages may have special templates
+ if [ "$twarn" != exceptions ] && \
+ expr $LANGUAGELIST : ".*:" >/dev/null && \
+ db_metaget $tbase/text/warn_$twarn/$LANGUAGE description; then
+ :
+ else
+ db_metaget $tbase/text/warn_$twarn description
+ fi
+ db_subst $template TXT-WARN "$RET"
+
+ echo $template
+}
+
refine_locale() {
local old_locale=$1
@@ -280,7 +315,7 @@ while :; do
db_get debconf/translations-dropped && [ "$RET" = true ]; then
if db_fget $langname_template seen && [ "$RET" != true ]; then
sel_language=""
- db_input high localechooser/no-language-select || true
+ db_input high localechooser/translation/no-select || true
fi
else
# Set initial language for correct display of list
@@ -316,15 +351,39 @@ while :; do
db_set "$consoledisplay" "$CONSOLE"
log "Set $consoledisplay = '$CONSOLE'"
+ db_set "debconf/language" "$LANGUAGELIST"
+ log "Set debconf/language = '$LANGUAGELIST'"
+
[ -f /etc/lsb-release ] && . /etc/lsb-release
if [ "$sel_language" ] && [ $LANGUAGE != en ] && \
[ "$X_INSTALLATION_MEDIUM" = "floppy" ]; then
- db_input high localechooser/no-translations-yet || true
- db_go || true
+ db_input high localechooser/translation/none-yet || true
fi
+ ;;
+ 12) # Warn if translation is incomplete
set_debconf_language "$LANGUAGELIST"
+ # Display warning for incomplete translations; skip it for
+ # automated installs to prevent a loop if the default is false
+ twarning=""
+ if [ "$sel_language" ] && \
+ db_get debconf/priority && [ "$RET" != critical ] && \
+ tstatus=$(translation-check "$LANGUAGE"); then
+ twarning=$(warning_template $tstatus)
+ db_input high $twarning || [ $? -eq 30 ]
+ fi
+ ;;
+
+ 13) # Continue or choose alternative language
+ if [ "$twarning" ]; then
+ if db_get $twarning && [ "$RET" = false ]; then
+ db_reset $twarning
+ STATE=10
+ continue
+ fi
+ fi
+
install_lang_specific
STATE=19
diff --git a/packages/localechooser/mktemplates.warnings b/packages/localechooser/mktemplates.warnings
new file mode 100755
index 0000000..57edc26
--- /dev/null
+++ b/packages/localechooser/mktemplates.warnings
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+#
+# Author: Frans Pop (2008)
+#
+# Append language-specific warnings about incomplete translations
+
+use strict;
+use warnings;
+
+my $list = shift;
+my $outfile = shift;
+
+print "Appending language-specific templates about incomplete translations...\n";
+
+open(TOUT, ">> $outfile") || die "Unable to write $outfile";
+open(L, "< $list") || die "Unable to read $list";
+while (<L>) {
+ chomp;
+ next if m/^\#/;
+ my ($code, $name, $translation, $level, $country, $locale, $langlist, ) = split(/;/);
+ next if $langlist !~ /:/;
+
+ my $have_template = 0;
+ if (! open(T, "< debian/localechooser.templates-$code")) {
+ print "Warning: missing localized warnings file for $code!\n";
+ next
+ }
+ while (<T>) {
+ chomp;
+ next if m/^\#/;
+ if (! $have_template) {
+ if (m/^Template:/) {
+ $have_template = 1;
+ print TOUT "\n";
+ print TOUT $_, "\n";
+ }
+ } else {
+ print TOUT $_, "\n";
+ }
+ }
+ if (! $have_template) {
+ print "Warning: no localized warnings for $code in file!\n";
+ }
+}
+close(L);
+close(TOUT) || warn;
diff --git a/packages/localechooser/translation-check b/packages/localechooser/translation-check
new file mode 100755
index 0000000..117f924
--- /dev/null
+++ b/packages/localechooser/translation-check
@@ -0,0 +1,49 @@
+#! /bin/sh
+set -e
+
+# Exits without error if translation is _not_ completely up-to-date;
+# with errror if translation is up-to-date or on errors.
+
+if [ "$1" = en ] || [ "$1" = C ]; then
+ exit 9 # up-to-date by definition
+fi
+
+sfile=/usr/share/localechooser/translation-status
+[ -f $sfile ] || exit 1
+
+tstatus=$(grep "^$1:" $sfile | sed "s/.*:[[:space:]]*//")
+[ "$tstatus" ] || exit 1
+
+tlevel=${tstatus% *}
+tcompl=${tstatus#* }
+expr "$tlevel" : "[1-5]" >/dev/null || exit 1
+expr "$tcompl" : "[FMPLU]" >/dev/null || exit 1
+
+arch=$(archdetect)
+case ${arch%/*} in
+ i386|amd64)
+ archlevel=3 ;;
+ arm*|mips*|powerpc|ppc64|sparc)
+ archlevel=4 ;;
+ alpha|hppa|ia64|m68k|s390)
+ archlevel=5 ;;
+ *)
+ archlevel=5 ;;
+esac
+
+if [ "$tcompl" = F ]; then
+ exit 9 # up-to-date
+elif [ $archlevel = 3 ] && [ $tlevel -eq 2 ] && [ $tcompl != M ]; then
+ echo 0 # incomplete
+elif [ $archlevel = 3 ] && [ $tlevel -eq 2 ]; then
+ echo 1 # incomplete, but normal installs mostly OK
+elif [ $tlevel -lt $archlevel ] ||
+ ([ $tlevel -eq $archlevel ] && [ $tcompl = U ]); then
+ echo 0 # incomplete
+elif [ $tlevel -eq $archlevel ] && [ $tcompl != M ]; then
+ echo 2 # partial at wanted level
+elif [ $tlevel -eq $archlevel ]; then
+ echo 3 # mostly complete
+else
+ echo 4 # only exceptions untranslated
+fi
Attachment:
signature.asc
Description: This is a digitally signed message part.