Difference between revisions of "Converter .po e .ts a .tmx"
From Proxecto Trasno
(Nova páxina: "== Traballo básico == === Converter un só ficheiro .po a .tmx === Neste caso empregaremos as ferramentas «''translate-toolkit''», pare elo, se non dispomos delas, teremos que ins…") |
|||
Line 1: | Line 1: | ||
+ | <center> | ||
+ | Este como está disponible en [[File:flag_es.png]] castellano en el [http://www.galpon.org/wiki/index.php/Convertir_.po_a_.tmx ''wiki'' de '''Galpon'''].<br> | ||
+ | This HowTo is available in [[File:flag_en.png]] english in the [[Convert .po to .tmx|''in '''this''' wiki'']]. | ||
+ | </center> | ||
+ | |||
== Traballo básico == | == Traballo básico == | ||
=== Converter un só ficheiro .po a .tmx === | === Converter un só ficheiro .po a .tmx === | ||
Line 18: | Line 23: | ||
=== Converter varios ficheiros .po a un só ficheiro .tmx === | === Converter varios ficheiros .po a un só ficheiro .tmx === | ||
+ | ::<code>find *.po > TodoUbuntu1204.txt</code> | ||
+ | ::<code>msgcat -f TodoUbuntu1204.txt -u -o TodoUbuntu1204.po</code> | ||
+ | ::<code>po2tmx -l gl TodoUbuntu1204.po TodoUbuntu1204.tmx</code> | ||
+ | |||
+ | == Operacións complexas == | ||
+ | |||
+ | === Automatizando o proceso === | ||
+ | <pre> | ||
+ | #!/bin/sh | ||
+ | |||
+ | POdir=LC_MESSAGES | ||
+ | #POdir=PO | ||
+ | |||
+ | if [ ! -f ~/TMXMerger/TMXMerger-1.1.jar ]; then | ||
+ | echo "" | ||
+ | echo "AVISO:" | ||
+ | echo "" | ||
+ | echo "ten que obter o ficheiro TMXMerger.zip" | ||
+ | echo "e descomprimilo no seu directorio persoal" | ||
+ | echo "" | ||
+ | echo "Pode obtelo en:" | ||
+ | echo " http://www.omegat.org/en/resources.html" | ||
+ | echo "" | ||
+ | exit | ||
+ | fi | ||
+ | |||
+ | |||
+ | find $POdir/ *.po > POlist | ||
+ | sed -i "s+$POdir\/++" POlist | ||
+ | sed -i "s+.po++" POlist | ||
+ | |||
+ | [ -d TMX ] || mkdir TMX | ||
+ | |||
+ | cat POlist | while read poname | ||
+ | |||
+ | do | ||
+ | po2tmx $POdir/$poname.po -l gl TMX/$poname.tmx | ||
+ | done | ||
+ | |||
+ | [ -d TMXmerged ] || mkdir TMXmerged | ||
+ | |||
+ | java -jar ~/TMXMerger/TMXMerger-1.1.jar source=gl TMX/*.tmx TMXmerged/Total.tmx | ||
+ | </pre> |
Revision as of 18:12, 16 June 2012
Error creating thumbnail: Unable to save thumbnail to destination
castellano en el wiki de Galpon.This HowTo is available in
Error creating thumbnail: Unable to save thumbnail to destination
english in the in this wiki.
Contents
Traballo básico
Converter un só ficheiro .po a .tmx
Neste caso empregaremos as ferramentas «translate-toolkit», pare elo, se non dispomos delas, teremos que instalalas xunto coas de desenvolvemento «python» e «python-dev»
- En Debian:
apt-get install translate-toolkit python python-dev
É tan sinxelo como executar, nun terminal, a seguinte orde:
po2tmx ficheiro.po -l gl ficheiro.tmx ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ nome que terá o ficheiro «.tmx» resultante ↓ ↓ ↓ código do idioma final (ocmo parámetro da opción -l) ↓ ↓ opción (obrigatoria) para indicar o idioma final (do .tmx) ↓ nome do ficheiro «.po» orixinal orde de conversión po a(to) tmx
Converter varios ficheiros .po a un só ficheiro .tmx
find *.po > TodoUbuntu1204.txt
msgcat -f TodoUbuntu1204.txt -u -o TodoUbuntu1204.po
po2tmx -l gl TodoUbuntu1204.po TodoUbuntu1204.tmx
Operacións complexas
Automatizando o proceso
#!/bin/sh POdir=LC_MESSAGES #POdir=PO if [ ! -f ~/TMXMerger/TMXMerger-1.1.jar ]; then echo "" echo "AVISO:" echo "" echo "ten que obter o ficheiro TMXMerger.zip" echo "e descomprimilo no seu directorio persoal" echo "" echo "Pode obtelo en:" echo " http://www.omegat.org/en/resources.html" echo "" exit fi find $POdir/ *.po > POlist sed -i "s+$POdir\/++" POlist sed -i "s+.po++" POlist [ -d TMX ] || mkdir TMX cat POlist | while read poname do po2tmx $POdir/$poname.po -l gl TMX/$poname.tmx done [ -d TMXmerged ] || mkdir TMXmerged java -jar ~/TMXMerger/TMXMerger-1.1.jar source=gl TMX/*.tmx TMXmerged/Total.tmx