[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RFC] Final (?) changes to localechooser templates



Here's a proposal for some final tuning to the country selection dialogs.
Partly as a result of the discussion with Florian Zumbiehl in #559795.

We have three dialogs:
1) country shortlist based on language
2) continent
3) country per continent.

Main reason for the change is that any of the three can be the first dialog 
displayed after selection of a language:
1) if selected language has multiple locales/countries (e.g. English)
2) if selected language has no default country (e.g. C, Esperanto)
3) if selected language has only one locale/country (e.g. Finnish, Czech)

This means that all need a proper introduction what the purpose of the 
selection is. And 3) was missing some indication of the current continent; 
adding that makes the "<Go Back> to select a different continent" 
instruction more logical.

"Country" has been replaced with "location" in a few places because it is 
more generic and to better match the recently improved dialog title.

In this proposal all three dialogs start with the same text:

                         Select your location

   The selected location will be used to set your time zone and also
   for example to help select the system locale. Normally this should
   be the country where you live.

Note that I've changed the first sentence to further de-emphasize the role 
of the location in the selection of locale.

Below that intro you get one of the following.

The country shortlist dialog:

   This is a shortlist of locations based on the language you selected.
   Choose "other" if your location is not listed.

   Country, territory or area:

The continent dialog:

   Select the continent or region to which your location belongs.

   Continent or region:

The country per continent dialog:

   Listed are locations for: <continent>. Use the <Go Back> option to
   select a different continent or region if your location is not listed.

   Country, territory or area:

Cheers,
FJP

P.S. I've now also eliminated duplication of strings in the templates file 
for the continents dialogs, so the size of the udeb should become smaller.

Index: localechooser
===================================================================
--- localechooser	(revision 61818)
+++ localechooser	(working copy)
@@ -13,6 +13,7 @@
 tpl_shortlist="localechooser/shortlist"
 tpl_continentlist="localechooser/continentlist"
 tpl_countrylist="localechooser/countrylist"
+tpl_countrytxt="localechooser/text/country"
 tpl_supportedlocales="localechooser/supported-locales"
 tpl_preferredlocale="localechooser/preferred-locale"
 
@@ -280,6 +281,29 @@
 	echo " $RET," | grep -q " $value,"
 }
 
+# Get translation of current selection in select list
+# Assumes untranslated values don't contain commas
+choice_trans() {
+	local RET template value list list_trans
+	template=$1
+	value=$2
+
+	# Use Choices-C to get the untranslated values
+	db_metaget $template Choices-C
+	list=$(echo $RET | sed 's/, */,/g')
+	db_metaget $template Choices
+	list_trans=$(echo $RET | sed 's/\\,/#%#/g; s/, */,/g')
+
+	while :; do
+		if [ "${list%%,*}" = "$value" ]; then
+			echo "${list_trans%%,*}" | sed 's/#%#/\\,/g'
+			break
+		fi
+		list=${list#*,}
+		list_trans=${list_trans#*,}
+	done
+}
+
 # Set defaults for continent based on country
 set_default_continent() {
 	local IFS RET country continents c continent
@@ -290,9 +314,9 @@
 		return
 	fi
 
-	# Use Choices-en.UTF-8 to avoid getting translated values
-	db_metaget $tpl_continentlist Choices-en.UTF-8
-	continents=$(echo $RET | sed "s/, /,/g")
+	# Use Choices-C to get the untranslated values
+	db_metaget $tpl_continentlist Choices-C
+	continents=$(echo $RET | sed 's/, */,/g')
 
 	IFS=,
 	for continent in $continents; do
@@ -491,10 +515,10 @@
 		db_set "$tpl_di_consoledisplay"  "$CONSOLE"
 		log "Set $tpl_di_consoledisplay = '$CONSOLE'"
 
-		db_metaget localechooser/text/country1 description
-		txt_country1=$RET
-		db_metaget localechooser/text/country2 description
-		txt_country2=$RET
+		db_metaget $tpl_countrytxt/1/country description
+		ctxt1=$RET
+		db_metaget $tpl_countrytxt/2 description
+		ctxt2=$RET
 
 		X_INSTALLATION_MEDIUM="$(lsb_extract X_INSTALLATION_MEDIUM)"
 		if [ "$sel_language" ] && [ $LANGUAGE != en ] && \
@@ -571,9 +595,9 @@
 
 			db_fget $tpl_di_country seen
 			db_fset $tpl_shortlist seen $RET || true
-			db_subst $tpl_shortlist TXT1 "$txt_country1"
-			db_subst $tpl_shortlist TXT2 "$txt_country2"
-			db_metaget localechooser/text/country3-short description
+			db_subst $tpl_shortlist TXT1 "$ctxt1"
+			db_subst $tpl_shortlist TXT2 "$ctxt2"
+			db_metaget $tpl_countrytxt/3/shortlist description
 			db_subst $tpl_shortlist TXT3 "$RET"
 
 			# Set default value
@@ -654,6 +678,11 @@
 			fi
 		fi
 
+		db_metaget $tpl_countrytxt/1/continent description
+		db_subst $tpl_continentlist TXT1 "$RET"
+		db_subst $tpl_continentlist TXT2 "$ctxt2"
+		db_metaget $tpl_countrytxt/3/continent description
+		db_subst $tpl_continentlist TXT3 "$RET"
 		db_input $continent_prio $tpl_continentlist || [ $? -eq 30 ]
 		;;
 
@@ -662,13 +691,15 @@
 		continent_prio=$country_prio
 
 		db_get $tpl_continentlist
-		country_template="$tpl_countrylist/$(echo $RET | sed "s/ /_/g")"
+		continent=$RET
+		country_template="$tpl_countrylist/$(echo $continent | sed "s/ /_/g")"
 		db_fget $tpl_di_country seen
 		db_fset $country_template seen $RET || true
-		db_subst $country_template TXT1 "$txt_country1"
-		db_subst $country_template TXT2 "$txt_country2"
-		db_metaget localechooser/text/country3 description
-		db_subst $country_template TXT3 "$RET"
+		db_subst $country_template TXT1 "$ctxt1"
+		db_subst $country_template TXT2 "$ctxt2"
+		db_metaget $tpl_countrytxt/3/country description
+		db_subst $country_template TXT3 "$(printf "$RET" \
+				"$(choice_trans $tpl_continentlist "$continent")")"
 
 		if [ "$current_country" ] && \
 		   has_choice $country_template "$current_country"; then
Index: debian/localechooser.templates-in
===================================================================
--- debian/localechooser.templates-in	(revision 61818)
+++ debian/localechooser.templates-in	(working copy)
@@ -153,26 +153,37 @@
  .
  ${TXT3}
 
-Template: localechooser/text/country1
+Template: localechooser/text/country/1/country
 Type: text
 # :sl1:
 _Description: Country, territory or area:
 
-Template: localechooser/text/country2
+Template: localechooser/text/country/1/continent
 Type: text
 # :sl1:
-_Description: The country selected here will be used to set your time zone and also for example in the determination of the system locale. Normally this should be the country where you live.
+_Description: Continent or region:
 
-Template: localechooser/text/country3
+Template: localechooser/text/country/2
 Type: text
 # :sl1:
-_Description: Choose <Go Back> if your country is not listed.
+_Description: The selected location will be used to set your time zone and also for example to help select the system locale. Normally this should be the country where you live.
 
-Template: localechooser/text/country3-short
+Template: localechooser/text/country/3/shortlist
 Type: text
 # :sl1:
-_Description: This is a shortlist based on the language you selected. Choose "other" if your country is not listed.
+_Description: This is a shortlist of locations based on the language you selected. Choose "other" if your location is not listed.
 
+Template: localechooser/text/country/3/continent
+Type: text
+# :sl1:
+_Description: Select the continent or region to which your location belongs.
+
+Template: localechooser/text/country/3/country
+Type: text
+# '%s' will be replaced with the name of the currently selected continent/region
+# :sl1:
+_Description: Listed are locations for: %s. Use the <Go Back> option to select a different continent or region if your location is not listed.
+
 Template: localechooser/preferred-locale
 Help: localechooser/help/locale
 Choices-C: ${CHOICES-C}
Index: mktemplates.continents
===================================================================
--- mktemplates.continents	(revision 61818)
+++ mktemplates.continents	(working copy)
@@ -114,8 +114,10 @@
 print TOUT "Type: select\n";
 print TOUT "#flag:partial\n";
 print TOUT "__Choices: ",  join(", ", @regions), "\n";
-print TOUT "_Description: ", gettext("Continent or region:"), "\n";
-print TOUT " ", gettext("Select the continent or region in which your country is located."), "\n";
+print TOUT "Description: \${TXT1}\n";
+print TOUT " \${TXT2}\n";
+print TOUT " .\n";
+print TOUT " \${TXT3}\n";
 
 close(TOUT) || warn;
 

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: