tags 471523 patch tags 471474 patch thanks Attached an updated and cleaned up patch for the conversion.
Note that the keymaplist file is an example based on current English translations (with the en patch applied). It should be deleted and regenerated before the actual conversion to match then current situation! Also attached a patch for en.po with three changes that should IMO be committed before the conversion (or maybe better just now). One fixes a typo (missing space); the other two add "sun" as identifier to the only sun keymaps that do not have a type* identifier.
diff --git a/debian/po/en.po b/debian/po/en.po index 96cf35c..d814d71 100644 --- a/debian/po/en.po +++ b/debian/po/en.po @@ -493,7 +493,7 @@ msgstr "French (Mac; alternate)" #. Choices #: ../console-keymaps-sun.templates:1001 msgid "sunkeymap" -msgstr "American English" +msgstr "American English (sun)" # console-keymaps-sun, Finnish #. Type: select @@ -544,7 +544,7 @@ msgstr "Spanish (type 4)" #. Choices #: ../console-keymaps-sun.templates:1001 msgid "sun-pl" -msgstr "Polish" +msgstr "Polish (sun)" # console-keymaps-sun, Czech #. Type: select @@ -579,7 +579,7 @@ msgstr "Norwegian (type 5)" #. Choices #: ../console-keymaps-sun.templates:1001 msgid "sunt5-trqalt" -msgstr "Turkish Q(type 5)" +msgstr "Turkish Q (type 5)" # console-keymaps-sun, Spanish #. Type: select
commit 52aa5fae8a2047af692cff92d30004ce67e129d8 Author: Frans Pop <[EMAIL PROTECTED]> Date: Tue Mar 18 17:31:43 2008 +0100 Add template conversion scripts 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..abc38c7 --- /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 (sun) +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 (sun) +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
signature.asc
Description: This is a digitally signed message part.