On 2012/9/24 Carsten Gerlach wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello po4a dev team,
I have a question about po4a-gettextize and I hope I’m right here on
the dev list with my normal user question. :-)
I’m a member of the Ubuntu Manual team [1] and we use po4a for
managing the translation of the manual. We use XeLaTeX for writing the
manual and so we have to deal with some tex commands in the
translation pot file.
Ok, I have a small example document to illustrate my question:
======minimal.tex=============================================
\documentclass{article}
\newcommand{\mycommand}{foo bar}
\begin{document}
\tableofcontents
\section{Hello World!}
\mycommand
\end{document}
==============================================================
If I now use po4a-gettextize to create a pot file
$ po4a-gettextize -f latex -m minimal.tex -p minimal.pot
I get the following output
======minimal.pot=============================================
[... header of pot file]
#. type: newcommand{#4}
#: minimal.tex:7
msgid "foo bar"
msgstr ""
#. type: section{#2}
#: minimal.tex:7
msgid "Hello World!"
msgstr ""
#. type: document
#: minimal.tex:7
msgid "\\mycommand"
msgstr ""
==============================================================
I see, that all known LaTeX commands are ignored by po4a (like
\tableofcontents) and only the real content which need a translation
is there.
So, how can I teach po4a with my own commands which should be ignored
by po4a (like \mycommand)?
I found the definition file of all latex commands
(/usr/share/perl5/Locale/Po4a/LaTeX.pm) and I had a look to the man
page of po4a-gettextize. But I do not see a possibility to give my own
definition file to the po4a run like something like that:
$ po4a-gettextize -f latex -m minimal.tex -p minimal.pot
- -use_my_file_with_ignored_commands
I would be glad if you can show me how to make this or point me to the
paragraph in the documentation which I did not yet find.
Hello Carsten,
Locale::Po4a::LaTeX(3) refers to Locale::Po4a::TeX(3) which give some
clues: you have to run
po4a-gettextize -f latex -m minimal.tex -p minimal.pot -o
definitions=commands.po4a
after creating a commands.po4a file containing this line:
% po4a: command *mycommand
You should be able to create your own file by reading LaTeX.pm and
making your own experiments.
Denis