[lfs-fr] LFS Translation

amj amj at tdct.org
Sam 24 Mai 09:00:45 PDT 2014


Hi

I have created a new makefile
(the updatepo function have not been tested yet and the first sed must
be replaced)
and it works :D


Le 24/05/14 06:15, Alberto Senna Dias Neto a écrit :
> I broke in peaces the makefile you showed me and I made the translation
> inside each folder, this way it would be easier to find any mistakes either
> done by me or by OmegaT.
> This way I keep in the same folder the translated .xml, the original in
> english .en.xml file and the .po file.
> I intend to write a more efficient and elegant script, but at this moment
> this is what I need to track errors.
>
> So, here are the steps:
>
> 1 - Starting a new translation from a brend new checkout of the original
> lfs book, enter the folder and run the following:
>
> ***********************************
> find . -path "./stylesheets" -prune -o -path "./bootscripts" -prune -o
> -path "./udev-lfs" -prune -o -name "*.xml" | while read line; do
>
>   echo $line
>
>   mv $line ${line/.xml/.en.xml}
>   po4a-gettextize -f docbook -m ${line/.xml/.en.xml} -p ${line/.xml/.po}
>
>   done
> ***********************************
> With this we end up with a xml, en.xml and a po file.
>
> 2 - Translate the po file with the tool you like, I used OmegaT because it
> keeps a translation memory and it is visually friendly when compared to
> poedit or virtaal (virtaal made a huge mess in the po file, in fact it
> changed the original text making it impossible to apply the new translation)
> To use OmegaT you have to create a project and import the .po files.
> Here is a trick: When setting up the OmegaT project you can make text
> segmentation at sentence level. It makes the translation more readable.
> Do not use OmegaT to translate the xml file. If you do this, it will not be
> possible to use the translation memory because of the xml entities that are
> kept in the text. Believe me, I lost a lot of time editing my translation
> memory.
>
> 3 - Once you finish the translation of a chapter inside OmegaT you generate
> the translated po. Copy the translated po file that is inside the folder
> target of OmegaT project and overwrite the po file initially generated.
>
> 4 - Inside the folder where you have the original en.xml, translated .po
> and the xml file, run:
>
> for i in *.po; do
>   echo $i
>
>   po4a-translate -f docbook -k 0 -m ${i/.po/.en.xml} -p $i -l ${i/.po/.xml}
>
> done
>
> This will apply the translations to the xml file, in fact it overwrites the
> xml file.
>
> 5 - Edit the tag lang at the index.xml. Remember to take a look at the .ent
> files, and athe the xreflabel at each chapter0?.xml.
>
> 6 - run make to build the book normally.
>
> When updating a translation you just have to do the steps 2, 3, 4 and 6.
>
> Take a look at: svn co
> https://lfs-pt-br.googlecode.com/svn/trunk/lfs-OmegaT/
>
> Read the file "Instruction OmegaT.txt"
>
> After the grammatical review, I will write a more efficient script for
> dealing with the po and the en.xml files. The book cannot have his mess of
> files. I think it must be as clean as the original.
>
> Regards.
>
>
>

-------------- section suivante --------------
Une pièce jointe HTML a été nettoyée...
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-traducfr/attachments/20140524/495a2a5d/attachment.html>
-------------- section suivante --------------
#!/usr/bin/make -f
LANG1 = en/BOOK2
LANG2 = lfs3
PO_dir = po_en_fr
sourcegen = lfsgen
version = svn

XML1 = $(wildcard $(LANG1)/*.xml) $(wildcard $(LANG1)/**/*.xml)

PO = $(patsubst $(LANG1)/%.xml,$(PO_dir)/%.po, $(XML1))
PO_init = $(patsubst $(LANG1)/%.xml,init/%.po, $(XML1))
XMLGEN = $(patsubst $(LANG1)/%.xml,$(sourcegen)/%.xml, $(XML1))
default:
	@echo makefile de génération de po
	@echo utiliser initpo pour une nouvelle génération de po à partir du xml
#cible à n'executer que la première fois un fois pour convertir un projet existant vers le système po
initpo: $(PO_init)

#cible fictive
init/%.po: $(LANG1)/%.xml $(LANG2)/%.xml
	po4a-gettextize -f docbook -m $(LANG1)/$*.xml -l $(LANG2)/$*.xml -p $(PO_dir)/$*.po
	sed -e "s/#, fuzzy/#, /g"  -i $(PO_dir)/$*.po
updatepo: $(PO)

$(PO_dir)/%.po: $(LANG1)/%.xml 
	po4a-updatepo -k 0 -f docbook -m $(LANG1)/$*.xml -p $(PO_dir)/$*.po

gensource: genxml appsed

genxml: $(XMLGEN)

$(sourcegen)/%.xml: $(PO_dir)/%.po $(LANG1)/%.xml
	po4a-translate -k 0 -f docbook -m $(LANG1)/$*.xml -l $(sourcegen)/$*.xml -p $(PO_dir)/$*.po

filetocopy = aux-file-data.sh bootscripts images INSTALL make-aux-files.sh obfuscate.sh pdf-fixups.sh process-scripts.sh README tidy.conf udev-lfs general.ent packages.ent patches.ent

addfiles: $(LANG1)
	for a in $(filetocopy); do cp -r "$(LANG1)/$$a"  $(sourcegen)/ ;done
	wget http://amj.tdct.org/.lfs/lfs-fr-stylesheet-mk-epub-udev_config.tar.xz -O stylesheet.tar.xz
	cd $(sourcegen)/ && tar  -xJf ../stylesheet.tar.xz 

date1 = $(shell sed -n 3p  general.ent | sed 's/.*"\([^"]\+\)".*/\1/')
date2 = $(shell date -d "$(date1)" "+%d %B %Y")
appsed: addfiles
#je sais c'est torchon d'appliquer des scripts sed à du xml ^^ => faudrait utiliser le "robot" de myou
	sed -e "s/$(date1)/$(date2)/g"\
	    -e "s/Approximate build time/Temps de construction approximatif/g"\
	    -e "s/Required disk space/Espace disque requis/g"\
	    -e "s/Installation depends on/L'installation dépend de/g"\
	    -e "s/Test suite depends on/La suite de tests dépend de/g"\
	    -e "s/Must be installed before/Doit être installé avant/g"\
	    -e "s/Optional dependencies/Dépendances facultatives/g"\
	    -e "s/&lfs-root;blfs\//http:\/\/lfs.traduc.org\/view\/blfs-$(version)/g"\
	    -e "s/&lfs-root;hints\/downloads\/files\//http:\/\/lfs.traduc.org\/view\/astuces\//g"\
	    -i $(sourcegen)/general.ent

	sed -e "s/KB/Ko/g" -e "s/MB/Mo/g" -e "s/GB/Go/g"\
	    -e "s/less than/moins de/g"\
	    -e "s/typically about/en général environ/g"\
	    -e "s/about/environ/g"\
	    -e "s/with tests/avec les tests/g"\
	    -i $(sourcegen)/packages.ent
	
	sed -e "s/KB/Ko/g"  -i $(sourcegen)/patches.ent
	sed -e "s/<book>/<book lang=\"fr\">/g"  -i $(sourcegen)/index.xml



More information about the lfs-traducfr mailing list