GNU Gettext Tools, Version 0.21 Native Language Support Library and Tools Edition 0.21, 26 July 2020
Total Page:16
File Type:pdf, Size:1020Kb
GNU gettext tools, version 0.21 Native Language Support Library and Tools Edition 0.21, 26 July 2020 Ulrich Drepper Jim Meyering Fran¸coisPinard Bruno Haible Copyright (C) 1995-1998, 2001-2020 Free Software Foundation, Inc. This manual is free documentation. It is dually licensed under the GNU FDL and the GNU GPL. This means that you can redistribute this manual under either of these two licenses, at your choice. This manual is covered by the GNU FDL. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License (FDL), either version 1.2 of the License, or (at your option) any later version published by the Free Software Foundation (FSF); with no Invariant Sections, with no Front-Cover Text, and with no Back-Cover Texts. A copy of the license is included in Section C.3 [GNU FDL], page 267. This manual is covered by the GNU GPL. You can redistribute it and/or modify it under the terms of the GNU General Public License (GPL), either version 2 of the License, or (at your option) any later version published by the Free Software Foundation (FSF). A copy of the license is included in Section C.1 [GNU GPL], page 252. i Table of Contents 1 Introduction::::::::::::::::::::::::::::::::::::: 1 1.1 The Purpose of GNU gettext:::::::::::::::::::::::::::::::::: 1 1.2 I18n, L10n, and Such::::::::::::::::::::::::::::::::::::::::::: 2 1.3 Aspects in Native Language Support ::::::::::::::::::::::::::: 3 1.4 Files Conveying Translations ::::::::::::::::::::::::::::::::::: 5 1.5 Overview of GNU gettext ::::::::::::::::::::::::::::::::::::: 5 2 The User's View :::::::::::::::::::::::::::::::: 9 2.1 Operating System Installation :::::::::::::::::::::::::::::::::: 9 2.2 Setting the Locale Used by GUI Programs :::::::::::::::::::::: 9 2.3 Setting the Locale through Environment Variables ::::::::::::: 10 2.3.1 Locale Names :::::::::::::::::::::::::::::::::::::::::::: 10 2.3.2 Locale Environment Variables :::::::::::::::::::::::::::: 10 2.3.3 Specifying a Priority List of Languages ::::::::::::::::::: 11 2.4 Obtaining good output in a Windows console :::::::::::::::::: 12 2.5 Installing Translations for Particular Programs :::::::::::::::: 12 3 The Format of PO Files::::::::::::::::::::::: 13 4 Preparing Program Sources :::::::::::::::::: 19 4.1 Importing the gettext declaration :::::::::::::::::::::::::::: 19 4.2 Triggering gettext Operations :::::::::::::::::::::::::::::::: 19 4.3 Preparing Translatable Strings :::::::::::::::::::::::::::::::: 20 4.4 How Marks Appear in Sources :::::::::::::::::::::::::::::::: 24 4.5 Marking Translatable Strings:::::::::::::::::::::::::::::::::: 25 4.6 Special Comments preceding Keywords :::::::::::::::::::::::: 27 4.7 Special Cases of Translatable Strings :::::::::::::::::::::::::: 28 4.8 Letting Users Report Translation Bugs :::::::::::::::::::::::: 30 4.9 Marking Proper Names for Translation :::::::::::::::::::::::: 31 4.10 Preparing Library Sources ::::::::::::::::::::::::::::::::::: 32 5 Making the PO Template File:::::::::::::::: 34 5.1 Invoking the xgettext Program ::::::::::::::::::::::::::::::: 34 5.1.1 Input file location :::::::::::::::::::::::::::::::::::::::: 34 5.1.2 Output file location :::::::::::::::::::::::::::::::::::::: 34 5.1.3 Choice of input file language:::::::::::::::::::::::::::::: 35 5.1.4 Input file interpretation :::::::::::::::::::::::::::::::::: 35 5.1.5 Operation mode:::::::::::::::::::::::::::::::::::::::::: 35 5.1.6 Language specific options::::::::::::::::::::::::::::::::: 36 5.1.7 Output details ::::::::::::::::::::::::::::::::::::::::::: 39 5.1.8 Informative output ::::::::::::::::::::::::::::::::::::::: 42 ii 6 Creating a New PO File :::::::::::::::::::::: 43 6.1 Invoking the msginit Program :::::::::::::::::::::::::::::::: 43 6.1.1 Input file location :::::::::::::::::::::::::::::::::::::::: 44 6.1.2 Output file location :::::::::::::::::::::::::::::::::::::: 44 6.1.3 Input file syntax ::::::::::::::::::::::::::::::::::::::::: 44 6.1.4 Output details ::::::::::::::::::::::::::::::::::::::::::: 44 6.1.5 Informative output ::::::::::::::::::::::::::::::::::::::: 45 6.2 Filling in the Header Entry:::::::::::::::::::::::::::::::::::: 45 7 Updating Existing PO Files :::::::::::::::::: 49 7.1 Invoking the msgmerge Program ::::::::::::::::::::::::::::::: 49 7.1.1 Input file location :::::::::::::::::::::::::::::::::::::::: 49 7.1.2 Operation mode:::::::::::::::::::::::::::::::::::::::::: 49 7.1.3 Output file location :::::::::::::::::::::::::::::::::::::: 49 7.1.4 Output file location in update mode :::::::::::::::::::::: 49 7.1.5 Operation modifiers :::::::::::::::::::::::::::::::::::::: 50 7.1.6 Input file syntax ::::::::::::::::::::::::::::::::::::::::: 50 7.1.7 Output details ::::::::::::::::::::::::::::::::::::::::::: 51 7.1.8 Informative output ::::::::::::::::::::::::::::::::::::::: 52 8 Editing PO Files::::::::::::::::::::::::::::::: 53 8.1 KDE's PO File Editor :::::::::::::::::::::::::::::::::::::::: 53 8.2 GNOME's PO File Editor::::::::::::::::::::::::::::::::::::: 53 8.3 Emacs's PO File Editor ::::::::::::::::::::::::::::::::::::::: 53 8.3.1 Completing GNU gettext Installation ::::::::::::::::::: 53 8.3.2 Main PO mode Commands ::::::::::::::::::::::::::::::: 54 8.3.3 Entry Positioning :::::::::::::::::::::::::::::::::::::::: 55 8.3.4 Normalizing Strings in Entries :::::::::::::::::::::::::::: 57 8.3.5 Translated Entries:::::::::::::::::::::::::::::::::::::::: 58 8.3.6 Fuzzy Entries :::::::::::::::::::::::::::::::::::::::::::: 58 8.3.7 Untranslated Entries ::::::::::::::::::::::::::::::::::::: 59 8.3.8 Obsolete Entries ::::::::::::::::::::::::::::::::::::::::: 60 8.3.9 Modifying Translations ::::::::::::::::::::::::::::::::::: 61 8.3.10 Modifying Comments ::::::::::::::::::::::::::::::::::: 63 8.3.11 Details of Sub Edition::::::::::::::::::::::::::::::::::: 64 8.3.12 C Sources Context :::::::::::::::::::::::::::::::::::::: 66 8.3.13 Consulting Auxiliary PO Files::::::::::::::::::::::::::: 67 8.4 Using Translation Compendia ::::::::::::::::::::::::::::::::: 68 8.4.1 Creating Compendia ::::::::::::::::::::::::::::::::::::: 68 8.4.1.1 Concatenate PO Files ::::::::::::::::::::::::::::::: 68 8.4.1.2 Extract a Message Subset from a PO File :::::::::::: 69 8.4.2 Using Compendia :::::::::::::::::::::::::::::::::::::::: 69 8.4.2.1 Initialize a New Translation File ::::::::::::::::::::: 69 8.4.2.2 Update an Existing Translation File ::::::::::::::::: 69 iii 9 Manipulating PO Files :::::::::::::::::::::::: 70 9.1 Invoking the msgcat Program ::::::::::::::::::::::::::::::::: 71 9.1.1 Input file location :::::::::::::::::::::::::::::::::::::::: 71 9.1.2 Output file location :::::::::::::::::::::::::::::::::::::: 71 9.1.3 Message selection :::::::::::::::::::::::::::::::::::::::: 71 9.1.4 Input file syntax ::::::::::::::::::::::::::::::::::::::::: 72 9.1.5 Output details ::::::::::::::::::::::::::::::::::::::::::: 72 9.1.6 Informative output ::::::::::::::::::::::::::::::::::::::: 73 9.2 Invoking the msgconv Program :::::::::::::::::::::::::::::::: 73 9.2.1 Input file location :::::::::::::::::::::::::::::::::::::::: 73 9.2.2 Output file location :::::::::::::::::::::::::::::::::::::: 74 9.2.3 Conversion target :::::::::::::::::::::::::::::::::::::::: 74 9.2.4 Input file syntax ::::::::::::::::::::::::::::::::::::::::: 74 9.2.5 Output details ::::::::::::::::::::::::::::::::::::::::::: 74 9.2.6 Informative output ::::::::::::::::::::::::::::::::::::::: 75 9.3 Invoking the msggrep Program :::::::::::::::::::::::::::::::: 76 9.3.1 Input file location :::::::::::::::::::::::::::::::::::::::: 76 9.3.2 Output file location :::::::::::::::::::::::::::::::::::::: 76 9.3.3 Message selection :::::::::::::::::::::::::::::::::::::::: 76 9.3.4 Input file syntax ::::::::::::::::::::::::::::::::::::::::: 77 9.3.5 Output details ::::::::::::::::::::::::::::::::::::::::::: 78 9.3.6 Informative output ::::::::::::::::::::::::::::::::::::::: 79 9.3.7 Examples :::::::::::::::::::::::::::::::::::::::::::::::: 79 9.4 Invoking the msgfilter Program:::::::::::::::::::::::::::::: 79 9.4.1 Input file location :::::::::::::::::::::::::::::::::::::::: 80 9.4.2 Output file location :::::::::::::::::::::::::::::::::::::: 80 9.4.3 The filter :::::::::::::::::::::::::::::::::::::::::::::::: 80 9.4.4 Useful filter-options when the filter is `sed' ::::::::::::::: 80 9.4.5 Built-in filters:::::::::::::::::::::::::::::::::::::::::::: 81 9.4.6 Input file syntax ::::::::::::::::::::::::::::::::::::::::: 81 9.4.7 Output details ::::::::::::::::::::::::::::::::::::::::::: 81 9.4.8 Informative output ::::::::::::::::::::::::::::::::::::::: 82 9.4.9 Examples :::::::::::::::::::::::::::::::::::::::::::::::: 83 9.5 Invoking the msguniq Program :::::::::::::::::::::::::::::::: 83 9.5.1 Input file location :::::::::::::::::::::::::::::::::::::::: 83 9.5.2 Output file location :::::::::::::::::::::::::::::::::::::: 83 9.5.3 Message selection :::::::::::::::::::::::::::::::::::::::: 83 9.5.4 Input file syntax ::::::::::::::::::::::::::::::::::::::::: 84 9.5.5 Output details ::::::::::::::::::::::::::::::::::::::::::: 84 9.5.6 Informative output ::::::::::::::::::::::::::::::::::::::: 85 9.6 Invoking the msgcomm Program :::::::::::::::::::::::::::::::: 85 9.6.1 Input file location :::::::::::::::::::::::::::::::::::::::: 85 9.6.2 Output file location :::::::::::::::::::::::::::::::::::::: 86 9.6.3 Message selection :::::::::::::::::::::::::::::::::::::::: 86 9.6.4 Input file syntax ::::::::::::::::::::::::::::::::::::::::: 86 9.6.5 Output details :::::::::::::::::::::::::::::::::::::::::::