(gettext.info)Main PO Commands
Main PO mode Commands ===================== After setting up Emacs with something similar to the lines in Note: Installation, PO mode is activated for a window when Emacs finds a PO file in that window. This puts the window read-only and establishes a po-mode-map, which is a genuine Emacs mode, in a way that is not derived from text mode in any way. Functions found on `po-mode-hook', if any, will be executed. When PO mode is active in a window, the letters `PO' appear in the mode line for that window. The mode line also displays how many entries of each kind are held in the PO file. For example, the string `132t+3f+10u+2o' would tell the translator that the PO mode contains 132 translated entries (Note: Translated Entries, 3 fuzzy entries (Note: Fuzzy Entries), 10 untranslated entries (Note: Untranslated Entries) and 2 obsolete entries (Note: Obsolete Entries). Zero-coefficients items are not shown. So, in this example, if the fuzzy entries were unfuzzied, the untranslated entries were translated and the obsolete entries were deleted, the mode line would merely display `145t' for the counters. The main PO commands are those which do not fit into the other categories of subsequent sections. These allow for quitting PO mode or for managing windows in special ways. `U' Undo last modification to the PO file. `Q' Quit processing and save the PO file. `q' Quit processing, possibly after confirmation. `O' Temporary leave the PO file window. `?' `h' Show help about PO mode. `=' Give some PO file statistics. `V' Batch validate the format of the whole PO file. The command `U' (`po-undo') interfaces to the Emacs _undo_ facility. Note: Undoing Changes. Each time `U' is typed, modifications which the translator did to the PO file are undone a little more. For the purpose of undoing, each PO mode command is atomic. This is especially true for the `<RET>' command: the whole edition made by using a single use of this command is undone at once, even if the edition itself implied several actions. However, while in the editing window, one can undo the edition work quite parsimoniously. The commands `Q' (`po-quit') and `q' (`po-confirm-and-quit') are used when the translator is done with the PO file. The former is a bit less verbose than the latter. If the file has been modified, it is saved to disk first. In both cases, and prior to all this, the commands check if some untranslated message remains in the PO file and, if yes, the translator is asked if she really wants to leave off working with this PO file. This is the preferred way of getting rid of an Emacs PO file buffer. Merely killing it through the usual command `C-x k' (`kill-buffer') is not the tidiest way to proceed. The command `O' (`po-other-window') is another, softer way, to leave PO mode, temporarily. It just moves the cursor to some other Emacs window, and pops one if necessary. For example, if the translator just got PO mode to show some source context in some other, she might discover some apparent bug in the program source that needs correction. This command allows the translator to change sex, become a programmer, and have the cursor right into the window containing the program she (or rather _he_) wants to modify. By later getting the cursor back in the PO file window, or by asking Emacs to edit this file once again, PO mode is then recovered. The command `h' (`po-help') displays a summary of all available PO mode commands. The translator should then type any character to resume normal PO mode operations. The command `?' has the same effect as `h'. The command `=' (`po-statistics') computes the total number of entries in the PO file, the ordinal of the current entry (counted from 1), the number of untranslated entries, the number of obsolete entries, and displays all these numbers. The command `V' (`po-validate') launches `msgfmt' in verbose mode over the current PO file. This command first offers to save the current PO file on disk. The `msgfmt' tool, from GNU `gettext', has the purpose of creating a MO file out of a PO file, and PO mode uses the features of this program for checking the overall format of a PO file, as well as all individual entries. The program `msgfmt' runs asynchronously with Emacs, so the translator regains control immediately while her PO file is being studied. Error output is collected in the Emacs `*compilation*' buffer, displayed in another window. The regular Emacs command `C-x`' (`next-error'), as well as other usual compile commands, allow the translator to reposition quickly to the offending parts of the PO file. Once the cursor is on the line in error, the translator may decide on any PO mode action which would help correcting the error.