Auto-éditer un wikilivre/Annexer (Version internationalisée)/locale

Un livre de Wikilivres.

update_mo.bash[modifier | modifier le wikicode]

  • This file is in .../tests/PACKAGES/locale/ directory
#!/bin/bash
#H file: update_mo
VERSION=211216
#O Include install variables
    pwd > pwd.txt
    if cat pwd.txt | grep ~/Annexer
    then Workdir=~/Annexer
    elif cat pwd.txt | grep ~/Add_appendix
    then Workdir=~/Add_appendix
    else echo "Workind directory not found"
      exit -1
    fi
    rm pwd.txt	
#O Download global variables
    source $Workdir/vars/installdir.var
    if test -z $Mandir
	then Mandir=$Installdir/man
	fi
	if test -z $Sbindir
	then Sbindir=$Installdir/sbin
	fi
Langdir=$Sharedir/addappendix/resources/lang/po
Localedir=$Sharedir/locale
PACKAGESDIR=$Testsdir/PACKAGES

cat $Workdir/vars/installdir.var
echo "Mandir=$Mandir"
echo "Sbindir=$Sbindir"
echo "Langdir=$Langdir"
echo "Localedir=$Localedir"
echo "PACKAGESDIR=$PACKAGESDIR"
#T exit 0

#O Copier les derniers fichiers .pot dans ce répertoire tests/PACKAGES/locale/po
#O Note:  Par l'exécution de cpcleaned2bin de la librairie ils se trouvent dans
#O   le répertoire share/addappendix/resources/lang/po )
echo "cp $Langdir/*.pot po/."
cp $Langdir/*.pot po/.
#O Créer une liste des fichiers sans l'extension '.pot' dans po directory
ls -1 po/*.pot | sed "s/.pot//g" | sed "s/po\///g"> files.pj 
cat files.pj
#T exit 0
#O This script is in tests/PACKAGES/locale. If not then exit -1
if pwd | grep PACKAGES; then echo "update_mo.bash is found in $Testsdir/PACKAGES"; else echo "update_mo.bash is not found in $Testsdir/PACKAGES"; exit -1; fi
if test -z $1; then echo " Syntaxe ./update_mo.bash [ en | de | es | fr ]"; exit -1; fi

#O Tant que l'on a des ligne à lire
while read line
do
#O Imprimer le 'nom' lu
  echo;echo "$line"
#O Si il existe un fichier '$1/nom.po'
  if test -e po/$1/$line.po
#O Alors :
  then 
#O Metre à jour le fichier 'nom.po'
     msgmerge --update po/$1/$line.po po/$line.pot
#0 Créer ou mettre à jour le fichier .mo
     msgfmt po/$1/$line.po -o po/$1/$line.mo
#O Afficher le fichier .mo mis àjour
     ls -a po/$1/$line.mo
     echo -n "po/$1/$line.mo updated :"; ls -l po/$1/$line.mo
	 cp po/$1/$line.mo $Localedir/$1/LC_MESSAGES/.
#O Sinon afficher les message que le fichier.po n'est pas trouvé (donc pas mis à jour
    else echo "po/$1/$line.po is not found, not updated"
  fi
#O Fin du tant-que
done < files.pj

echo;echo "local '.mo' files"
ls -al po/$1/*.mo

echo;echo "$Localedir/$1/LC_MESSAGES/'.mo' files"
ls -al $Localedir/$1/LC_MESSAGES/*.mo

#O afficher le message "Pour metrre à jour /usr/share/locale exécuter la commande  sudo make f- locale.mak -d clean install
echo; echo -e "\033[1;33m### To update /usr/share/locale execute  sudo make f- locale.mak -d clean install in tests/PACKAGES/locale ###\033[0m"

Résultat de update_mo[modifier | modifier le wikicode]

local '.mo' files
-rw-rw-r-- 1 jpl jpl 2322 déc.  16 18:01 po/fr/addappendix.mo
-rw-rw-r-- 1 jpl jpl  522 déc.  16 18:01 po/fr/add_sclic.mo
-rw-rw-r-- 1 jpl jpl  522 déc.  16 18:01 po/fr/add_sclipco.mo
-rw-rw-r-- 1 jpl jpl  522 déc.  16 18:01 po/fr/add_sclipwb.mo
-rw-rw-r-- 1 jpl jpl  522 déc.  16 18:01 po/fr/add_sclt.mo
-rw-rw-r-- 1 jpl jpl  607 déc.  16 18:01 po/fr/annexer.mo
-rw-rw-r-- 1 jpl jpl 5448 déc.  16 18:01 po/fr/annex.mo
-rw-rw-r-- 1 jpl jpl  572 déc.  16 18:01 po/fr/en_sclic.inc.mo
-rw-rw-r-- 1 jpl jpl  531 déc.  16 18:01 po/fr/en_sclipco.inc.mo
-rw-rw-r-- 1 jpl jpl  779 oct.   8 18:06 po/fr/en_sclipwb.inc.mo
-rw-rw-r-- 1 jpl jpl  838 déc.  16 18:01 po/fr/en_sclt.inc.mo
-rw-rw-r-- 1 jpl jpl 3008 déc.  16 18:01 po/fr/header.inc.mo
-rw-rw-r-- 1 jpl jpl  522 déc.  16 18:01 po/fr/scli.inc.mo

/home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/'.mo' files
-rw-r--r-- 1 jpl jpl 2322 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/addappendix.mo
-rw-r--r-- 1 jpl jpl  522 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/add_sclic.mo
-rw-r--r-- 1 jpl jpl  522 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/add_sclipco.mo
-rw-r--r-- 1 jpl jpl  522 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/add_sclipwb.mo
-rw-r--r-- 1 jpl jpl  522 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/add_sclt.mo
-rw-r--r-- 1 jpl jpl  607 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/annexer.mo
-rw-r--r-- 1 jpl jpl 5448 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/annex.mo
-rw-r--r-- 1 jpl jpl  572 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/en_sclic.inc.mo
-rw-r--r-- 1 jpl jpl  531 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/en_sclipco.inc.mo
-rw-r--r-- 1 jpl jpl 3008 oct.  12 18:28 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/en_sclipwb.inc.mo
-rw-r--r-- 1 jpl jpl  838 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/en_sclt.inc.mo
-rw-rw-r-- 1 jpl jpl 3008 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/header.inc.mo
-rw-rw-r-- 1 jpl jpl  522 déc.  16 18:01 /home/jpl/Add_appendix/share/locale/fr/LC_MESSAGES/scli.inc.mo

locale.mak[modifier | modifier le wikicode]

  • This file is in .../tests/PACKAGES/locale/ directory
#!/bin/make
# file:locale.mak for packaging ubuntu addappendix or annexer
# addappendix-O~211213
# updated by french wikibooks user:Goelette_Cardabela
# To install : sudo make f- locale.mak -d clean install
# To test  : make -f locale.mak -d clean install DESTDIR=./tests
# To examine ./tests directory type find ./tests
# Lors de l'installation les fichiers sources doivent être recopiés
# d'un autre répertoire qui peut être dans ~/Add_appendix
#
# This test makefile is in $HOME/Add_appendix/tests/PACKAGES/locale
# system directories

LANG	= $(DESTDIR)/usr/share/locale
Langdir=../../../share/addappendix/resources/lang/po
Localedir=../../../share/locale

install:
	@echo "Warning: before execute update_mo/bash"
	# Install languages after directories installation
	install -d $(LANG)/de/LC_MESSAGES $(LANG)/en/LC_MESSAGES $(LANG)/fr/LC_MESSAGES $(LANG)/es/LC_MESSAGES
	## de
	#cp -f $(Localedir)/de/LC_MESSAGES/*.mo $(LANG)/de/LC_MESSAGES/.
	## en
	#cp -f $(Localedir)/en/LC_MESSAGES/*.mo $(LANG)/en/LC_MESSAGES/.
	## es
	#cp -f $(Localedir)/es/LC_MESSAGES/*.mo $(LANG)/es/LC_MESSAGES/.
	## fr
	cp -f $(Localedir)/fr/LC_MESSAGES/*.mo $(LANG)/fr/LC_MESSAGES/.
	cp -u $(Langdir)/fr/addappendix.mo $(LANG)/fr/LC_MESSAGES/addappendix.mo
	cp -u $(Langdir)/fr/annex.mo $(LANG)/fr/LC_MESSAGES/annex.mo
	cp -u $(Langdir)/fr/header.inc.mo $(LANG)/fr/LC_MESSAGES/header.inc.mo

clean:

Résultat du test[modifier | modifier le wikicode]

fichier du test

find ./tests
./tests
./tests/usr
./tests/usr/share
./tests/usr/share/locale
./tests/usr/share/locale/es
./tests/usr/share/locale/es/LC_MESSAGES
./tests/usr/share/locale/en
./tests/usr/share/locale/en/LC_MESSAGES
./tests/usr/share/locale/de
./tests/usr/share/locale/de/LC_MESSAGES
./tests/usr/share/locale/fr
./tests/usr/share/locale/fr/LC_MESSAGES
./tests/usr/share/locale/fr/LC_MESSAGES/add_sclipwb.mo
./tests/usr/share/locale/fr/LC_MESSAGES/header.inc.mo
./tests/usr/share/locale/fr/LC_MESSAGES/en_sclipco.inc.mo
./tests/usr/share/locale/fr/LC_MESSAGES/en_sclt.inc.mo
./tests/usr/share/locale/fr/LC_MESSAGES/en_sclipwb.inc.mo
./tests/usr/share/locale/fr/LC_MESSAGES/annexer.mo
./tests/usr/share/locale/fr/LC_MESSAGES/scli.inc.mo
./tests/usr/share/locale/fr/LC_MESSAGES/addappendix.mo
./tests/usr/share/locale/fr/LC_MESSAGES/add_sclt.mo
./tests/usr/share/locale/fr/LC_MESSAGES/annex.mo
./tests/usr/share/locale/fr/LC_MESSAGES/en_sclic.inc.mo
./tests/usr/share/locale/fr/LC_MESSAGES/add_sclipco.mo
./tests/usr/share/locale/fr/LC_MESSAGES/add_sclic.mo