po4av0.73

LOCALE::PO4A::TEX.3PM

Section: User Contributed Perl Documentation (1)
Updated: 2024-06-17
Index Return to Main Contents
 

NOM

Locale::Po4a::TeX - convert TeX documents and derivatives from/to PO files  

DESCRIPCIÓ

L'objectiu del projecte po4a (PO per a tot) és facilitar la traducció (i sobretot el manteniment de les traduccions) utilitzant les eines de gettext en àrees on no eren d'esperar, com ara en la documentació.

Locale::Po4a::TeX és un mòdul per ajudar en la traducció de documents TeX a altres llenguatges [humans]. També es pot utilitzar com a base per construir mòduls per documents basats en TeX.

Users should probably use the LaTeX module, which inherits from the TeX module and contains the definitions of common LaTeX commands.  

TRADUINT AMB PO4A::TEX

Aquest mòdul es pot utilitzar directament per tractar documents TeX genèrics. Aquest partirà el document en blocs més petits (paràgrafs, blocs literals, o fins i tot més petits, com ara títols o índexs).

There are some options (described in the next section) that can customize this behavior. If this doesn't fit to your document format you're encouraged to write your own derivative module from this, to describe your format's details. See the section WRITING DERIVATIVE MODULES below, for the process description.

This module can also be customized by lines starting with "% po4a:" in the TeX file. This process is described in the INLINE CUSTOMIZATION section.  

OPCIONS QUE ACCEPTA AQUEST MÒDUL

Aquestes són les opcions particulars d'aquest mòdul:
debug
Activa la depuració d'alguns mecanismes interns d'aquest mòdul. Mireu el codi per veure quines parts es poden depurar.
no_wrap
Llista separada per comes dels entorns, els paràmetres dels quals no s'han de justificar.

Tingueu en compte que els entorns verbatim i no_wrap són diferents. En els blocs verbatim no s'analitzen les comandes ni els comentaris.

If this environment was not already registered, po4a will consider that this environment does not take any parameters.

exclude_include
Llista separada per dos punts dels fitxers que no s'han d'incloure amb \input i \include.
definitions
The name of a file containing definitions for po4a, as defined in the INLINE CUSTOMIZATION section. You can use this option if it is not possible to put the definitions in the document being translated.
verbatim
Comma-separated list of environments which should be taken as verbatim.

If this environment was not already registered, po4a will consider that this environment does not take any parameters.

Use these options to override the default behavior of the defined commands.  

PERSONALITZACIÓ INCRUSTADA

El mòdul TeX es pot personalitzar amb línies que comencin amb % po4a:. Aquestes línies s'interpreten com a comandes per l'analitzador. Es reconeixen les següents comandes:
% po4a: command comanda1 alias comanda2
Indica que els paràmetres de la comanda1 s'han de tractar com els paràmetres de la comanda2.
% po4a: command comanda1 funció1
This describes in detail the parameters of the command1 command. This information will be used to check the number of arguments and their types.

You can precede the command1 command by

an asterisk (*)
po4a will extract this command from paragraphs (if it is located at the beginning or the end of a paragraph). The translators will then have to translate the parameters that are marked as translatable.
a plus (+)
As for an asterisk, the command will be extracted if it appear at an extremity of a block, but the parameters won't be translated separately. The translator will have to translate the command concatenated to all its parameters. This keeps more context, and is useful for commands with small words in parameter, which can have multiple meanings (and translations).

Note: In this case you don't have to specify which parameters are translatable, but po4a must know the type and number of parameters.

a minus (-)
In this case, the command won't be extracted from any block. But if it appears alone on a block, then only the parameters marked as translatable will be presented to the translator. This is useful for font commands. These commands should generally not be separated from their paragraph (to keep the context), but there is no reason to annoy the translator with them if a whole string is enclosed in such a command.

The parameters argument is a set of [] (to indicate an optional argument) or {} (to indicate a mandatory argument). You can place an underscore (_) between these brackets to indicate that the parameter must be translated. For example:
 % po4a: command *chapter [_]{_}

This indicates that the chapter command has two parameters: an optional (short title) and a mandatory one, which must both be translated. If you want to specify that the href command has two mandatory parameters, that you don't want to translate the URL (first parameter), and that you don't want this command to be separated from its paragraph (which allow the translator to move the link in the sentence), you can use:
 % po4a: command -href {}{_}

In this case, the information indicating which arguments must be translated is only used if a paragraph is only composed of this href command.

% po4a: environment ent1 funció1
This defines the parameters accepted by the env environment and specifies the ones to be translated. This information is later used to check the number of arguments of the \begin command. The syntax of the parameters argument is the same as described for the others commands. The first parameter of the \begin command is the name of the environment. This parameter must not be specified in the list of parameters. Here are some examples:
 % po4a: environment multicols {}
 % po4a: environment equation

As for the commands, env can be preceded by a plus (+) to indicate that the \begin command must be translated with all its arguments.

% po4a: separator env "regex"
Indicates that an environment should be split according to the given regular expression.

The regular expression is delimited by quotes. It should not create any back-reference. You should use (?:) if you need a group. It may also need some escapes.

For example, the LaTeX module uses the "(?:&|\\\\)" regular expression to translate separately each cell of a table (lines are separated by '\\' and cells by '&').

The notion of environment is expanded to the type displayed in the PO file. This can be used to split on "\\\\" in the first mandatory argument of the title command. In this case, the environment is title{#1}.

% po4a: verbatim environment ent1
Indicate that env is a verbatim environment. Comments and commands will be ignored in this environment.

If this environment was not already registered, po4a will consider that this environment does not take any parameters.

 

ESCRIVINT MÒDULS DERIVATS

pre_trans
post_trans
add_comment
Add a string as a comment to be added around the next translated element. This is mostly useful to the texinfo module, as comments are automatically handled in TeX.
translate
Crida la funció translate del Transtractor, amb filtres de pre- i post-processat.

Els comentaris d'un paràgraf s'inserten com a comentaris del PO en la primera cadena traduïble del paràgraf.

get_leading_command($buffer)
Aquesta funció retorna:
Un nom de comanda
If no command is found at the beginning of the given buffer, this string will be empty. Only commands that can be separated are considered. The %separated_command hash contains the list of these commands.
Una variant
This indicates if a variant is used. For example, an asterisk (*) can be added at the end of sections command to specify that they should not be numbered. In this case, this field will contain "*". If there is no variant, the field is an empty string.
An array of tuples (type of argument, argument)
The type of argument can be either '{' (for mandatory arguments) or '[' (for optional arguments).
El buffer restant
La resta del buffer, després de l'eliminació de la comanda inicial i els seus paràmetres. Si no es troba la comanda, no es toca el buffer original i es retorna en aquest camp.
get_trailing_command($buffer)
El mateix que get_leading_command, però per comandes al final del buffer.
translate_buffer
Tradueix un buffer recursivament separant del buffer les comandes inicials i finals (aquelles que s'han de traduir per separat).

If a function is defined in %translate_buffer_env for the current environment, this function will be used to translate the buffer instead of translate_buffer().

read
Overloads Transtractor's read().
read_file
Recursively read a file, appending included files which are not listed in the @exclude_include array. Included files are searched using the kpsewhich command from the Kpathsea library.

A part de la part d'inclusió de fitxers, és una còpia del read del Transtractor.

parse_definition_file
Subrutina per analitzar un fitxer amb directives po4a (definicions de noves comandes).
parse_definition_line
Analitza una línia de definició de la forma "% po4a: ".

Consulteu la secció PERSONALITZACIÓ INCRUSTADA per a més detalls.

is_closed
parse
docheader
 

INTERNAL FUNCTIONS used to write derivative parsers

Les funcions de comandes i d'entorns prenen els següents paràmetres (a més de l'objecte $self):
Un nom de comanda
Una variant
An array of (type, argument) tuples
L'entorn actual

The first 3 arguments are extracted by get_leading_command or get_trailing_command.

Les funcions de comandes i d'entorns retornen la traducció de la comanda amb els seus paràmetres i un nou entorn.

Les funcions d'entorn es criden quan es troba una comanda \begin. Es criden amb la comanda \begin i els seus paràmetres.

The TeX module only proposes one command function and one environment function: generic_command and generic_environment.

generic_command uses the information specified by register_generic_command or by adding definition to the TeX file:
 % po4a: command command1 parameters

generic_environment uses the information specified by register_generic_environment or by adding definition to the TeX file:
 % po4a: environment env parameters

Both functions will only translate the parameters that were specified as translatable (with a '_'). generic_environment will append the name of the environment to the environment stack and generic_command will append the name of the command followed by an identifier of the parameter (like {#7} or [#2]).  

ESTAT D'AQUEST MÒDUL

Aquest mòdul necessita més proves.

S'ha provat amb un llibre i amb la documentació de Python.  

LLISTA DE TASQUES PENDENTS

Automatic detection of new commands
The TeX module could parse the newcommand arguments and try to guess the number of arguments, their type and whether or not they should be translated.
Translation of the environment separator
When \item is used as an environment separator, the item argument is attached to the following string.
Some commands should be added to the environment stack
These commands should be specified by couples. This can be used to specify commands beginning or ending a verbatim environment.
Altres
Hi ha altres punts marcats TODO en el codi.
 

BUGS CONEGUTS

Various points are tagged FIXME in the source.  

CONSULTEU TAMBÉ

Locale::Po4a::LaTeX(3pm), Locale::Po4a::TransTractor(3pm), po4a(7)  

AUTORS

 Nicolas François <nicolas.francois@centraliens.net>

 

TRADUCCIÓ

 Carme Cirera <menxu@hotmail.com>
 Jordi Vilalta <jvprat@gmail.com>

 

DRET DE CÒPIA I LLICÈNCIA

Copyright © 2004, 2005 Nicolas FRANÇOIS <nicolas.francois@centraliens.net>.

This program is free software; you may redistribute it and/or modify it under the terms of GPL v2.0 or later (see the COPYING file).


 

Index

NOM
DESCRIPCIÓ
TRADUINT AMB PO4A::TEX
OPCIONS QUE ACCEPTA AQUEST MÒDUL
PERSONALITZACIÓ INCRUSTADA
ESCRIVINT MÒDULS DERIVATS
INTERNAL FUNCTIONS used to write derivative parsers
ESTAT D'AQUEST MÒDUL
LLISTA DE TASQUES PENDENTS
BUGS CONEGUTS
CONSULTEU TAMBÉ
AUTORS
TRADUCCIÓ
DRET DE CÒPIA I LLICÈNCIA

This document was created by using the manual pages.
Time: 20:30:43 GMT, June 17, 2024
català Deutsch English Esperanto español français hrvatski Magyar Italiano 日本語 Bokmål Nederlands polski Português Português (Brasil) Русский српски језик српски језик український 简体中文 简体中文 (how to set the default document language)