Package: console-data Version: 2:1.06-1 Severity: wishlist The attached patch contains scripts to convert the architecture keymap templates files to use Choices-C for the keymap codes and Choices to use keymap names. The PO files are converted as well.
See the included README for details, but I suggest to discuss details of the conversion on IRC before it is executed. The package has been build tested after a conversion and the resulting template files included in udebs and the debdiff have been inspected manually, but the packages have not been tested. Note that in some cases differences between translations for keymap architectures can be lost if the English keymap names were identical. For example, Arabic had a "- usb -" indication in some translations, but because in English the names for "us" and "mac-usb-us" were identical, this distinction is lost. The same also affects translations that appended the keymap code in the translation. Example for Dutch from the PO-file diff: -msgid "mac-usb-de-latin1-nodeadkeys" +msgid "German (no dead keys)" msgstr "" "Duits Macintosch usb-toetsenbord zonder dode toetsen (mac-usb-de-latin1)" The msgstr translates to: "German Macintosch usb keyboard without dead keys (mac-usb-de-latin1)" The "usb keyboard" and "(mac-usb-de-latin1)" no longer make sense. Translators will probably want to update their translations for such changes to improve/regain consistency. Unless of course we want to keep such distinctions, but then they should be added in the English "translation" (or in the keymaplist file) _before_ the conversion. It probably makes sense anyway to check the English "translations" for consistency before the conversion. Note also that some PO files should probably be cleaned up. For example, pa.po contains many keymap _codes_ as "translations"; these should be removed.
diff --git a/debian/template-convert/README b/debian/template-convert/README new file mode 100644 index 0000000..913d1b1 --- /dev/null +++ b/debian/template-convert/README @@ -0,0 +1,77 @@ +The scripts and file in this directory are temporary. +They are used to convert the keymap templates files from using keymap codes +in the Choices field to using keymap names. The keymap codes are still used +to identify a keymap, but are moved to the Choices-C field. + +This change also means that PO files need to be converted. + +Overview +======== +- tconvert-all: convert all console-keymaps-*.templates +- tconvert: does actual conversion for a single templates file +- po-convert: converts one or more PO files +- keymaplist: contains mapping from code to name used for PO file conversion + +Procedure +========= +Steps for the initial conversion: +- make sure translations are up-to-date as much as possible +- run debconf-updatepo +- build the package using the "old" template files + This is needed because the conversion uses the generated templates file in + console-keymaps-$i/DEBIAN as basis for sorting the English choices +- cd debian/ +- ./template-convert/tconvert-all +- ./template-convert/po-convert po/*.po + +Note that running tconvert will automatically add any not previously seen +keymaps to the keymaplist file. + +If a translation update (PO file) is received after the conversion that still +uses the old system, it can be converted individually: +- cd debian/ +- save the PO file in ./po/ as normal +- ./template-convert/po-convert po/<language>.po + +Comments +======== +The format of the keymaplist file is: +<keymap code><single tab><keymap name> + +The current sort-keymaps script only indexes Choices-$lang.UTF-8 fields. +This means that the English choices in the Choices field need to be +sorted manually (or at least kept sorted if keymaps are added). +In principle it should be possible to modify the script so that the Choices +field is indexed too. + +Because the use of keymap names as choices means that if a translation is +missing or fuzzy the English keyboard name will be used (and not the code), +the templates files now include the #flag:partial directive. +This means that translations will no longer be dropped completely if a +translation for just a single keymap is missing. + +It is probably wise to also add the "obsolete" keymaps (cf, mac-usb-euro) +in the keymaplist file so that those are converted as well. This has not +yet been done. + +Example +======= + +Current templates file for at +----------------------------- +Template: console-keymaps-at/keymap +Type: select +__Choices: by, bg, ca-multi, croat, cz-lat2, ... +_Description: Keymap to use: + +Templates file for at after conversion +-------------------------------------- +Template: console-keymaps-at/keymap +Choices-C: us, by, be2-latin1, br-abnt2, ... +#flag:partial +__Choices: American English, Belarusian, Belgian, Brazilian (ABNT2 layout), ... +_Description: Keymap to use: + + +Author: Frans Pop +Date: March 18, 2008 diff --git a/debian/template-convert/keymaplist b/debian/template-convert/keymaplist new file mode 100644 index 0000000..8862b34 --- /dev/null +++ b/debian/template-convert/keymaplist @@ -0,0 +1,91 @@ +by Belarusian +bg Bulgarian +croat Croatian +cz-lat2 Czech +sg-latin1 Swiss German +de-latin1-nodeadkeys German +dk-latin1 Danish +us American English +uk British English +dvorak Dvorak +et Estonian +la-latin1 Latin American +es Spanish +fi-latin1 Finnish +fr-latin9 French +fr-latin1 French (obsolete) +be2-latin1 Belgian +ca-multi Canadian Multilingual +fr_CH-latin1 Swiss French +gr Greek +hebrew Hebrew +hu Hungarian +is-latin1 Icelandic +it Italian +lt Lithuanian +lv-latin4 Latvian +jp106 Japanese +mk Macedonian +no-latin1 Norwegian +nl Dutch +pl Polish +pt-latin1 Portuguese +br-abnt2 Brazilian (ABNT2 layout) +br-latin1 Brazilian (EUA layout) +ro Romanian +ru Russian +sk-qwerty Slovakian +slovene Slovene +sr-cy Serbian (Cyrillic) +se-latin1 Swedish +trfu Turkish (F layout) +trqu Turkish (Q layout) +ua Ukrainian +amiga-us American English (amiga) +amiga-fr French (amiga) +amiga-de German (amiga) +amiga-it Italian (amiga) +amiga-se Swedish (amiga) +amiga-sg Swiss German (amiga) +amiga-es Spanish (amiga) +atari-us American English (atari) +atari-uk British English (atari) +atari-fr French (atari) +atari-de German (atari) +atari-se Swedish (atari) +lk201-us US English +mac-us-std U.S. English (Mac; 82 keys) +mac-us-ext U.S. English (Mac; extended kbd) +mac-de2-ext German (Mac; extended kbd) +mac-fr2-ext French (Mac; extended kbd) +mac-fr3 French (Mac; alternate) +sunkeymap American English +sunt5-fi-latin1 Finnish (type 5) +sunt5-fr-latin1 French (type 5) +sunt5-de-latin1 German (type 5) +sunt5-ru Russian (type 5) +sunt5-es Spanish (type 5) +sunt4-es Spanish (type 4) +sun-pl Polish +sunt5-cz-us Czech (type 5; US layout) +sunt5-uk British English (type 5) +sunt4-no-latin1 Norwegian (type 4) +sunt5-no Norwegian (type 5) +sunt5-trqalt Turkish Q(type 5) +sunt4-ja Japanese (type 4) +sunt5-ja Japanese (type 5) +mac-usb-be Belgian +mac-usb-de-latin1 German +mac-usb-de-latin1-nodeadkeys German (no dead keys) +mac-usb-de_CH Swiss German +mac-usb-dk-latin1 Danish +mac-usb-us American English +mac-usb-dvorak Dvorak +mac-usb-es Spanish +mac-usb-fi-latin1 Finnish +mac-usb-fr French +mac-usb-fr_CH-latin1 Swiss French +mac-usb-it Italian +mac-usb-pt-latin1 Portuguese +mac-usb-se Swedish +mac-usb-uk British English diff --git a/debian/template-convert/po-convert b/debian/template-convert/po-convert new file mode 100755 index 0000000..4f6a6a9 --- /dev/null +++ b/debian/template-convert/po-convert @@ -0,0 +1,23 @@ +#! /bin/bash + +while [ "$1" ]; do + if [ -z "$1" ] || [ ! -f "$1" ] || ! echo "$1" | grep -q "\.po$"; then + echo "Not a valid PO file: $1" + echo "Skipping" + continue + fi + + echo "Converting $1..." + + while read line; do + code=$(echo "$line" | cut -f1) + name=$(echo "$line" | cut -f2) + sed -i "s/^msgid \"$code\"$/msgid \"$name\"/" $1 + done <template-convert/keymaplist + + # remove duplicate strings + msguniq --use-first $1 >$1.new + mv $1.new $1 + + shift +done diff --git a/debian/template-convert/tconvert b/debian/template-convert/tconvert new file mode 100755 index 0000000..bb5efff --- /dev/null +++ b/debian/template-convert/tconvert @@ -0,0 +1,65 @@ +#! /bin/bash + +OLDIFS="$IFS" + +while read line; do + type="${line%%: *}" + content="${line#*: }" + case $type in + Template) + template="$content" + ;; + Description) + desc="$content" + ;; + Choices) + content="$(echo "$content" | sed "s/, /,/g")" + IFS=, + for item in $content; do + choice=( "[EMAIL PROTECTED]" "$item" ) + done + IFS="$OLDIFS" + ;; + Choices-en.UTF-8) + content="$(echo "$content" | sed "s/, /,/g")" + IFS=, + for item in $content; do + choice_en=( "[EMAIL PROTECTED]" "$item" ) + done + IFS="$OLDIFS" + ;; + Indices-en.UTF-8) + content="$(echo "$content" | sed "s/, /,/g")" + IFS=, + for item in $content; do + index=( "[EMAIL PROTECTED]" "$item" ) + done + IFS="$OLDIFS" + ;; + esac +done < $1 + +# sanity check +if [ [EMAIL PROTECTED] -ne [EMAIL PROTECTED] ] || [ [EMAIL PROTECTED] -ne [EMAIL PROTECTED] ]; then + echo "error: Number of elements does not match" + exit 1 +fi + [EMAIL PROTECTED] +for i in $(seq 0 $(($count - 1))); do + # Write file with codes for PO conversion + touch template-convert/keymaplist + if ! grep -q "^${choice[i]}[[:space:]]" template-convert/keymaplist; then + echo -e "${choice[i]}\t${choice_en[i]}" >>template-convert/keymaplist + fi + + wanted=${index[i]} + choice_sort=${choice_sort:+$choice_sort, }${choice[wanted - 1]} + choice_en_sort=${choice_en_sort:+$choice_en_sort, }${choice_en[wanted - 1]} +done + +echo "Template: $template" +echo "Choices-C: $choice_sort" +echo "#flag:partial" +echo "__Choices: $choice_en_sort" +echo "_Description: $desc" diff --git a/debian/template-convert/tconvert-all b/debian/template-convert/tconvert-all new file mode 100755 index 0000000..14bc912 --- /dev/null +++ b/debian/template-convert/tconvert-all @@ -0,0 +1,10 @@ +#! /bin/bash + +for i in acorn amiga at atari dec mac sun usb; do + if [ ! -d console-keymaps-$i/DEBIAN ]; then + echo "You must run debuild first" + exit 1 + fi + ./template-convert/tconvert console-keymaps-$i/DEBIAN/templates \ + >console-keymaps-$i.templates +done diff --git a/template-convert/convert-all b/template-convert/convert-all new file mode 100755 index 0000000..d21b5b8 --- /dev/null +++ b/template-convert/convert-all @@ -0,0 +1,10 @@ +#! /bin/bash + +for i in acorn amiga at atari dec mac sun usb; do + if [ ! -d debian/console-keymaps-$i/DEBIAN ]; then + echo "You must run debuild first" + exit 1 + fi + ./template-convert/tconvert debian/console-keymaps-$i/DEBIAN/templates \ + >debian/console-keymaps-$i.templates +done diff --git a/template-convert/keymaplist b/template-convert/keymaplist new file mode 100644 index 0000000..8862b34 --- /dev/null +++ b/template-convert/keymaplist @@ -0,0 +1,91 @@ +by Belarusian +bg Bulgarian +croat Croatian +cz-lat2 Czech +sg-latin1 Swiss German +de-latin1-nodeadkeys German +dk-latin1 Danish +us American English +uk British English +dvorak Dvorak +et Estonian +la-latin1 Latin American +es Spanish +fi-latin1 Finnish +fr-latin9 French +fr-latin1 French (obsolete) +be2-latin1 Belgian +ca-multi Canadian Multilingual +fr_CH-latin1 Swiss French +gr Greek +hebrew Hebrew +hu Hungarian +is-latin1 Icelandic +it Italian +lt Lithuanian +lv-latin4 Latvian +jp106 Japanese +mk Macedonian +no-latin1 Norwegian +nl Dutch +pl Polish +pt-latin1 Portuguese +br-abnt2 Brazilian (ABNT2 layout) +br-latin1 Brazilian (EUA layout) +ro Romanian +ru Russian +sk-qwerty Slovakian +slovene Slovene +sr-cy Serbian (Cyrillic) +se-latin1 Swedish +trfu Turkish (F layout) +trqu Turkish (Q layout) +ua Ukrainian +amiga-us American English (amiga) +amiga-fr French (amiga) +amiga-de German (amiga) +amiga-it Italian (amiga) +amiga-se Swedish (amiga) +amiga-sg Swiss German (amiga) +amiga-es Spanish (amiga) +atari-us American English (atari) +atari-uk British English (atari) +atari-fr French (atari) +atari-de German (atari) +atari-se Swedish (atari) +lk201-us US English +mac-us-std U.S. English (Mac; 82 keys) +mac-us-ext U.S. English (Mac; extended kbd) +mac-de2-ext German (Mac; extended kbd) +mac-fr2-ext French (Mac; extended kbd) +mac-fr3 French (Mac; alternate) +sunkeymap American English +sunt5-fi-latin1 Finnish (type 5) +sunt5-fr-latin1 French (type 5) +sunt5-de-latin1 German (type 5) +sunt5-ru Russian (type 5) +sunt5-es Spanish (type 5) +sunt4-es Spanish (type 4) +sun-pl Polish +sunt5-cz-us Czech (type 5; US layout) +sunt5-uk British English (type 5) +sunt4-no-latin1 Norwegian (type 4) +sunt5-no Norwegian (type 5) +sunt5-trqalt Turkish Q(type 5) +sunt4-ja Japanese (type 4) +sunt5-ja Japanese (type 5) +mac-usb-be Belgian +mac-usb-de-latin1 German +mac-usb-de-latin1-nodeadkeys German (no dead keys) +mac-usb-de_CH Swiss German +mac-usb-dk-latin1 Danish +mac-usb-us American English +mac-usb-dvorak Dvorak +mac-usb-es Spanish +mac-usb-fi-latin1 Finnish +mac-usb-fr French +mac-usb-fr_CH-latin1 Swiss French +mac-usb-it Italian +mac-usb-pt-latin1 Portuguese +mac-usb-se Swedish +mac-usb-uk British English diff --git a/template-convert/pconvert b/template-convert/pconvert new file mode 100755 index 0000000..4f6a6a9 --- /dev/null +++ b/template-convert/pconvert @@ -0,0 +1,23 @@ +#! /bin/bash + +while [ "$1" ]; do + if [ -z "$1" ] || [ ! -f "$1" ] || ! echo "$1" | grep -q "\.po$"; then + echo "Not a valid PO file: $1" + echo "Skipping" + continue + fi + + echo "Converting $1..." + + while read line; do + code=$(echo "$line" | cut -f1) + name=$(echo "$line" | cut -f2) + sed -i "s/^msgid \"$code\"$/msgid \"$name\"/" $1 + done <template-convert/keymaplist + + # remove duplicate strings + msguniq --use-first $1 >$1.new + mv $1.new $1 + + shift +done diff --git a/template-convert/tconvert b/template-convert/tconvert new file mode 100755 index 0000000..bb5efff --- /dev/null +++ b/template-convert/tconvert @@ -0,0 +1,65 @@ +#! /bin/bash + +OLDIFS="$IFS" + +while read line; do + type="${line%%: *}" + content="${line#*: }" + case $type in + Template) + template="$content" + ;; + Description) + desc="$content" + ;; + Choices) + content="$(echo "$content" | sed "s/, /,/g")" + IFS=, + for item in $content; do + choice=( "[EMAIL PROTECTED]" "$item" ) + done + IFS="$OLDIFS" + ;; + Choices-en.UTF-8) + content="$(echo "$content" | sed "s/, /,/g")" + IFS=, + for item in $content; do + choice_en=( "[EMAIL PROTECTED]" "$item" ) + done + IFS="$OLDIFS" + ;; + Indices-en.UTF-8) + content="$(echo "$content" | sed "s/, /,/g")" + IFS=, + for item in $content; do + index=( "[EMAIL PROTECTED]" "$item" ) + done + IFS="$OLDIFS" + ;; + esac +done < $1 + +# sanity check +if [ [EMAIL PROTECTED] -ne [EMAIL PROTECTED] ] || [ [EMAIL PROTECTED] -ne [EMAIL PROTECTED] ]; then + echo "error: Number of elements does not match" + exit 1 +fi + [EMAIL PROTECTED] +for i in $(seq 0 $(($count - 1))); do + # Write file with codes for PO conversion + touch template-convert/keymaplist + if ! grep -q "^${choice[i]}[[:space:]]" template-convert/keymaplist; then + echo -e "${choice[i]}\t${choice_en[i]}" >>template-convert/keymaplist + fi + + wanted=${index[i]} + choice_sort=${choice_sort:+$choice_sort, }${choice[wanted - 1]} + choice_en_sort=${choice_en_sort:+$choice_en_sort, }${choice_en[wanted - 1]} +done + +echo "Template: $template" +echo "Choices-C: $choice_sort" +echo "#flag:partial" +echo "__Choices: $choice_en_sort" +echo "_Description: $desc"
signature.asc
Description: This is a digitally signed message part.