| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | tailscip-shell system . . tail. -n +18 en_GB.po | grepscip-shell system . . grep. -v \# > en_temp1 # on vire les lignes et commentaires inutiles |
| 4 | sedscip-shell system . . sed. -i '/^[<space><tab>]*$/dscip-shell filesystem . . `/^[<space><tab>]*$/d`.' en_temp1 # lignes vides |
| 5 | trscip-shell system . . tr. -d "\n" <en_temp1 >en_temp # on vire tous les \n |
| 6 | sedscip-shell system . . sed. -i 's/""//g' en_temp # on vire les "" |
| 7 | sedscip-shell system . . sed. -i 's/msgid/\n/g' en_temp # on vire ce qui est hors des "(...)" |
| 8 | sedscip-shell system . . sed. -i 's/msgstr//g' en_temp |
| 9 | sedscip-shell system . . sed. -i 's/ / /g' en_temp # les doubles espaces |
| 10 | sedscip-shell system . . sed. -i 's/^ //g' en_temp # les espaces au début |
| 11 | sedscip-shell system . . sed. -i 's/\%/\\\%/g' en_temp # les % |
| 12 | sedscip-shell system . . sed. -i 's/&/\\&/g' en_temp # les & |
| 13 | sedscip-shell system . . sed. -i 's/\//\\\//g' en_temp # les / |
| 14 | sedscip-shell system . . sed. -i 's/\\/\\\\/g' en_temp # les \ |
| 15 | sedscip-shell system . . sed. -i 's/\*/\\\*/g' en_temp # les * |
| 16 | # sed -i 's/\:/\\\:/g' en_temp # les : |
| 17 | sedscip-shell system . . sed. -i "s/'/\\'/g" en_temp # les ' |
| 18 | sedscip-shell system . . sed. -i '/^[<space><tab>]*$/dscip-shell filesystem . . `/^[<space><tab>]*$/d`.' en_temp # lignes vides |
| 19 | |
| 20 | # les .po/.pot |
| 21 | po_pot=`lsscip-shell system . . ls. *.po` |
| 22 | po_pot=`echoscip-shell system . . echo. "cairo-dock.pot $po_pot"` |
| 23 | for i in $po_pot; do |
| 24 | echoscip-shell system . . echo. $i |
| 25 | sedscip-shell system . . sed. -i ':z;N;s/ ""\n"/ "/;bz' $i # on vire tous les \n => msgid ""\n"longue ph..." |
| 26 | sedscip-shell system . . sed. -i ':z;N;s/ "\n"/ /;bz' $i # on vire toutes les phrases coupées |
| 27 | sedscip-shell system . . sed. -i ':z;N;s/\\n"\n"/\\n/;bz' $i # on veut une seule ligne => \\n"\n" -> \\n |
| 28 | sedscip-shell system . . sed. -i ':z;N;s/ ""/ /;bz' $i # on vire les "" isolés |
| 29 | sedscip-shell system . . sed. -i 's/""//g' $i # on vire les "" |
| 30 | sedscip-shell system . . sed. -i ':z;N;s/msgid \n/msgid ""\n/;bz' $i # les msgid vides |
| 31 | sedscip-shell system . . sed. -i ':z;N;s/msgstr \n/msgstr ""\n/;bz' $i # les msgstr vides |
| 32 | done |
| 33 | |
| 34 | # scripte pour remplacer les phrases mauvaises ($1) par les bonnes ($2) sans modifier d'autres fichiers |
| 35 | ## => replace_my_trad.sh |
| 36 | |
| 37 | |
| 38 | # le fichier est lit ligne par ligne et les arguments sont envoyés dans le script ci-dessus. |
| 39 | #total_ph=`wc -l en_temp` |
| 40 | while [scip-shell system . . `[`. "`headscip-shell system . . head. -n 1 'en_temp'`" != "" ];do |
| 41 | headscip-shell system . . head. -n 1 en_temp | xargsscip-shell system . . xargs. sh replace_my_trad.sh |
| 42 | tailscip-shell system . . tail. -n+2 en_temp > en_temp0 |
| 43 | mvscip-shell system . . mv. en_temp0 en_temp |
| 44 | wcscip-shell system . . wc. -l en_temp |
| 45 | done |
| 46 | |
| 47 | rmscip-shell system . . rm. en_temp en_temp1 |
| 48 | #find . -name "*.*" -type f -print | grep -v bzr | xargs sed -i 's/cairo-dock.org/glx-dock.org/g' |
| 49 | |
| 50 | for i in `lsscip-shell system . . ls. *.po`; do |
| 51 | msguniqscip-shell system . . msguniq. $i > "temp" |
| 52 | mvscip-shell system . . mv. "temp" $i |
| 53 | done |
| 54 | # 2 fois pour les erreurs |
| 55 | for i in `lsscip-shell system . . ls. *.po`; do msguniqscip-shell system . . msguniq. $i > "temp"; mvscip-shell system . . mv. "temp" $i; done |
| 56 | |
| 57 | ##### Prob ##### |
| 58 | #sed -e 'N;s/{$ph1/AAAAAAAAAAAA/P;D; # => n'accepte que 2 lignes :/ |