GNU Info

Info Node: (gettext.info)Modifying Translations

(gettext.info)Modifying Translations


Next: Modifying Comments Prev: Obsolete Entries Up: Updating
Enter node , (file) or (file)node

Modifying Translations
======================

   PO mode prevents direct edition of the PO file, by the usual means
Emacs give for altering a buffer's contents.  By doing so, it pretends
helping the translator to avoid little clerical errors about the
overall file format, or the proper quoting of strings, as those errors
would be easily made.  Other kinds of errors are still possible, but
some may be caught and diagnosed by the batch validation process, which
the translator may always trigger by the `V' command.  For all other
errors, the translator has to rely on her own judgment, and also on the
linguistic reports submitted to her by the users of the translated
package, having the same mother tongue.

   When the time comes to create a translation, correct an error
diagnosed mechanically or reported by a user, the translators have to
resort to using the following commands for modifying the translations.

`<RET>'
     Interactively edit the translation.

`<LFD>'
     Reinitialize the translation with the original, untranslated
     string.

`k'
     Save the translation on the kill ring, and delete it.

`w'
     Save the translation on the kill ring, without deleting it.

`y'
     Replace the translation, taking the new from the kill ring.

   The command `<RET>' (`po-edit-msgstr') opens a new Emacs window
meant to edit in a new translation, or to modify an already existing
translation.  The new window contains a copy of the translation taken
from the current PO file entry, all ready for edition, expunged of all
quoting marks, fully modifiable and with the complete extent of Emacs
modifying commands.  When the translator is done with her
modifications, she may use `C-c C-c' to close the subedit window with
the automatically requoted results, or `C-c C-k' to abort her
modifications.  Note: Subedit, for more information.

   The command `<LFD>' (`po-msgid-to-msgstr') initializes, or
reinitializes the translation with the original string.  This command is
normally used when the translator wants to redo a fresh translation of
the original string, disregarding any previous work.

   It is possible to arrange so, whenever editing an untranslated
entry, the `<LFD>' command be automatically executed.  If you set
`po-auto-edit-with-msgid' to `t', the translation gets initialised with
the original string, in case none exists already.  The default value
for `po-auto-edit-with-msgid' is `nil'.

   In fact, whether it is best to start a translation with an empty
string, or rather with a copy of the original string, is a matter of
taste or habit.  Sometimes, the source language and the target language
are so different that is simply best to start writing on an empty page.
At other times, the source and target languages are so close that it
would be a waste to retype a number of words already being written in
the original string.  A translator may also like having the original
string right under her eyes, as she will progressively overwrite the
original text with the translation, even if this requires some extra
editing work to get rid of the original.

   The command `k' (`po-kill-msgstr') merely empties the translation
string, so turning the entry into an untranslated one.  But while doing
so, its previous contents is put apart in a special place, known as the
kill ring.  The command `w' (`po-kill-ring-save-msgstr') has also the
effect of taking a copy of the translation onto the kill ring, but it
otherwise leaves the entry alone, and does _not_ remove the translation
from the entry.  Both commands use exactly the Emacs kill ring, which
is shared between buffers, and which is well known already to Emacs
lovers.

   The translator may use `k' or `w' many times in the course of her
work, as the kill ring may hold several saved translations.  From the
kill ring, strings may later be reinserted in various Emacs buffers.
In particular, the kill ring may be used for moving translation strings
between different entries of a single PO file buffer, or if the
translator is handling many such buffers at once, even between PO files.

   To facilitate exchanges with buffers which are not in PO mode, the
translation string put on the kill ring by the `k' command is fully
unquoted before being saved: external quotes are removed, multi-line
strings are concatenated, and backslash escaped sequences are turned
into their corresponding characters.  In the special case of obsolete
entries, the translation is also uncommented prior to saving.

   The command `y' (`po-yank-msgstr') completely replaces the
translation of the current entry by a string taken from the kill ring.
Following Emacs terminology, we then say that the replacement string is
"yanked" into the PO file buffer.  Note: Yanking.  The
first time `y' is used, the translation receives the value of the most
recent addition to the kill ring.  If `y' is typed once again,
immediately, without intervening keystrokes, the translation just
inserted is taken away and replaced by the second most recent addition
to the kill ring.  By repeating `y' many times in a row, the translator
may travel along the kill ring for saved strings, until she finds the
string she really wanted.

   When a string is yanked into a PO file entry, it is fully and
automatically requoted for complying with the format PO files should
have.  Further, if the entry is obsolete, PO mode then appropriately
push the inserted string inside comments.  Once again, translators
should not burden themselves with quoting considerations besides, of
course, the necessity of the translated string itself respective to the
program using it.

   Note that `k' or `w' are not the only commands pushing strings on
the kill ring, as almost any PO mode command replacing translation
strings (or the translator comments) automatically saves the old string
on the kill ring.  The main exceptions to this general rule are the
yanking commands themselves.

   To better illustrate the operation of killing and yanking, let's use
an actual example, taken from a common situation.  When the programmer
slightly modifies some string right in the program, his change is later
reflected in the PO file by the appearance of a new untranslated entry
for the modified string, and the fact that the entry translating the
original or unmodified string becomes obsolete.  In many cases, the
translator might spare herself some work by retrieving the unmodified
translation from the obsolete entry, then initializing the untranslated
entry `msgstr' field with this retrieved translation.  Once this done,
the obsolete entry is not wanted anymore, and may be safely deleted.

   When the translator finds an untranslated entry and suspects that a
slight variant of the translation exists, she immediately uses `m' to
mark the current entry location, then starts chasing obsolete entries
with `o', hoping to find some translation corresponding to the
unmodified string.  Once found, she uses the `<DEL>' command for
deleting the obsolete entry, knowing that `<DEL>' also _kills_ the
translation, that is, pushes the translation on the kill ring.  Then,
`r' returns to the initial untranslated entry, and `y' then _yanks_ the
saved translation right into the `msgstr' field.  The translator is
then free to use `<RET>' for fine tuning the translation contents, and
maybe to later use `u', then `m' again, for going on with the next
untranslated string.

   When some sequence of keys has to be typed over and over again, the
translator may find it useful to become better acquainted with the Emacs
capability of learning these sequences and playing them back under
request.  Note: Keyboard Macros.


automatically generated by info2www version 1.2.2.9