1 This is gettext.info, produced by makeinfo version 4.8 from
4 INFO-DIR-SECTION GNU Gettext Utilities
6 * gettext: (gettext). GNU gettext utilities.
7 * autopoint: (gettext)autopoint Invocation. Copy gettext infrastructure.
8 * envsubst: (gettext)envsubst Invocation. Expand environment variables.
9 * gettextize: (gettext)gettextize Invocation. Prepare a package for gettext.
10 * msgattrib: (gettext)msgattrib Invocation. Select part of a PO file.
11 * msgcat: (gettext)msgcat Invocation. Combine several PO files.
12 * msgcmp: (gettext)msgcmp Invocation. Compare a PO file and template.
13 * msgcomm: (gettext)msgcomm Invocation. Match two PO files.
14 * msgconv: (gettext)msgconv Invocation. Convert PO file to encoding.
15 * msgen: (gettext)msgen Invocation. Create an English PO file.
16 * msgexec: (gettext)msgexec Invocation. Process a PO file.
17 * msgfilter: (gettext)msgfilter Invocation. Pipe a PO file through a filter.
18 * msgfmt: (gettext)msgfmt Invocation. Make MO files out of PO files.
19 * msggrep: (gettext)msggrep Invocation. Select part of a PO file.
20 * msginit: (gettext)msginit Invocation. Create a fresh PO file.
21 * msgmerge: (gettext)msgmerge Invocation. Update a PO file from template.
22 * msgunfmt: (gettext)msgunfmt Invocation. Uncompile MO file into PO file.
23 * msguniq: (gettext)msguniq Invocation. Unify duplicates for PO file.
24 * ngettext: (gettext)ngettext Invocation. Translate a message with plural.
25 * xgettext: (gettext)xgettext Invocation. Extract strings into a PO file.
26 * ISO639: (gettext)Language Codes. ISO 639 language codes.
27 * ISO3166: (gettext)Country Codes. ISO 3166 country codes.
30 This file provides documentation for GNU `gettext' utilities. It
31 also serves as a reference for the free Translation Project.
33 Copyright (C) 1995-1998, 2001-2005 Free Software Foundation, Inc.
35 Permission is granted to make and distribute verbatim copies of this
36 manual provided the copyright notice and this permission notice are
37 preserved on all copies.
39 Permission is granted to copy and distribute modified versions of
40 this manual under the conditions for verbatim copying, provided that
41 the entire resulting derived work is distributed under the terms of a
42 permission notice identical to this one.
44 Permission is granted to copy and distribute translations of this
45 manual into another language, under the above conditions for modified
46 versions, except that this permission notice may be stated in a
47 translation approved by the Foundation.
50 File: gettext.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
52 GNU `gettext' utilities
53 ***********************
55 This manual documents the GNU gettext tools and the GNU libintl library,
60 * Introduction:: Introduction
61 * Basics:: PO Files and PO Mode Basics
62 * Sources:: Preparing Program Sources
63 * Template:: Making the PO Template File
64 * Creating:: Creating a New PO File
65 * Updating:: Updating Existing PO Files
66 * Manipulating:: Manipulating PO Files
67 * Binaries:: Producing Binary MO Files
68 * Users:: The User's View
69 * Programmers:: The Programmer's View
70 * Translators:: The Translator's View
71 * Maintainers:: The Maintainer's View
72 * Programming Languages:: Other Programming Languages
73 * Conclusion:: Concluding Remarks
75 * Language Codes:: ISO 639 language codes
76 * Country Codes:: ISO 3166 country codes
78 * Program Index:: Index of Programs
79 * Option Index:: Index of Command-Line Options
80 * Variable Index:: Index of Environment Variables
81 * PO Mode Index:: Index of Emacs PO Mode Commands
82 * Autoconf Macro Index:: Index of Autoconf Macros
83 * Index:: General Index
85 --- The Detailed Node Listing ---
89 * Why:: The Purpose of GNU `gettext'
90 * Concepts:: I18n, L10n, and Such
91 * Aspects:: Aspects in Native Language Support
92 * Files:: Files Conveying Translations
93 * Overview:: Overview of GNU `gettext'
95 PO Files and PO Mode Basics
97 * Installation:: Completing GNU `gettext' Installation
98 * PO Files:: The Format of PO Files
99 * Main PO Commands:: Main Commands
100 * Entry Positioning:: Entry Positioning
101 * Normalizing:: Normalizing Strings in Entries
103 Preparing Program Sources
105 * Triggering:: Triggering `gettext' Operations
106 * Preparing Strings:: Preparing Translatable Strings
107 * Mark Keywords:: How Marks Appear in Sources
108 * Marking:: Marking Translatable Strings
109 * c-format Flag:: Telling something about the following string
110 * Special cases:: Special Cases of Translatable Strings
111 * Names:: Marking Proper Names for Translation
112 * Libraries:: Preparing Library Sources
114 Making the PO Template File
116 * xgettext Invocation:: Invoking the `xgettext' Program
118 Creating a New PO File
120 * msginit Invocation:: Invoking the `msginit' Program
121 * Header Entry:: Filling in the Header Entry
123 Updating Existing PO Files
125 * msgmerge Invocation:: Invoking the `msgmerge' Program
126 * Translated Entries:: Translated Entries
127 * Fuzzy Entries:: Fuzzy Entries
128 * Untranslated Entries:: Untranslated Entries
129 * Obsolete Entries:: Obsolete Entries
130 * Modifying Translations:: Modifying Translations
131 * Modifying Comments:: Modifying Comments
132 * Subedit:: Mode for Editing Translations
133 * C Sources Context:: C Sources Context
134 * Auxiliary:: Consulting Auxiliary PO Files
135 * Compendium:: Using Translation Compendia
137 Using Translation Compendia
139 * Creating Compendia:: Merging translations for later use
140 * Using Compendia:: Using older translations if they fit
142 Manipulating PO Files
144 * msgcat Invocation:: Invoking the `msgcat' Program
145 * msgconv Invocation:: Invoking the `msgconv' Program
146 * msggrep Invocation:: Invoking the `msggrep' Program
147 * msgfilter Invocation:: Invoking the `msgfilter' Program
148 * msguniq Invocation:: Invoking the `msguniq' Program
149 * msgcomm Invocation:: Invoking the `msgcomm' Program
150 * msgcmp Invocation:: Invoking the `msgcmp' Program
151 * msgattrib Invocation:: Invoking the `msgattrib' Program
152 * msgen Invocation:: Invoking the `msgen' Program
153 * msgexec Invocation:: Invoking the `msgexec' Program
154 * libgettextpo:: Writing your own programs that process PO files
156 Producing Binary MO Files
158 * msgfmt Invocation:: Invoking the `msgfmt' Program
159 * msgunfmt Invocation:: Invoking the `msgunfmt' Program
160 * MO Files:: The Format of GNU MO Files
164 * Matrix:: The Current `ABOUT-NLS' Matrix
165 * Installers:: Magic for Installers
166 * End Users:: Magic for End Users
168 The Programmer's View
170 * catgets:: About `catgets'
171 * gettext:: About `gettext'
172 * Comparison:: Comparing the two interfaces
173 * Using libintl.a:: Using libintl.a in own programs
174 * gettext grok:: Being a `gettext' grok
175 * Temp Programmers:: Temporary Notes for the Programmers Chapter
179 * Interface to catgets:: The interface
180 * Problems with catgets:: Problems with the `catgets' interface?!
184 * Interface to gettext:: The interface
185 * Ambiguities:: Solving ambiguities
186 * Locating Catalogs:: Locating message catalog files
187 * Charset conversion:: How to request conversion to Unicode
188 * Plural forms:: Additional functions for handling plurals
189 * GUI program problems:: Another technique for solving ambiguities
190 * Optimized gettext:: Optimization of the *gettext functions
192 Temporary Notes for the Programmers Chapter
194 * Temp Implementations:: Temporary - Two Possible Implementations
195 * Temp catgets:: Temporary - About `catgets'
196 * Temp WSI:: Temporary - Why a single implementation
197 * Temp Notes:: Temporary - Notes
199 The Translator's View
201 * Trans Intro 0:: Introduction 0
202 * Trans Intro 1:: Introduction 1
203 * Discussions:: Discussions
204 * Organization:: Organization
205 * Information Flow:: Information Flow
206 * Prioritizing messages:: How to find which messages to translate first
210 * Central Coordination:: Central Coordination
211 * National Teams:: National Teams
212 * Mailing Lists:: Mailing Lists
216 * Sub-Cultures:: Sub-Cultures
217 * Organizational Ideas:: Organizational Ideas
219 The Maintainer's View
221 * Flat and Non-Flat:: Flat or Non-Flat Directory Structures
222 * Prerequisites:: Prerequisite Works
223 * gettextize Invocation:: Invoking the `gettextize' Program
224 * Adjusting Files:: Files You Must Create or Alter
225 * autoconf macros:: Autoconf macros for use in `configure.in'
226 * CVS Issues:: Integrating with CVS
227 * Release Management:: Creating a Distribution Tarball
229 Files You Must Create or Alter
231 * po/POTFILES.in:: `POTFILES.in' in `po/'
232 * po/LINGUAS:: `LINGUAS' in `po/'
233 * po/Makevars:: `Makevars' in `po/'
234 * configure.in:: `configure.in' at top level
235 * config.guess:: `config.guess', `config.sub' at top level
236 * mkinstalldirs:: `mkinstalldirs' at top level
237 * aclocal:: `aclocal.m4' at top level
238 * acconfig:: `acconfig.h' at top level
239 * config.h.in:: `config.h.in' at top level
240 * Makefile:: `Makefile.in' at top level
241 * src/Makefile:: `Makefile.in' in `src/'
242 * lib/gettext.h:: `gettext.h' in `lib/'
244 Autoconf macros for use in `configure.in'
246 * AM_GNU_GETTEXT:: AM_GNU_GETTEXT in `gettext.m4'
247 * AM_GNU_GETTEXT_VERSION:: AM_GNU_GETTEXT_VERSION in `gettext.m4'
248 * AM_PO_SUBDIRS:: AM_PO_SUBDIRS in `po.m4'
249 * AM_ICONV:: AM_ICONV in `iconv.m4'
253 * Distributed CVS:: Avoiding version mismatch in distributed development
254 * Files under CVS:: Files to put under CVS version control
255 * autopoint Invocation:: Invoking the `autopoint' Program
257 Other Programming Languages
259 * Language Implementors:: The Language Implementor's View
260 * Programmers for other Languages:: The Programmer's View
261 * Translators for other Languages:: The Translator's View
262 * Maintainers for other Languages:: The Maintainer's View
263 * List of Programming Languages:: Individual Programming Languages
264 * List of Data Formats:: Internationalizable Data
266 The Translator's View
268 * c-format:: C Format Strings
269 * objc-format:: Objective C Format Strings
270 * sh-format:: Shell Format Strings
271 * python-format:: Python Format Strings
272 * lisp-format:: Lisp Format Strings
273 * elisp-format:: Emacs Lisp Format Strings
274 * librep-format:: librep Format Strings
275 * scheme-format:: Scheme Format Strings
276 * smalltalk-format:: Smalltalk Format Strings
277 * java-format:: Java Format Strings
278 * csharp-format:: C# Format Strings
279 * awk-format:: awk Format Strings
280 * object-pascal-format:: Object Pascal Format Strings
281 * ycp-format:: YCP Format Strings
282 * tcl-format:: Tcl Format Strings
283 * perl-format:: Perl Format Strings
284 * php-format:: PHP Format Strings
285 * gcc-internal-format:: GCC internal Format Strings
286 * qt-format:: Qt Format Strings
288 Individual Programming Languages
290 * C:: C, C++, Objective C
291 * sh:: sh - Shell Script
292 * bash:: bash - Bourne-Again Shell Script
294 * Common Lisp:: GNU clisp - Common Lisp
295 * clisp C:: GNU clisp C sources
296 * Emacs Lisp:: Emacs Lisp
298 * Scheme:: GNU guile - Scheme
299 * Smalltalk:: GNU Smalltalk
303 * Pascal:: Pascal - Free Pascal Compiler
304 * wxWindows:: wxWindows library
305 * YCP:: YCP - YaST2 scripting language
306 * Tcl:: Tcl - Tk's scripting language
308 * PHP:: PHP Hypertext Preprocessor
310 * GCC-source:: GNU Compiler Collection sources
314 * Preparing Shell Scripts:: Preparing Shell Scripts for Internationalization
315 * gettext.sh:: Contents of `gettext.sh'
316 * gettext Invocation:: Invoking the `gettext' program
317 * ngettext Invocation:: Invoking the `ngettext' program
318 * envsubst Invocation:: Invoking the `envsubst' program
319 * eval_gettext Invocation:: Invoking the `eval_gettext' function
320 * eval_ngettext Invocation:: Invoking the `eval_ngettext' function
324 * General Problems:: General Problems Parsing Perl Code
325 * Default Keywords:: Which Keywords Will xgettext Look For?
326 * Special Keywords:: How to Extract Hash Keys
327 * Quote-like Expressions:: What are Strings And Quote-like Expressions?
328 * Interpolation I:: Invalid String Interpolation
329 * Interpolation II:: Valid String Interpolation
330 * Parentheses:: When To Use Parentheses
331 * Long Lines:: How To Grok with Long Lines
332 * Perl Pitfalls:: Bugs, Pitfalls, and Things That Do Not Work
334 Internationalizable Data
336 * POT:: POT - Portable Object Template
337 * RST:: Resource String Table
338 * Glade:: Glade - GNOME user interface description
342 * History:: History of GNU `gettext'
343 * References:: Related Readings
346 File: gettext.info, Node: Introduction, Next: Basics, Prev: Top, Up: Top
351 This manual is still in _DRAFT_ state. Some sections are still
352 empty, or almost. We keep merging material from other sources
353 (essentially e-mail folders) while the proper integration of this
356 In this manual, we use _he_ when speaking of the programmer or
357 maintainer, _she_ when speaking of the translator, and _they_ when
358 speaking of the installers or end users of the translated program.
359 This is only a convenience for clarifying the documentation. It is
360 _absolutely_ not meant to imply that some roles are more appropriate to
361 males or females. Besides, as you might guess, GNU `gettext' is meant
362 to be useful for people using computers, whatever their sex, race,
363 religion or nationality!
365 This chapter explains the goals sought in the creation of GNU
366 `gettext' and the free Translation Project. Then, it explains a few
367 broad concepts around Native Language Support, and positions message
368 translation with regard to other aspects of national and cultural
369 variance, as they apply to to programs. It also surveys those files
370 used to convey the translations. It explains how the various tools
371 interact in the initial generation of these files, and later, how the
372 maintenance cycle should usually operate.
374 Please send suggestions and corrections to:
377 bug-gnu-gettext@gnu.org
379 Please include the manual's edition number and update date in your
384 * Why:: The Purpose of GNU `gettext'
385 * Concepts:: I18n, L10n, and Such
386 * Aspects:: Aspects in Native Language Support
387 * Files:: Files Conveying Translations
388 * Overview:: Overview of GNU `gettext'
391 File: gettext.info, Node: Why, Next: Concepts, Prev: Introduction, Up: Introduction
393 1.1 The Purpose of GNU `gettext'
394 ================================
396 Usually, programs are written and documented in English, and use
397 English at execution time to interact with users. This is true not
398 only of GNU software, but also of a great deal of commercial and free
399 software. Using a common language is quite handy for communication
400 between developers, maintainers and users from all countries. On the
401 other hand, most people are less comfortable with English than with
402 their own native language, and would prefer to use their mother tongue
403 for day to day's work, as far as possible. Many would simply _love_ to
404 see their computer screen showing a lot less of English, and far more
405 of their own language.
407 However, to many people, this dream might appear so far fetched that
408 they may believe it is not even worth spending time thinking about it.
409 They have no confidence at all that the dream might ever become true.
410 Yet some have not lost hope, and have organized themselves. The
411 Translation Project is a formalization of this hope into a workable
412 structure, which has a good chance to get all of us nearer the
413 achievement of a truly multi-lingual set of programs.
415 GNU `gettext' is an important step for the Translation Project, as
416 it is an asset on which we may build many other steps. This package
417 offers to programmers, translators and even users, a well integrated
418 set of tools and documentation. Specifically, the GNU `gettext'
419 utilities are a set of tools that provides a framework within which
420 other free packages may produce multi-lingual messages. These tools
423 * A set of conventions about how programs should be written to
424 support message catalogs.
426 * A directory and file naming organization for the message catalogs
429 * A runtime library supporting the retrieval of translated messages.
431 * A few stand-alone programs to massage in various ways the sets of
432 translatable strings, or already translated strings.
434 * A special mode for Emacs(1) which helps preparing these sets and
435 bringing them up to date.
437 GNU `gettext' is designed to minimize the impact of
438 internationalization on program sources, keeping this impact as small
439 and hardly noticeable as possible. Internationalization has better
440 chances of succeeding if it is very light weighted, or at least, appear
441 to be so, when looking at program sources.
443 The Translation Project also uses the GNU `gettext' distribution as
444 a vehicle for documenting its structure and methods. This goes beyond
445 the strict technicalities of documenting the GNU `gettext' proper. By
446 so doing, translators will find in a single place, as far as possible,
447 all they need to know for properly doing their translating work. Also,
448 this supplemental documentation might also help programmers, and even
449 curious users, in understanding how GNU `gettext' is related to the
450 remainder of the Translation Project, and consequently, have a glimpse
451 at the _big picture_.
453 ---------- Footnotes ----------
455 (1) In this manual, all mentions of Emacs refers to either GNU Emacs
456 or to XEmacs, which people sometimes call FSF Emacs and Lucid Emacs,
460 File: gettext.info, Node: Concepts, Next: Aspects, Prev: Why, Up: Introduction
462 1.2 I18n, L10n, and Such
463 ========================
465 Two long words appear all the time when we discuss support of native
466 language in programs, and these words have a precise meaning, worth
467 being explained here, once and for all in this document. The words are
468 _internationalization_ and _localization_. Many people, tired of
469 writing these long words over and over again, took the habit of writing
470 "i18n" and "l10n" instead, quoting the first and last letter of each
471 word, and replacing the run of intermediate letters by a number merely
472 telling how many such letters there are. But in this manual, in the
473 sake of clarity, we will patiently write the names in full, each time...
475 By "internationalization", one refers to the operation by which a
476 program, or a set of programs turned into a package, is made aware of
477 and able to support multiple languages. This is a generalization
478 process, by which the programs are untied from calling only English
479 strings or other English specific habits, and connected to generic ways
480 of doing the same, instead. Program developers may use various
481 techniques to internationalize their programs. Some of these have been
482 standardized. GNU `gettext' offers one of these standards. *Note
485 By "localization", one means the operation by which, in a set of
486 programs already internationalized, one gives the program all needed
487 information so that it can adapt itself to handle its input and output
488 in a fashion which is correct for some native language and cultural
489 habits. This is a particularisation process, by which generic methods
490 already implemented in an internationalized program are used in
491 specific ways. The programming environment puts several functions to
492 the programmers disposal which allow this runtime configuration. The
493 formal description of specific set of cultural habits for some country,
494 together with all associated translations targeted to the same native
495 language, is called the "locale" for this language or country. Users
496 achieve localization of programs by setting proper values to special
497 environment variables, prior to executing those programs, identifying
498 which locale should be used.
500 In fact, locale message support is only one component of the cultural
501 data that makes up a particular locale. There are a whole host of
502 routines and functions provided to aid programmers in developing
503 internationalized software and which allow them to access the data
504 stored in a particular locale. When someone presently refers to a
505 particular locale, they are obviously referring to the data stored
506 within that particular locale. Similarly, if a programmer is referring
507 to "accessing the locale routines", they are referring to the complete
508 suite of routines that access all of the locale's information.
510 One uses the expression "Native Language Support", or merely NLS,
511 for speaking of the overall activity or feature encompassing both
512 internationalization and localization, allowing for multi-lingual
513 interactions in a program. In a nutshell, one could say that
514 internationalization is the operation by which further localizations
517 Also, very roughly said, when it comes to multi-lingual messages,
518 internationalization is usually taken care of by programmers, and
519 localization is usually taken care of by translators.
522 File: gettext.info, Node: Aspects, Next: Files, Prev: Concepts, Up: Introduction
524 1.3 Aspects in Native Language Support
525 ======================================
527 For a totally multi-lingual distribution, there are many things to
528 translate beyond output messages.
530 * As of today, GNU `gettext' offers a complete toolset for
531 translating messages output by C programs. Perl scripts and shell
532 scripts will also need to be translated. Even if there are today
533 some hooks by which this can be done, these hooks are not
534 integrated as well as they should be.
536 * Some programs, like `autoconf' or `bison', are able to produce
537 other programs (or scripts). Even if the generating programs
538 themselves are internationalized, the generated programs they
539 produce may need internationalization on their own, and this
540 indirect internationalization could be automated right from the
541 generating program. In fact, quite usually, generating and
542 generated programs could be internationalized independently, as
543 the effort needed is fairly orthogonal.
545 * A few programs include textual tables which might need translation
546 themselves, independently of the strings contained in the program
547 itself. For example, RFC 1345 gives an English description for
548 each character which the `recode' program is able to reconstruct
549 at execution. Since these descriptions are extracted from the RFC
550 by mechanical means, translating them properly would require a
551 prior translation of the RFC itself.
553 * Almost all programs accept options, which are often worded out so
554 to be descriptive for the English readers; one might want to
555 consider offering translated versions for program options as well.
557 * Many programs read, interpret, compile, or are somewhat driven by
558 input files which are texts containing keywords, identifiers, or
559 replies which are inherently translatable. For example, one may
560 want `gcc' to allow diacriticized characters in identifiers or use
561 translated keywords; `rm -i' might accept something else than `y'
562 or `n' for replies, etc. Even if the program will eventually make
563 most of its output in the foreign languages, one has to decide
564 whether the input syntax, option values, etc., are to be localized
567 * The manual accompanying a package, as well as all documentation
568 files in the distribution, could surely be translated, too.
569 Translating a manual, with the intent of later keeping up with
570 updates, is a major undertaking in itself, generally.
573 As we already stressed, translation is only one aspect of locales.
574 Other internationalization aspects are system services and are handled
575 in GNU `libc'. There are many attributes that are needed to define a
576 country's cultural conventions. These attributes include beside the
577 country's native language, the formatting of the date and time, the
578 representation of numbers, the symbols for currency, etc. These local
579 "rules" are termed the country's locale. The locale represents the
580 knowledge needed to support the country's native attributes.
582 There are a few major areas which may vary between countries and
583 hence, define what a locale must describe. The following list helps
584 putting multi-lingual messages into the proper context of other tasks
585 related to locales. See the GNU `libc' manual for details.
587 _Characters and Codesets_
588 The codeset most commonly used through out the USA and most English
589 speaking parts of the world is the ASCII codeset. However, there
590 are many characters needed by various locales that are not found
591 within this codeset. The 8-bit ISO 8859-1 code set has most of
592 the special characters needed to handle the major European
593 languages. However, in many cases, choosing ISO 8859-1 is
594 nevertheless not adequate: it doesn't even handle the major
595 European currency. Hence each locale will need to specify which
596 codeset they need to use and will need to have the appropriate
597 character handling routines to cope with the codeset.
600 The symbols used vary from country to country as does the position
601 used by the symbol. Software needs to be able to transparently
602 display currency figures in the native mode for each locale.
605 The format of date varies between locales. For example, Christmas
606 day in 1994 is written as 12/25/94 in the USA and as 25/12/94 in
607 Australia. Other countries might use ISO 8601 dates, etc.
609 Time of the day may be noted as HH:MM, HH.MM, or otherwise. Some
610 locales require time to be specified in 24-hour mode rather than
611 as AM or PM. Further, the nature and yearly extent of the
612 Daylight Saving correction vary widely between countries.
615 Numbers can be represented differently in different locales. For
616 example, the following numbers are all written correctly for their
624 Some programs could go further and use different unit systems, like
625 English units or Metric units, or even take into account variants
626 about how numbers are spelled in full.
629 The most obvious area is the language support within a locale.
630 This is where GNU `gettext' provides the means for developers and
631 users to easily change the language that the software uses to
632 communicate to the user.
635 Components of locale outside of message handling are standardized in
636 the ISO C standard and the SUSV2 specification. GNU `libc' fully
637 implements this, and most other modern systems provide a more or less
638 reasonable support for at least some of the missing components.
641 File: gettext.info, Node: Files, Next: Overview, Prev: Aspects, Up: Introduction
643 1.4 Files Conveying Translations
644 ================================
646 The letters PO in `.po' files means Portable Object, to distinguish it
647 from `.mo' files, where MO stands for Machine Object. This paradigm,
648 as well as the PO file format, is inspired by the NLS standard
649 developed by Uniforum, and first implemented by Sun in their Solaris
652 PO files are meant to be read and edited by humans, and associate
653 each original, translatable string of a given package with its
654 translation in a particular target language. A single PO file is
655 dedicated to a single target language. If a package supports many
656 languages, there is one such PO file per language supported, and each
657 package has its own set of PO files. These PO files are best created by
658 the `xgettext' program, and later updated or refreshed through the
659 `msgmerge' program. Program `xgettext' extracts all marked messages
660 from a set of C files and initializes a PO file with empty
661 translations. Program `msgmerge' takes care of adjusting PO files
662 between releases of the corresponding sources, commenting obsolete
663 entries, initializing new ones, and updating all source line
664 references. Files ending with `.pot' are kind of base translation
665 files found in distributions, in PO file format.
667 MO files are meant to be read by programs, and are binary in nature.
668 A few systems already offer tools for creating and handling MO files as
669 part of the Native Language Support coming with the system, but the
670 format of these MO files is often different from system to system, and
671 non-portable. The tools already provided with these systems don't
672 support all the features of GNU `gettext'. Therefore GNU `gettext'
673 uses its own format for MO files. Files ending with `.gmo' are really
674 MO files, when it is known that these files use the GNU format.
677 File: gettext.info, Node: Overview, Prev: Files, Up: Introduction
679 1.5 Overview of GNU `gettext'
680 =============================
682 The following diagram summarizes the relation between the files handled
683 by GNU `gettext' and the tools acting on these files. It is followed
684 by somewhat detailed explanations, which you should read while keeping
685 an eye on the diagram. Having a clear understanding of these
686 interrelations will surely help programmers, translators and
689 Original C Sources ---> PO mode ---> Marked C Sources ---.
691 .---------<--- GNU gettext Library |
693 | `---------<--------------------+-----------'
695 | .-----<--- PACKAGE.pot <--- xgettext <---' .---<--- PO Compendium
698 | `---. +---> PO mode ---.
699 | +----> msgmerge ------> LANG.po ---->--------' |
702 | `-------------<---------------. |
703 | +--- New LANG.po <------------------'
704 | .--- LANG.gmo <--- msgfmt <---'
706 | `---> install ---> /.../LANG/PACKAGE.mo ---.
707 | +---> "Hello world!"
708 `-------> install ---> /.../bin/PROGRAM -------'
710 The indication `PO mode' appears in two places in this picture, and
711 you may safely read it as merely meaning "hand editing", using any
712 editor of your choice, really. However, for those of you being the
713 lucky users of Emacs, PO mode has been specifically created for
714 providing a cozy environment for editing or modifying PO files. While
715 editing a PO file, PO mode allows for the easy browsing of auxiliary
716 and compendium PO files, as well as for following references into the
717 set of C program sources from which PO files have been derived. It has
718 a few special features, among which are the interactive marking of
719 program strings as translatable, and the validation of PO files with
720 easy repositioning to PO file lines showing errors.
722 As a programmer, the first step to bringing GNU `gettext' into your
723 package is identifying, right in the C sources, those strings which are
724 meant to be translatable, and those which are untranslatable. This
725 tedious job can be done a little more comfortably using emacs PO mode,
726 but you can use any means familiar to you for modifying your C sources.
727 Beside this some other simple, standard changes are needed to properly
728 initialize the translation library. *Note Sources::, for more
729 information about all this.
731 For newly written software the strings of course can and should be
732 marked while writing it. The `gettext' approach makes this very easy.
733 Simply put the following lines at the beginning of each file or in a
736 #define _(String) (String)
737 #define N_(String) String
738 #define textdomain(Domain)
739 #define bindtextdomain(Package, Directory)
741 Doing this allows you to prepare the sources for internationalization.
742 Later when you feel ready for the step to use the `gettext' library
743 simply replace these definitions by the following:
746 #define _(String) gettext (String)
747 #define gettext_noop(String) String
748 #define N_(String) gettext_noop (String)
750 and link against `libintl.a' or `libintl.so'. Note that on GNU
751 systems, you don't need to link with `libintl' because the `gettext'
752 library functions are already contained in GNU libc. That is all you
755 Once the C sources have been modified, the `xgettext' program is
756 used to find and extract all translatable strings, and create a PO
757 template file out of all these. This `PACKAGE.pot' file contains all
758 original program strings. It has sets of pointers to exactly where in
759 C sources each string is used. All translations are set to empty. The
760 letter `t' in `.pot' marks this as a Template PO file, not yet oriented
761 towards any particular language. *Note xgettext Invocation::, for more
762 details about how one calls the `xgettext' program. If you are
763 _really_ lazy, you might be interested at working a lot more right
764 away, and preparing the whole distribution setup (*note Maintainers::).
765 By doing so, you spare yourself typing the `xgettext' command, as
766 `make' should now generate the proper things automatically for you!
768 The first time through, there is no `LANG.po' yet, so the `msgmerge'
769 step may be skipped and replaced by a mere copy of `PACKAGE.pot' to
770 `LANG.po', where LANG represents the target language. See *Note
771 Creating:: for details.
773 Then comes the initial translation of messages. Translation in
774 itself is a whole matter, still exclusively meant for humans, and whose
775 complexity far overwhelms the level of this manual. Nevertheless, a
776 few hints are given in some other chapter of this manual (*note
777 Translators::). You will also find there indications about how to
778 contact translating teams, or becoming part of them, for sharing your
779 translating concerns with others who target the same native language.
781 While adding the translated messages into the `LANG.po' PO file, if
782 you do not have Emacs handy, you are on your own for ensuring that your
783 efforts fully respect the PO file format, and quoting conventions
784 (*note PO Files::). This is surely not an impossible task, as this is
785 the way many people have handled PO files already for Uniforum or
786 Solaris. On the other hand, by using PO mode in Emacs, most details of
787 PO file format are taken care of for you, but you have to acquire some
788 familiarity with PO mode itself. Besides main PO mode commands (*note
789 Main PO Commands::), you should know how to move between entries (*note
790 Entry Positioning::), and how to handle untranslated entries (*note
791 Untranslated Entries::).
793 If some common translations have already been saved into a compendium
794 PO file, translators may use PO mode for initializing untranslated
795 entries from the compendium, and also save selected translations into
796 the compendium, updating it (*note Compendium::). Compendium files are
797 meant to be exchanged between members of a given translation team.
799 Programs, or packages of programs, are dynamic in nature: users write
800 bug reports and suggestion for improvements, maintainers react by
801 modifying programs in various ways. The fact that a package has
802 already been internationalized should not make maintainers shy of
803 adding new strings, or modifying strings already translated. They just
804 do their job the best they can. For the Translation Project to work
805 smoothly, it is important that maintainers do not carry translation
806 concerns on their already loaded shoulders, and that translators be
807 kept as free as possible of programming concerns.
809 The only concern maintainers should have is carefully marking new
810 strings as translatable, when they should be, and do not otherwise
811 worry about them being translated, as this will come in proper time.
812 Consequently, when programs and their strings are adjusted in various
813 ways by maintainers, and for matters usually unrelated to translation,
814 `xgettext' would construct `PACKAGE.pot' files which are evolving over
815 time, so the translations carried by `LANG.po' are slowly fading out of
818 It is important for translators (and even maintainers) to understand
819 that package translation is a continuous process in the lifetime of a
820 package, and not something which is done once and for all at the start.
821 After an initial burst of translation activity for a given package,
822 interventions are needed once in a while, because here and there,
823 translated entries become obsolete, and new untranslated entries
824 appear, needing translation.
826 The `msgmerge' program has the purpose of refreshing an already
827 existing `LANG.po' file, by comparing it with a newer `PACKAGE.pot'
828 template file, extracted by `xgettext' out of recent C sources. The
829 refreshing operation adjusts all references to C source locations for
830 strings, since these strings move as programs are modified. Also,
831 `msgmerge' comments out as obsolete, in `LANG.po', those already
832 translated entries which are no longer used in the program sources
833 (*note Obsolete Entries::). It finally discovers new strings and
834 inserts them in the resulting PO file as untranslated entries (*note
835 Untranslated Entries::). *Note msgmerge Invocation::, for more
836 information about what `msgmerge' really does.
838 Whatever route or means taken, the goal is to obtain an updated
839 `LANG.po' file offering translations for all strings.
841 The temporal mobility, or fluidity of PO files, is an integral part
842 of the translation game, and should be well understood, and accepted.
843 People resisting it will have a hard time participating in the
844 Translation Project, or will give a hard time to other participants! In
845 particular, maintainers should relax and include all available official
846 PO files in their distributions, even if these have not recently been
847 updated, without exerting pressure on the translator teams to get the
848 job done. The pressure should rather come from the community of users
849 speaking a particular language, and maintainers should consider
850 themselves fairly relieved of any concern about the adequacy of
851 translation files. On the other hand, translators should reasonably
852 try updating the PO files they are responsible for, while the package
853 is undergoing pretest, prior to an official distribution.
855 Once the PO file is complete and dependable, the `msgfmt' program is
856 used for turning the PO file into a machine-oriented format, which may
857 yield efficient retrieval of translations by the programs of the
858 package, whenever needed at runtime (*note MO Files::). *Note msgfmt
859 Invocation::, for more information about all modes of execution for the
862 Finally, the modified and marked C sources are compiled and linked
863 with the GNU `gettext' library, usually through the operation of
864 `make', given a suitable `Makefile' exists for the project, and the
865 resulting executable is installed somewhere users will find it. The MO
866 files themselves should also be properly installed. Given the
867 appropriate environment variables are set (*note End Users::), the
868 program should localize itself automatically, whenever it executes.
870 The remainder of this manual has the purpose of explaining in depth
871 the various steps outlined above.
874 File: gettext.info, Node: Basics, Next: Sources, Prev: Introduction, Up: Top
876 2 PO Files and PO Mode Basics
877 *****************************
879 The GNU `gettext' toolset helps programmers and translators at
880 producing, updating and using translation files, mainly those PO files
881 which are textual, editable files. This chapter stresses the format of
882 PO files, and contains a PO mode starter. PO mode description is
883 spread throughout this manual instead of being concentrated in one
884 place. Here we present only the basics of PO mode.
888 * Installation:: Completing GNU `gettext' Installation
889 * PO Files:: The Format of PO Files
890 * Main PO Commands:: Main Commands
891 * Entry Positioning:: Entry Positioning
892 * Normalizing:: Normalizing Strings in Entries
895 File: gettext.info, Node: Installation, Next: PO Files, Prev: Basics, Up: Basics
897 2.1 Completing GNU `gettext' Installation
898 =========================================
900 Once you have received, unpacked, configured and compiled the GNU
901 `gettext' distribution, the `make install' command puts in place the
902 programs `xgettext', `msgfmt', `gettext', and `msgmerge', as well as
903 their available message catalogs. To top off a comfortable
904 installation, you might also want to make the PO mode available to your
907 During the installation of the PO mode, you might want to modify your
908 file `.emacs', once and for all, so it contains a few lines looking
911 (setq auto-mode-alist
912 (cons '("\\.po\\'\\|\\.po\\." . po-mode) auto-mode-alist))
913 (autoload 'po-mode "po-mode" "Major mode for translators to edit PO files" t)
915 Later, whenever you edit some `.po' file, or any file having the
916 string `.po.' within its name, Emacs loads `po-mode.elc' (or
917 `po-mode.el') as needed, and automatically activates PO mode commands
918 for the associated buffer. The string _PO_ appears in the mode line
919 for any buffer for which PO mode is active. Many PO files may be
920 active at once in a single Emacs session.
922 If you are using Emacs version 20 or newer, and have already
923 installed the appropriate international fonts on your system, you may
924 also tell Emacs how to determine automatically the coding system of
925 every PO file. This will often (but not always) cause the necessary
926 fonts to be loaded and used for displaying the translations on your
927 Emacs screen. For this to happen, add the lines:
929 (modify-coding-system-alist 'file "\\.po\\'\\|\\.po\\."
930 'po-find-file-coding-system)
931 (autoload 'po-find-file-coding-system "po-mode")
933 to your `.emacs' file. If, with this, you still see boxes instead of
934 international characters, try a different font set (via Shift Mouse
938 File: gettext.info, Node: PO Files, Next: Main PO Commands, Prev: Installation, Up: Basics
940 2.2 The Format of PO Files
941 ==========================
943 A PO file is made up of many entries, each entry holding the relation
944 between an original untranslated string and its corresponding
945 translation. All entries in a given PO file usually pertain to a
946 single project, and all translations are expressed in a single target
947 language. One PO file "entry" has the following schematic structure:
950 # TRANSLATOR-COMMENTS
951 #. AUTOMATIC-COMMENTS
954 msgid UNTRANSLATED-STRING
955 msgstr TRANSLATED-STRING
957 The general structure of a PO file should be well understood by the
958 translator. When using PO mode, very little has to be known about the
959 format details, as PO mode takes care of them for her.
961 A simple entry can look like this:
964 msgid "Unknown system error"
965 msgstr "Error desconegut del sistema"
967 Entries begin with some optional white space. Usually, when
968 generated through GNU `gettext' tools, there is exactly one blank line
969 between entries. Then comments follow, on lines all starting with the
970 character `#'. There are two kinds of comments: those which have some
971 white space immediately following the `#', which comments are created
972 and maintained exclusively by the translator, and those which have some
973 non-white character just after the `#', which comments are created and
974 maintained automatically by GNU `gettext' tools. All comments, of
975 either kind, are optional.
977 After white space and comments, entries show two strings, namely
978 first the untranslated string as it appears in the original program
979 sources, and then, the translation of this string. The original string
980 is introduced by the keyword `msgid', and the translation, by `msgstr'.
981 The two strings, untranslated and translated, are quoted in various
982 ways in the PO file, using `"' delimiters and `\' escapes, but the
983 translator does not really have to pay attention to the precise quoting
984 format, as PO mode fully takes care of quoting for her.
986 The `msgid' strings, as well as automatic comments, are produced and
987 managed by other GNU `gettext' tools, and PO mode does not provide
988 means for the translator to alter these. The most she can do is merely
989 deleting them, and only by deleting the whole entry. On the other
990 hand, the `msgstr' string, as well as translator comments, are really
991 meant for the translator, and PO mode gives her the full control she
994 The comment lines beginning with `#,' are special because they are
995 not completely ignored by the programs as comments generally are. The
996 comma separated list of FLAGs is used by the `msgfmt' program to give
997 the user some better diagnostic messages. Currently there are two
998 forms of flags defined:
1001 This flag can be generated by the `msgmerge' program or it can be
1002 inserted by the translator herself. It shows that the `msgstr'
1003 string might not be a correct translation (anymore). Only the
1004 translator can judge if the translation requires further
1005 modification, or is acceptable as is. Once satisfied with the
1006 translation, she then removes this `fuzzy' attribute. The
1007 `msgmerge' program inserts this when it combined the `msgid' and
1008 `msgstr' entries after fuzzy search only. *Note Fuzzy Entries::.
1012 These flags should not be added by a human. Instead only the
1013 `xgettext' program adds them. In an automated PO file processing
1014 system as proposed here the user changes would be thrown away
1015 again as soon as the `xgettext' program generates a new template
1018 The `c-format' flag tells that the untranslated string and the
1019 translation are supposed to be C format strings. The `no-c-format'
1020 flag tells that they are not C format strings, even though the
1021 untranslated string happens to look like a C format string (with
1024 In case the `c-format' flag is given for a string the `msgfmt'
1025 does some more tests to check to validity of the translation.
1026 *Note msgfmt Invocation::, *Note c-format Flag:: and *Note
1031 Likewise for Objective C, see *Note objc-format::.
1035 Likewise for Shell, see *Note sh-format::.
1039 Likewise for Python, see *Note python-format::.
1043 Likewise for Lisp, see *Note lisp-format::.
1047 Likewise for Emacs Lisp, see *Note elisp-format::.
1051 Likewise for librep, see *Note librep-format::.
1055 Likewise for Scheme, see *Note scheme-format::.
1058 `no-smalltalk-format'
1059 Likewise for Smalltalk, see *Note smalltalk-format::.
1063 Likewise for Java, see *Note java-format::.
1067 Likewise for C#, see *Note csharp-format::.
1071 Likewise for awk, see *Note awk-format::.
1073 `object-pascal-format'
1074 `no-object-pascal-format'
1075 Likewise for Object Pascal, see *Note object-pascal-format::.
1079 Likewise for YCP, see *Note ycp-format::.
1083 Likewise for Tcl, see *Note tcl-format::.
1087 Likewise for Perl, see *Note perl-format::.
1090 `no-perl-brace-format'
1091 Likewise for Perl brace, see *Note perl-format::.
1095 Likewise for PHP, see *Note php-format::.
1097 `gcc-internal-format'
1098 `no-gcc-internal-format'
1099 Likewise for the GCC sources, see *Note gcc-internal-format::.
1103 Likewise for Qt, see *Note qt-format::.
1106 A different kind of entries is used for translations which involve
1110 # TRANSLATOR-COMMENTS
1111 #. AUTOMATIC-COMMENTS
1114 msgid UNTRANSLATED-STRING-SINGULAR
1115 msgid_plural UNTRANSLATED-STRING-PLURAL
1116 msgstr[0] TRANSLATED-STRING-CASE-0
1118 msgstr[N] TRANSLATED-STRING-CASE-N
1120 Such an entry can look like this:
1122 #: src/msgcmp.c:338 src/po-lex.c:699
1124 msgid "found %d fatal error"
1125 msgid_plural "found %d fatal errors"
1126 msgstr[0] "s'ha trobat %d error fatal"
1127 msgstr[1] "s'han trobat %d errors fatals"
1129 It happens that some lines, usually whitespace or comments, follow
1130 the very last entry of a PO file. Such lines are not part of any entry,
1131 and PO mode is unable to take action on those lines. By using the PO
1132 mode function `M-x po-normalize', the translator may get rid of those
1133 spurious lines. *Note Normalizing::.
1135 The remainder of this section may be safely skipped by those using
1136 PO mode, yet it may be interesting for everybody to have a better idea
1137 of the precise format of a PO file. On the other hand, those not
1138 having Emacs handy should carefully continue reading on.
1140 Each of UNTRANSLATED-STRING and TRANSLATED-STRING respects the C
1141 syntax for a character string, including the surrounding quotes and
1142 embedded backslashed escape sequences. When the time comes to write
1143 multi-line strings, one should not use escaped newlines. Instead, a
1144 closing quote should follow the last character on the line to be
1145 continued, and an opening quote should resume the string at the
1146 beginning of the following PO file line. For example:
1149 "Here is an example of how one might continue a very long string\n"
1150 "for the common case the string represents multi-line output.\n"
1152 In this example, the empty string is used on the first line, to allow
1153 better alignment of the `H' from the word `Here' over the `f' from the
1154 word `for'. In this example, the `msgid' keyword is followed by three
1155 strings, which are meant to be concatenated. Concatenating the empty
1156 string does not change the resulting overall string, but it is a way
1157 for us to comply with the necessity of `msgid' to be followed by a
1158 string on the same line, while keeping the multi-line presentation
1159 left-justified, as we find this to be a cleaner disposition. The empty
1160 string could have been omitted, but only if the string starting with
1161 `Here' was promoted on the first line, right after `msgid'.(1) It was
1162 not really necessary either to switch between the two last quoted
1163 strings immediately after the newline `\n', the switch could have
1164 occurred after _any_ other character, we just did it this way because
1167 One should carefully distinguish between end of lines marked as `\n'
1168 _inside_ quotes, which are part of the represented string, and end of
1169 lines in the PO file itself, outside string quotes, which have no
1170 incidence on the represented string.
1172 Outside strings, white lines and comments may be used freely.
1173 Comments start at the beginning of a line with `#' and extend until the
1174 end of the PO file line. Comments written by translators should have
1175 the initial `#' immediately followed by some white space. If the `#'
1176 is not immediately followed by white space, this comment is most likely
1177 generated and managed by specialized GNU tools, and might disappear or
1178 be replaced unexpectedly when the PO file is given to `msgmerge'.
1180 ---------- Footnotes ----------
1182 (1) This limitation is not imposed by GNU `gettext', but is for
1183 compatibility with the `msgfmt' implementation on Solaris.
1186 File: gettext.info, Node: Main PO Commands, Next: Entry Positioning, Prev: PO Files, Up: Basics
1188 2.3 Main PO mode Commands
1189 =========================
1191 After setting up Emacs with something similar to the lines in *Note
1192 Installation::, PO mode is activated for a window when Emacs finds a PO
1193 file in that window. This puts the window read-only and establishes a
1194 po-mode-map, which is a genuine Emacs mode, in a way that is not derived
1195 from text mode in any way. Functions found on `po-mode-hook', if any,
1198 When PO mode is active in a window, the letters `PO' appear in the
1199 mode line for that window. The mode line also displays how many
1200 entries of each kind are held in the PO file. For example, the string
1201 `132t+3f+10u+2o' would tell the translator that the PO mode contains
1202 132 translated entries (*note Translated Entries::, 3 fuzzy entries
1203 (*note Fuzzy Entries::), 10 untranslated entries (*note Untranslated
1204 Entries::) and 2 obsolete entries (*note Obsolete Entries::).
1205 Zero-coefficients items are not shown. So, in this example, if the
1206 fuzzy entries were unfuzzied, the untranslated entries were translated
1207 and the obsolete entries were deleted, the mode line would merely
1208 display `145t' for the counters.
1210 The main PO commands are those which do not fit into the other
1211 categories of subsequent sections. These allow for quitting PO mode or
1212 for managing windows in special ways.
1215 Undo last modification to the PO file (`po-undo').
1218 Quit processing and save the PO file (`po-quit').
1221 Quit processing, possibly after confirmation
1222 (`po-confirm-and-quit').
1225 Temporary leave the PO file window (`po-other-window').
1229 Show help about PO mode (`po-help').
1232 Give some PO file statistics (`po-statistics').
1235 Batch validate the format of the whole PO file (`po-validate').
1238 The command `_' (`po-undo') interfaces to the Emacs _undo_ facility.
1239 *Note Undoing Changes: (emacs)Undo. Each time `U' is typed,
1240 modifications which the translator did to the PO file are undone a
1241 little more. For the purpose of undoing, each PO mode command is
1242 atomic. This is especially true for the `<RET>' command: the whole
1243 edition made by using a single use of this command is undone at once,
1244 even if the edition itself implied several actions. However, while in
1245 the editing window, one can undo the edition work quite parsimoniously.
1247 The commands `Q' (`po-quit') and `q' (`po-confirm-and-quit') are
1248 used when the translator is done with the PO file. The former is a bit
1249 less verbose than the latter. If the file has been modified, it is
1250 saved to disk first. In both cases, and prior to all this, the
1251 commands check if any untranslated messages remain in the PO file and,
1252 if so, the translator is asked if she really wants to leave off working
1253 with this PO file. This is the preferred way of getting rid of an
1254 Emacs PO file buffer. Merely killing it through the usual command
1255 `C-x k' (`kill-buffer') is not the tidiest way to proceed.
1257 The command `0' (`po-other-window') is another, softer way, to leave
1258 PO mode, temporarily. It just moves the cursor to some other Emacs
1259 window, and pops one if necessary. For example, if the translator just
1260 got PO mode to show some source context in some other, she might
1261 discover some apparent bug in the program source that needs correction.
1262 This command allows the translator to change sex, become a programmer,
1263 and have the cursor right into the window containing the program she
1264 (or rather _he_) wants to modify. By later getting the cursor back in
1265 the PO file window, or by asking Emacs to edit this file once again, PO
1266 mode is then recovered.
1268 The command `h' (`po-help') displays a summary of all available PO
1269 mode commands. The translator should then type any character to resume
1270 normal PO mode operations. The command `?' has the same effect as `h'.
1272 The command `=' (`po-statistics') computes the total number of
1273 entries in the PO file, the ordinal of the current entry (counted from
1274 1), the number of untranslated entries, the number of obsolete entries,
1275 and displays all these numbers.
1277 The command `V' (`po-validate') launches `msgfmt' in checking and
1278 verbose mode over the current PO file. This command first offers to
1279 save the current PO file on disk. The `msgfmt' tool, from GNU
1280 `gettext', has the purpose of creating a MO file out of a PO file, and
1281 PO mode uses the features of this program for checking the overall
1282 format of a PO file, as well as all individual entries.
1284 The program `msgfmt' runs asynchronously with Emacs, so the
1285 translator regains control immediately while her PO file is being
1286 studied. Error output is collected in the Emacs `*compilation*' buffer,
1287 displayed in another window. The regular Emacs command `C-x`'
1288 (`next-error'), as well as other usual compile commands, allow the
1289 translator to reposition quickly to the offending parts of the PO file.
1290 Once the cursor is on the line in error, the translator may decide on
1291 any PO mode action which would help correcting the error.
1294 File: gettext.info, Node: Entry Positioning, Next: Normalizing, Prev: Main PO Commands, Up: Basics
1296 2.4 Entry Positioning
1297 =====================
1299 The cursor in a PO file window is almost always part of an entry. The
1300 only exceptions are the special case when the cursor is after the last
1301 entry in the file, or when the PO file is empty. The entry where the
1302 cursor is found to be is said to be the current entry. Many PO mode
1303 commands operate on the current entry, so moving the cursor does more
1304 than allowing the translator to browse the PO file, this also selects
1305 on which entry commands operate.
1307 Some PO mode commands alter the position of the cursor in a
1308 specialized way. A few of those special purpose positioning are
1309 described here, the others are described in following sections (for a
1310 complete list try `C-h m'):
1313 Redisplay the current entry (`po-current-entry').
1316 Select the entry after the current one (`po-next-entry').
1319 Select the entry before the current one (`po-previous-entry').
1322 Select the first entry in the PO file (`po-first-entry').
1325 Select the last entry in the PO file (`po-last-entry').
1328 Record the location of the current entry for later use
1329 (`po-push-location').
1332 Return to a previously saved entry location (`po-pop-location').
1335 Exchange the current entry location with the previously saved one
1336 (`po-exchange-location').
1339 Any Emacs command able to reposition the cursor may be used to
1340 select the current entry in PO mode, including commands which move by
1341 characters, lines, paragraphs, screens or pages, and search commands.
1342 However, there is a kind of standard way to display the current entry
1343 in PO mode, which usual Emacs commands moving the cursor do not
1344 especially try to enforce. The command `.' (`po-current-entry') has
1345 the sole purpose of redisplaying the current entry properly, after the
1346 current entry has been changed by means external to PO mode, or the
1347 Emacs screen otherwise altered.
1349 It is yet to be decided if PO mode helps the translator, or otherwise
1350 irritates her, by forcing a rigid window disposition while she is doing
1351 her work. We originally had quite precise ideas about how windows
1352 should behave, but on the other hand, anyone used to Emacs is often
1353 happy to keep full control. Maybe a fixed window disposition might be
1354 offered as a PO mode option that the translator might activate or
1355 deactivate at will, so it could be offered on an experimental basis.
1356 If nobody feels a real need for using it, or a compulsion for writing
1357 it, we should drop this whole idea. The incentive for doing it should
1358 come from translators rather than programmers, as opinions from an
1359 experienced translator are surely more worth to me than opinions from
1360 programmers _thinking_ about how _others_ should do translation.
1362 The commands `n' (`po-next-entry') and `p' (`po-previous-entry')
1363 move the cursor the entry following, or preceding, the current one. If
1364 `n' is given while the cursor is on the last entry of the PO file, or
1365 if `p' is given while the cursor is on the first entry, no move is done.
1367 The commands `<' (`po-first-entry') and `>' (`po-last-entry') move
1368 the cursor to the first entry, or last entry, of the PO file. When the
1369 cursor is located past the last entry in a PO file, most PO mode
1370 commands will return an error saying `After last entry'. Moreover, the
1371 commands `<' and `>' have the special property of being able to work
1372 even when the cursor is not into some PO file entry, and one may use
1373 them for nicely correcting this situation. But even these commands
1374 will fail on a truly empty PO file. There are development plans for
1375 the PO mode for it to interactively fill an empty PO file from sources.
1378 The translator may decide, before working at the translation of a
1379 particular entry, that she needs to browse the remainder of the PO
1380 file, maybe for finding the terminology or phraseology used in related
1381 entries. She can of course use the standard Emacs idioms for saving
1382 the current cursor location in some register, and use that register for
1383 getting back, or else, use the location ring.
1385 PO mode offers another approach, by which cursor locations may be
1386 saved onto a special stack. The command `m' (`po-push-location')
1387 merely adds the location of current entry to the stack, pushing the
1388 already saved locations under the new one. The command `r'
1389 (`po-pop-location') consumes the top stack element and repositions the
1390 cursor to the entry associated with that top element. This position is
1391 then lost, for the next `r' will move the cursor to the previously
1392 saved location, and so on until no locations remain on the stack.
1394 If the translator wants the position to be kept on the location
1395 stack, maybe for taking a look at the entry associated with the top
1396 element, then go elsewhere with the intent of getting back later, she
1397 ought to use `m' immediately after `r'.
1399 The command `x' (`po-exchange-location') simultaneously repositions
1400 the cursor to the entry associated with the top element of the stack of
1401 saved locations, and replaces that top element with the location of the
1402 current entry before the move. Consequently, repeating the `x' command
1403 toggles alternatively between two entries. For achieving this, the
1404 translator will position the cursor on the first entry, use `m', then
1405 position to the second entry, and merely use `x' for making the switch.
1408 File: gettext.info, Node: Normalizing, Prev: Entry Positioning, Up: Basics
1410 2.5 Normalizing Strings in Entries
1411 ==================================
1413 There are many different ways for encoding a particular string into a
1414 PO file entry, because there are so many different ways to split and
1415 quote multi-line strings, and even, to represent special characters by
1416 backslashed escaped sequences. Some features of PO mode rely on the
1417 ability for PO mode to scan an already existing PO file for a
1418 particular string encoded into the `msgid' field of some entry. Even
1419 if PO mode has internally all the built-in machinery for implementing
1420 this recognition easily, doing it fast is technically difficult. To
1421 facilitate a solution to this efficiency problem, we decided on a
1422 canonical representation for strings.
1424 A conventional representation of strings in a PO file is currently
1425 under discussion, and PO mode experiments with a canonical
1426 representation. Having both `xgettext' and PO mode converging towards
1427 a uniform way of representing equivalent strings would be useful, as
1428 the internal normalization needed by PO mode could be automatically
1429 satisfied when using `xgettext' from GNU `gettext'. An explicit PO
1430 mode normalization should then be only necessary for PO files imported
1431 from elsewhere, or for when the convention itself evolves.
1433 So, for achieving normalization of at least the strings of a given
1434 PO file needing a canonical representation, the following PO mode
1435 command is available:
1438 Tidy the whole PO file by making entries more uniform.
1441 The special command `M-x po-normalize', which has no associated
1442 keys, revises all entries, ensuring that strings of both original and
1443 translated entries use uniform internal quoting in the PO file. It
1444 also removes any crumb after the last entry. This command may be
1445 useful for PO files freshly imported from elsewhere, or if we ever
1446 improve on the canonical quoting format we use. This canonical format
1447 is not only meant for getting cleaner PO files, but also for greatly
1448 speeding up `msgid' string lookup for some other PO mode commands.
1450 `M-x po-normalize' presently makes three passes over the entries.
1451 The first implements heuristics for converting PO files for GNU
1452 `gettext' 0.6 and earlier, in which `msgid' and `msgstr' fields were
1453 using K&R style C string syntax for multi-line strings. These
1454 heuristics may fail for comments not related to obsolete entries and
1455 ending with a backslash; they also depend on subsequent passes for
1456 finalizing the proper commenting of continued lines for obsolete
1457 entries. This first pass might disappear once all oldish PO files
1458 would have been adjusted. The second and third pass normalize all
1459 `msgid' and `msgstr' strings respectively. They also clean out those
1460 trailing backslashes used by XView's `msgfmt' for continued lines.
1462 Having such an explicit normalizing command allows for importing PO
1463 files from other sources, but also eases the evolution of the current
1464 convention, evolution driven mostly by aesthetic concerns, as of now.
1465 It is easy to make suggested adjustments at a later time, as the
1466 normalizing command and eventually, other GNU `gettext' tools should
1467 greatly automate conformance. A description of the canonical string
1468 format is given below, for the particular benefit of those not having
1469 Emacs handy, and who would nevertheless want to handcraft their PO
1472 Right now, in PO mode, strings are single line or multi-line. A
1473 string goes multi-line if and only if it has _embedded_ newlines, that
1474 is, if it matches `[^\n]\n+[^\n]'. So, we would have:
1476 msgstr "\n\nHello, world!\n\n\n"
1478 but, replacing the space by a newline, this becomes:
1488 We are deliberately using a caricatural example, here, to make the
1489 point clearer. Usually, multi-lines are not that bad looking. It is
1490 probable that we will implement the following suggestion. We might
1491 lump together all initial newlines into the empty string, and also all
1492 newlines introducing empty lines (that is, for N > 1, the N-1'th last
1493 newlines would go together on a separate string), so making the
1494 previous example appear:
1501 There are a few yet undecided little points about string
1502 normalization, to be documented in this manual, once these questions
1506 File: gettext.info, Node: Sources, Next: Template, Prev: Basics, Up: Top
1508 3 Preparing Program Sources
1509 ***************************
1511 For the programmer, changes to the C source code fall into three
1512 categories. First, you have to make the localization functions known
1513 to all modules needing message translation. Second, you should
1514 properly trigger the operation of GNU `gettext' when the program
1515 initializes, usually from the `main' function. Last, you should
1516 identify and especially mark all constant strings in your program
1517 needing translation.
1519 Presuming that your set of programs, or package, has been adjusted
1520 so all needed GNU `gettext' files are available, and your `Makefile'
1521 files are adjusted (*note Maintainers::), each C module having
1522 translated C strings should contain the line:
1524 #include <libintl.h>
1526 Similarly, each C module containing `printf()'/`fprintf()'/...
1527 calls with a format string that could be a translated C string (even if
1528 the C string comes from a different C module) should contain the line:
1530 #include <libintl.h>
1532 The remaining changes to your C sources are discussed in the further
1533 sections of this chapter.
1537 * Triggering:: Triggering `gettext' Operations
1538 * Preparing Strings:: Preparing Translatable Strings
1539 * Mark Keywords:: How Marks Appear in Sources
1540 * Marking:: Marking Translatable Strings
1541 * c-format Flag:: Telling something about the following string
1542 * Special cases:: Special Cases of Translatable Strings
1543 * Names:: Marking Proper Names for Translation
1544 * Libraries:: Preparing Library Sources
1547 File: gettext.info, Node: Triggering, Next: Preparing Strings, Prev: Sources, Up: Sources
1549 3.1 Triggering `gettext' Operations
1550 ===================================
1552 The initialization of locale data should be done with more or less the
1553 same code in every program, as demonstrated below:
1556 main (int argc, char *argv[])
1559 setlocale (LC_ALL, "");
1560 bindtextdomain (PACKAGE, LOCALEDIR);
1561 textdomain (PACKAGE);
1565 PACKAGE and LOCALEDIR should be provided either by `config.h' or by
1566 the Makefile. For now consult the `gettext' or `hello' sources for
1569 The use of `LC_ALL' might not be appropriate for you. `LC_ALL'
1570 includes all locale categories and especially `LC_CTYPE'. This later
1571 category is responsible for determining character classes with the
1572 `isalnum' etc. functions from `ctype.h' which could especially for
1573 programs, which process some kind of input language, be wrong. For
1574 example this would mean that a source code using the c, (c-cedilla
1575 character) is runnable in France but not in the U.S.
1577 Some systems also have problems with parsing numbers using the
1578 `scanf' functions if an other but the `LC_ALL' locale is used. The
1579 standards say that additional formats but the one known in the `"C"'
1580 locale might be recognized. But some systems seem to reject numbers in
1581 the `"C"' locale format. In some situation, it might also be a problem
1582 with the notation itself which makes it impossible to recognize whether
1583 the number is in the `"C"' locale or the local format. This can happen
1584 if thousands separator characters are used. Some locales define this
1585 character according to the national conventions to `'.'' which is the
1586 same character used in the `"C"' locale to denote the decimal point.
1588 So it is sometimes necessary to replace the `LC_ALL' line in the
1589 code above by a sequence of `setlocale' lines
1593 setlocale (LC_CTYPE, "");
1594 setlocale (LC_MESSAGES, "");
1598 On all POSIX conformant systems the locale categories `LC_CTYPE',
1599 `LC_MESSAGES', `LC_COLLATE', `LC_MONETARY', `LC_NUMERIC', and `LC_TIME'
1600 are available. On some systems which are only ISO C compliant,
1601 `LC_MESSAGES' is missing, but a substitute for it is defined in GNU
1602 gettext's `<libintl.h>'.
1604 Note that changing the `LC_CTYPE' also affects the functions
1605 declared in the `<ctype.h>' standard header. If this is not desirable
1606 in your application (for example in a compiler's parser), you can use a
1607 set of substitute functions which hardwire the C locale, such as found
1608 in the `<c-ctype.h>' and `<c-ctype.c>' files in the gettext source
1611 It is also possible to switch the locale forth and back between the
1612 environment dependent locale and the C locale, but this approach is
1613 normally avoided because a `setlocale' call is expensive, because it is
1614 tedious to determine the places where a locale switch is needed in a
1615 large program's source, and because switching a locale is not
1619 File: gettext.info, Node: Preparing Strings, Next: Mark Keywords, Prev: Triggering, Up: Sources
1621 3.2 Preparing Translatable Strings
1622 ==================================
1624 Before strings can be marked for translations, they sometimes need to
1625 be adjusted. Usually preparing a string for translation is done right
1626 before marking it, during the marking phase which is described in the
1627 next sections. What you have to keep in mind while doing that is the
1630 * Decent English style.
1634 * Split at paragraphs.
1636 * Use format strings instead of string concatenation.
1638 Let's look at some examples of these guidelines.
1640 Translatable strings should be in good English style. If slang
1641 language with abbreviations and shortcuts is used, often translators
1642 will not understand the message and will produce very inappropriate
1645 "%s: is parameter\n"
1647 This is nearly untranslatable: Is the displayed item _a_ parameter or
1652 The ambiguity in this message makes it ununderstandable: Is the program
1653 attempting to set something on fire? Does it mean "The given object does
1654 not match the template"? Does it mean "The template does not fit for any
1657 In both cases, adding more words to the message will help both the
1658 translator and the English speaking user.
1660 Translatable strings should be entire sentences. It is often not
1661 possible to translate single verbs or adjectives in a substitutable way.
1663 printf ("File %s is %s protected", filename, rw ? "write" : "read");
1665 Most translators will not look at the source and will thus only see the
1666 string `"File %s is %s protected"', which is unintelligible. Change
1669 printf (rw ? "File %s is write protected" : "File %s is read protected",
1672 This way the translator will not only understand the message, she will
1673 also be able to find the appropriate grammatical construction. The
1674 French translator for example translates "write protected" like
1675 "protected against writing".
1677 Entire sentences are also important because in many languages, the
1678 declination of some word in a sentence depends on the gender or the
1679 number (singular/plural) of another part of the sentence. There are
1680 usually more interdependencies between words than in English. The
1681 consequence is that asking a translator to translate two half-sentences
1682 and then combining these two half-sentences through dumb string
1683 concatenation will not work, for many languages, even though it would
1684 work for English. That's why translators need to handle entire
1687 Often sentences don't fit into a single line. If a sentence is
1688 output using two subsequent `printf' statements, like this
1690 printf ("Locale charset \"%s\" is different from\n", lcharset);
1691 printf ("input file charset \"%s\".\n", fcharset);
1693 the translator would have to translate two half sentences, but nothing
1694 in the POT file would tell her that the two half sentences belong
1695 together. It is necessary to merge the two `printf' statements so that
1696 the translator can handle the entire sentence at once and decide at
1697 which place to insert a line break in the translation (if at all):
1699 printf ("Locale charset \"%s\" is different from\n\
1700 input file charset \"%s\".\n", lcharset, fcharset);
1702 You may now ask: how about two or more adjacent sentences? Like in
1705 puts ("Apollo 13 scenario: Stack overflow handling failed.");
1706 puts ("On the next stack overflow we will crash!!!");
1708 Should these two statements merged into a single one? I would recommend
1709 to merge them if the two sentences are related to each other, because
1710 then it makes it easier for the translator to understand and translate
1711 both. On the other hand, if one of the two messages is a stereotypic
1712 one, occurring in other places as well, you will do a favour to the
1713 translator by not merging the two. (Identical messages occurring in
1714 several places are combined by xgettext, so the translator has to
1715 handle them once only.)
1717 Translatable strings should be limited to one paragraph; don't let a
1718 single message be longer than ten lines. The reason is that when the
1719 translatable string changes, the translator is faced with the task of
1720 updating the entire translated string. Maybe only a single word will
1721 have changed in the English string, but the translator doesn't see that
1722 (with the current translation tools), therefore she has to proofread
1725 Many GNU programs have a `--help' output that extends over several
1726 screen pages. It is a courtesy towards the translators to split such a
1727 message into several ones of five to ten lines each. While doing that,
1728 you can also attempt to split the documented options into groups, such
1729 as the input options, the output options, and the informative output
1730 options. This will help every user to find the option he is looking
1733 Hardcoded string concatenation is sometimes used to construct English
1736 strcpy (s, "Replace ");
1737 strcat (s, object1);
1738 strcat (s, " with ");
1739 strcat (s, object2);
1742 In order to present to the translator only entire sentences, and also
1743 because in some languages the translator might want to swap the order
1744 of `object1' and `object2', it is necessary to change this to use a
1747 sprintf (s, "Replace %s with %s?", object1, object2);
1749 A similar case is compile time concatenation of strings. The ISO C
1750 99 include file `<inttypes.h>' contains a macro `PRId64' that can be
1751 used as a formatting directive for outputting an `int64_t' integer
1752 through `printf'. It expands to a constant string, usually "d" or "ld"
1753 or "lld" or something like this, depending on the platform. Assume you
1756 printf ("The amount is %0" PRId64 "\n", number);
1758 The `gettext' tools and library have special support for these
1759 `<inttypes.h>' macros. You can therefore simply write
1761 printf (gettext ("The amount is %0" PRId64 "\n"), number);
1763 The PO file will contain the string "The amount is %0<PRId64>\n". The
1764 translators will provide a translation containing "%0<PRId64>" as well,
1765 and at runtime the `gettext' function's result will contain the
1766 appropriate constant string, "d" or "ld" or "lld".
1768 This works only for the predefined `<inttypes.h>' macros. If you
1769 have defined your own similar macros, let's say `MYPRId64', that are
1770 not known to `xgettext', the solution for this problem is to change the
1774 sprintf (buf1, "%0" MYPRId64, number);
1775 printf (gettext ("The amount is %s\n"), buf1);
1777 This means, you put the platform dependent code in one statement,
1778 and the internationalization code in a different statement. Note that
1779 a buffer length of 100 is safe, because all available hardware integer
1780 types are limited to 128 bits, and to print a 128 bit integer one needs
1781 at most 54 characters, regardless whether in decimal, octal or
1784 All this applies to other programming languages as well. For
1785 example, in Java and C#, string contenation is very frequently used,
1786 because it is a compiler built-in operator. Like in C, in Java, you
1789 System.out.println("Replace "+object1+" with "+object2+"?");
1791 into a statement involving a format string:
1794 MessageFormat.format("Replace {0} with {1}?",
1795 new Object[] { object1, object2 }));
1797 Similarly, in C#, you would change
1799 Console.WriteLine("Replace "+object1+" with "+object2+"?");
1801 into a statement involving a format string:
1804 String.Format("Replace {0} with {1}?", object1, object2));
1807 File: gettext.info, Node: Mark Keywords, Next: Marking, Prev: Preparing Strings, Up: Sources
1809 3.3 How Marks Appear in Sources
1810 ===============================
1812 All strings requiring translation should be marked in the C sources.
1813 Marking is done in such a way that each translatable string appears to
1814 be the sole argument of some function or preprocessor macro. There are
1815 only a few such possible functions or macros meant for translation, and
1816 their names are said to be marking keywords. The marking is attached
1817 to strings themselves, rather than to what we do with them. This
1818 approach has more uses. A blatant example is an error message produced
1819 by formatting. The format string needs translation, as well as some
1820 strings inserted through some `%s' specification in the format, while
1821 the result from `sprintf' may have so many different instances that it
1822 is impractical to list them all in some `error_string_out()' routine,
1825 This marking operation has two goals. The first goal of marking is
1826 for triggering the retrieval of the translation, at run time. The
1827 keyword are possibly resolved into a routine able to dynamically return
1828 the proper translation, as far as possible or wanted, for the argument
1829 string. Most localizable strings are found in executable positions,
1830 that is, attached to variables or given as parameters to functions.
1831 But this is not universal usage, and some translatable strings appear
1832 in structured initializations. *Note Special cases::.
1834 The second goal of the marking operation is to help `xgettext' at
1835 properly extracting all translatable strings when it scans a set of
1836 program sources and produces PO file templates.
1838 The canonical keyword for marking translatable strings is `gettext',
1839 it gave its name to the whole GNU `gettext' package. For packages
1840 making only light use of the `gettext' keyword, macro or function, it
1841 is easily used _as is_. However, for packages using the `gettext'
1842 interface more heavily, it is usually more convenient to give the main
1843 keyword a shorter, less obtrusive name. Indeed, the keyword might
1844 appear on a lot of strings all over the package, and programmers
1845 usually do not want nor need their program sources to remind them
1846 forcefully, all the time, that they are internationalized. Further, a
1847 long keyword has the disadvantage of using more horizontal space,
1848 forcing more indentation work on sources for those trying to keep them
1849 within 79 or 80 columns.
1851 Many packages use `_' (a simple underline) as a keyword, and write
1852 `_("Translatable string")' instead of `gettext ("Translatable
1853 string")'. Further, the coding rule, from GNU standards, wanting that
1854 there is a space between the keyword and the opening parenthesis is
1855 relaxed, in practice, for this particular usage. So, the textual
1856 overhead per translatable string is reduced to only three characters:
1857 the underline and the two parentheses. However, even if GNU `gettext'
1858 uses this convention internally, it does not offer it officially. The
1859 real, genuine keyword is truly `gettext' indeed. It is fairly easy for
1860 those wanting to use `_' instead of `gettext' to declare:
1862 #include <libintl.h>
1863 #define _(String) gettext (String)
1865 instead of merely using `#include <libintl.h>'.
1867 Later on, the maintenance is relatively easy. If, as a programmer,
1868 you add or modify a string, you will have to ask yourself if the new or
1869 altered string requires translation, and include it within `_()' if you
1870 think it should be translated. `"%s: %d"' is an example of string
1871 _not_ requiring translation!
1874 File: gettext.info, Node: Marking, Next: c-format Flag, Prev: Mark Keywords, Up: Sources
1876 3.4 Marking Translatable Strings
1877 ================================
1879 In PO mode, one set of features is meant more for the programmer than
1880 for the translator, and allows him to interactively mark which strings,
1881 in a set of program sources, are translatable, and which are not. Even
1882 if it is a fairly easy job for a programmer to find and mark such
1883 strings by other means, using any editor of his choice, PO mode makes
1884 this work more comfortable. Further, this gives translators who feel a
1885 little like programmers, or programmers who feel a little like
1886 translators, a tool letting them work at marking translatable strings
1887 in the program sources, while simultaneously producing a set of
1888 translation in some language, for the package being internationalized.
1890 The set of program sources, targetted by the PO mode commands
1891 describe here, should have an Emacs tags table constructed for your
1892 project, prior to using these PO file commands. This is easy to do.
1893 In any shell window, change the directory to the root of your project,
1894 then execute a command resembling:
1896 etags src/*.[hc] lib/*.[hc]
1898 presuming here you want to process all `.h' and `.c' files from the
1899 `src/' and `lib/' directories. This command will explore all said
1900 files and create a `TAGS' file in your root directory, somewhat
1901 summarizing the contents using a special file format Emacs can
1904 For packages following the GNU coding standards, there is a make
1905 goal `tags' or `TAGS' which constructs the tag files in all directories
1906 and for all files containing source code.
1908 Once your `TAGS' file is ready, the following commands assist the
1909 programmer at marking translatable strings in his set of sources. But
1910 these commands are necessarily driven from within a PO file window, and
1911 it is likely that you do not even have such a PO file yet. This is not
1912 a problem at all, as you may safely open a new, empty PO file, mainly
1913 for using these commands. This empty PO file will slowly fill in while
1914 you mark strings as translatable in your program sources.
1917 Search through program sources for a string which looks like a
1918 candidate for translation (`po-tags-search').
1921 Mark the last string found with `_()' (`po-mark-translatable').
1924 Mark the last string found with a keyword taken from a set of
1925 possible keywords. This command with a prefix allows some
1926 management of these keywords (`po-select-mark-and-mark').
1929 The `,' (`po-tags-search') command searches for the next occurrence
1930 of a string which looks like a possible candidate for translation, and
1931 displays the program source in another Emacs window, positioned in such
1932 a way that the string is near the top of this other window. If the
1933 string is too big to fit whole in this window, it is positioned so only
1934 its end is shown. In any case, the cursor is left in the PO file
1935 window. If the shown string would be better presented differently in
1936 different native languages, you may mark it using `M-,' or `M-.'.
1937 Otherwise, you might rather ignore it and skip to the next string by
1938 merely repeating the `,' command.
1940 A string is a good candidate for translation if it contains a
1941 sequence of three or more letters. A string containing at most two
1942 letters in a row will be considered as a candidate if it has more
1943 letters than non-letters. The command disregards strings containing no
1944 letters, or isolated letters only. It also disregards strings within
1945 comments, or strings already marked with some keyword PO mode knows
1948 If you have never told Emacs about some `TAGS' file to use, the
1949 command will request that you specify one from the minibuffer, the
1950 first time you use the command. You may later change your `TAGS' file
1951 by using the regular Emacs command `M-x visit-tags-table', which will
1952 ask you to name the precise `TAGS' file you want to use. *Note Tag
1953 Tables: (emacs)Tags.
1955 Each time you use the `,' command, the search resumes from where it
1956 was left by the previous search, and goes through all program sources,
1957 obeying the `TAGS' file, until all sources have been processed.
1958 However, by giving a prefix argument to the command (`C-u ,'), you may
1959 request that the search be restarted all over again from the first
1960 program source; but in this case, strings that you recently marked as
1961 translatable will be automatically skipped.
1963 Using this `,' command does not prevent using of other regular Emacs
1964 tags commands. For example, regular `tags-search' or
1965 `tags-query-replace' commands may be used without disrupting the
1966 independent `,' search sequence. However, as implemented, the
1967 _initial_ `,' command (or the `,' command is used with a prefix) might
1968 also reinitialize the regular Emacs tags searching to the first tags
1969 file, this reinitialization might be considered spurious.
1971 The `M-,' (`po-mark-translatable') command will mark the recently
1972 found string with the `_' keyword. The `M-.'
1973 (`po-select-mark-and-mark') command will request that you type one
1974 keyword from the minibuffer and use that keyword for marking the
1975 string. Both commands will automatically create a new PO file
1976 untranslated entry for the string being marked, and make it the current
1977 entry (making it easy for you to immediately proceed to its
1978 translation, if you feel like doing it right away). It is possible
1979 that the modifications made to the program source by `M-,' or `M-.'
1980 render some source line longer than 80 columns, forcing you to break
1981 and re-indent this line differently. You may use the `O' command from
1982 PO mode, or any other window changing command from Emacs, to break out
1983 into the program source window, and do any needed adjustments. You
1984 will have to use some regular Emacs command to return the cursor to the
1985 PO file window, if you want command `,' for the next string, say.
1987 The `M-.' command has a few built-in speedups, so you do not have to
1988 explicitly type all keywords all the time. The first such speedup is
1989 that you are presented with a _preferred_ keyword, which you may accept
1990 by merely typing `<RET>' at the prompt. The second speedup is that you
1991 may type any non-ambiguous prefix of the keyword you really mean, and
1992 the command will complete it automatically for you. This also means
1993 that PO mode has to _know_ all your possible keywords, and that it will
1994 not accept mistyped keywords.
1996 If you reply `?' to the keyword request, the command gives a list of
1997 all known keywords, from which you may choose. When the command is
1998 prefixed by an argument (`C-u M-.'), it inhibits updating any program
1999 source or PO file buffer, and does some simple keyword management
2000 instead. In this case, the command asks for a keyword, written in
2001 full, which becomes a new allowed keyword for later `M-.' commands.
2002 Moreover, this new keyword automatically becomes the _preferred_
2003 keyword for later commands. By typing an already known keyword in
2004 response to `C-u M-.', one merely changes the _preferred_ keyword and
2007 All keywords known for `M-.' are recognized by the `,' command when
2008 scanning for strings, and strings already marked by any of those known
2009 keywords are automatically skipped. If many PO files are opened
2010 simultaneously, each one has its own independent set of known keywords.
2011 There is no provision in PO mode, currently, for deleting a known
2012 keyword, you have to quit the file (maybe using `q') and reopen it
2013 afresh. When a PO file is newly brought up in an Emacs window, only
2014 `gettext' and `_' are known as keywords, and `gettext' is preferred for
2015 the `M-.' command. In fact, this is not useful to prefer `_', as this
2016 one is already built in the `M-,' command.
2019 File: gettext.info, Node: c-format Flag, Next: Special cases, Prev: Marking, Up: Sources
2021 3.5 Special Comments preceding Keywords
2022 =======================================
2024 In C programs strings are often used within calls of functions from the
2025 `printf' family. The special thing about these format strings is that
2026 they can contain format specifiers introduced with `%'. Assume we have
2029 printf (gettext ("String `%s' has %d characters\n"), s, strlen (s));
2031 A possible German translation for the above string might be:
2033 "%d Zeichen lang ist die Zeichenkette `%s'"
2035 A C programmer, even if he cannot speak German, will recognize that
2036 there is something wrong here. The order of the two format specifiers
2037 is changed but of course the arguments in the `printf' don't have.
2038 This will most probably lead to problems because now the length of the
2039 string is regarded as the address.
2041 To prevent errors at runtime caused by translations the `msgfmt'
2042 tool can check statically whether the arguments in the original and the
2043 translation string match in type and number. If this is not the case
2044 and the `-c' option has been passed to `msgfmt', `msgfmt' will give an
2045 error and refuse to produce a MO file. Thus consequent use of `msgfmt
2046 -c' will catch the error, so that it cannot cause cause problems at
2049 If the word order in the above German translation would be correct one
2052 "%2$d Zeichen lang ist die Zeichenkette `%1$s'"
2054 The routines in `msgfmt' know about this special notation.
2056 Because not all strings in a program must be format strings it is not
2057 useful for `msgfmt' to test all the strings in the `.po' file. This
2058 might cause problems because the string might contain what looks like a
2059 format specifier, but the string is not used in `printf'.
2061 Therefore the `xgettext' adds a special tag to those messages it
2062 thinks might be a format string. There is no absolute rule for this,
2063 only a heuristic. In the `.po' file the entry is marked using the
2064 `c-format' flag in the `#,' comment line (*note PO Files::).
2066 The careful reader now might say that this again can cause problems.
2067 The heuristic might guess it wrong. This is true and therefore
2068 `xgettext' knows about a special kind of comment which lets the
2069 programmer take over the decision. If in the same line as or the
2070 immediately preceding line to the `gettext' keyword the `xgettext'
2071 program finds a comment containing the words `xgettext:c-format', it
2072 will mark the string in any case with the `c-format' flag. This kind
2073 of comment should be used when `xgettext' does not recognize the string
2074 as a format string but it really is one and it should be tested.
2075 Please note that when the comment is in the same line as the `gettext'
2076 keyword, it must be before the string to be translated.
2078 This situation happens quite often. The `printf' function is often
2079 called with strings which do not contain a format specifier. Of course
2080 one would normally use `fputs' but it does happen. In this case
2081 `xgettext' does not recognize this as a format string but what happens
2082 if the translation introduces a valid format specifier? The `printf'
2083 function will try to access one of the parameters but none exists
2084 because the original code does not pass any parameters.
2086 `xgettext' of course could make a wrong decision the other way
2087 round, i.e. a string marked as a format string actually is not a format
2088 string. In this case the `msgfmt' might give too many warnings and
2089 would prevent translating the `.po' file. The method to prevent this
2090 wrong decision is similar to the one used above, only the comment to
2091 use must contain the string `xgettext:no-c-format'.
2093 If a string is marked with `c-format' and this is not correct the
2094 user can find out who is responsible for the decision. See *Note
2095 xgettext Invocation:: to see how the `--debug' option can be used for
2096 solving this problem.
2099 File: gettext.info, Node: Special cases, Next: Names, Prev: c-format Flag, Up: Sources
2101 3.6 Special Cases of Translatable Strings
2102 =========================================
2104 The attentive reader might now point out that it is not always possible
2105 to mark translatable string with `gettext' or something like this.
2106 Consider the following case:
2109 static const char *messages[] = {
2110 "some very meaningful message",
2116 = index > 1 ? "a default message" : messages[index];
2122 While it is no problem to mark the string `"a default message"' it
2123 is not possible to mark the string initializers for `messages'. What
2124 is to be done? We have to fulfill two tasks. First we have to mark the
2125 strings so that the `xgettext' program (*note xgettext Invocation::)
2126 can find them, and second we have to translate the string at runtime
2127 before printing them.
2129 The first task can be fulfilled by creating a new keyword, which
2130 names a no-op. For the second we have to mark all access points to a
2131 string from the array. So one solution can look like this:
2133 #define gettext_noop(String) String
2136 static const char *messages[] = {
2137 gettext_noop ("some very meaningful message"),
2138 gettext_noop ("and another one")
2143 = index > 1 ? gettext ("a default message") : gettext (messages[index]);
2149 Please convince yourself that the string which is written by `fputs'
2150 is translated in any case. How to get `xgettext' know the additional
2151 keyword `gettext_noop' is explained in *Note xgettext Invocation::.
2153 The above is of course not the only solution. You could also come
2154 along with the following one:
2156 #define gettext_noop(String) String
2159 static const char *messages[] = {
2160 gettext_noop ("some very meaningful message",
2161 gettext_noop ("and another one")
2166 = index > 1 ? gettext_noop ("a default message") : messages[index];
2168 fputs (gettext (string));
2172 But this has a drawback. The programmer has to take care that he
2173 uses `gettext_noop' for the string `"a default message"'. A use of
2174 `gettext' could have in rare cases unpredictable results.
2176 One advantage is that you need not make control flow analysis to make
2177 sure the output is really translated in any case. But this analysis is
2178 generally not very difficult. If it should be in any situation you can
2179 use this second method in this situation.
2182 File: gettext.info, Node: Names, Next: Libraries, Prev: Special cases, Up: Sources
2184 3.7 Marking Proper Names for Translation
2185 ========================================
2187 Should names of persons, cities, locations etc. be marked for
2188 translation or not? People who only know languages that can be written
2189 with Latin letters (English, Spanish, French, German, etc.) are tempted
2190 to say "no", because names usually do not change when transported
2191 between these languages. However, in general when translating from one
2192 script to another, names are translated too, usually phonetically or by
2193 transliteration. For example, Russian or Greek names are converted to
2194 the Latin alphabet when being translated to English, and English or
2195 French names are converted to the Katakana script when being translated
2196 to Japanese. This is necessary because the speakers of the target
2197 language in general cannot read the script the name is originally
2200 As a programmer, you should therefore make sure that names are marked
2201 for translation, with a special comment telling the translators that it
2202 is a proper name and how to pronounce it. Like this:
2204 printf (_("Written by %s.\n"),
2205 /* TRANSLATORS: This is a proper name. See the gettext
2206 manual, section Names. Note this is actually a non-ASCII
2207 name: The first name is (with Unicode escapes)
2208 "Fran\u00e7ois" or (with HTML entities) "François".
2209 Pronounciation is like "fraa-swa pee-nar". */
2210 _("Francois Pinard"));
2212 As a translator, you should use some care when translating names,
2213 because it is frustrating if people see their names mutilated or
2214 distorted. If your language uses the Latin script, all you need to do
2215 is to reproduce the name as perfectly as you can within the usual
2216 character set of your language. In this particular case, this means to
2217 provide a translation containing the c-cedilla character. If your
2218 language uses a different script and the people speaking it don't
2219 usually read Latin words, it means transliteration; but you should
2220 still give, in parentheses, the original writing of the name - for the
2221 sake of the people that do read the Latin script. Here is an example,
2222 using Greek as the target script:
2224 #. This is a proper name. See the gettext
2225 #. manual, section Names. Note this is actually a non-ASCII
2226 #. name: The first name is (with Unicode escapes)
2227 #. "Fran\u00e7ois" or (with HTML entities) "François".
2228 #. Pronounciation is like "fraa-swa pee-nar".
2229 msgid "Francois Pinard"
2230 msgstr "\phi\rho\alpha\sigma\omicron\alpha \pi\iota\nu\alpha\rho"
2231 " (Francois Pinard)"
2233 Because translation of names is such a sensitive domain, it is a good
2234 idea to test your translation before submitting it.
2236 The translation project `http://sourceforge.net/projects/translation'
2237 has set up a POT file and translation domain consisting of program
2238 author names, with better facilities for the translator than those
2239 presented here. Namely, there the original name is written directly in
2240 Unicode (rather than with Unicode escapes or HTML entities), and the
2241 pronounciation is denoted using the International Phonetic Alphabet (see
2242 `http://www.wikipedia.org/wiki/International_Phonetic_Alphabet').
2244 However, we don't recommend this approach for all POT files in all
2245 packages, because this would force translators to use PO files in UTF-8
2246 encoding, which is - in the current state of software (as of 2003) - a
2247 major hassle for translators using GNU Emacs or XEmacs with po-mode.
2250 File: gettext.info, Node: Libraries, Prev: Names, Up: Sources
2252 3.8 Preparing Library Sources
2253 =============================
2255 When you are preparing a library, not a program, for the use of
2256 `gettext', only a few details are different. Here we assume that the
2257 library has a translation domain and a POT file of its own. (If it
2258 uses the translation domain and POT file of the main program, then the
2259 previous sections apply without changes.)
2261 1. The library code doesn't call `setlocale (LC_ALL, "")'. It's the
2262 responsibility of the main program to set the locale. The
2263 library's documentation should mention this fact, so that
2264 developers of programs using the library are aware of it.
2266 2. The library code doesn't call `textdomain (PACKAGE)', because it
2267 would interfere with the text domain set by the main program.
2269 3. The initialization code for a program was
2271 setlocale (LC_ALL, "");
2272 bindtextdomain (PACKAGE, LOCALEDIR);
2273 textdomain (PACKAGE);
2275 For a library it is reduced to
2277 bindtextdomain (PACKAGE, LOCALEDIR);
2279 If your library's API doesn't already have an initialization
2280 function, you need to create one, containing at least the
2281 `bindtextdomain' invocation. However, you usually don't need to
2282 export and document this initialization function: It is sufficient
2283 that all entry points of the library call the initialization
2284 function if it hasn't been called before. The typical idiom used
2285 to achieve this is a static boolean variable that indicates
2286 whether the initialization function has been called. Like this:
2288 static bool libfoo_initialized;
2291 libfoo_initialize (void)
2293 bindtextdomain (PACKAGE, LOCALEDIR);
2294 libfoo_initialized = true;
2297 /* This function is part of the exported API. */
2301 /* Must ensure the initialization is performed. */
2302 if (!libfoo_initialized)
2303 libfoo_initialize ();
2307 /* This function is part of the exported API. The argument must be
2308 non-NULL and have been created through create_foo(). */
2310 foo_refcount (struct foo *argument)
2312 /* No need to invoke the initialization function here, because
2313 create_foo() must already have been called before. */
2317 4. The usual declaration of the `_' macro in each source file was
2319 #include <libintl.h>
2320 #define _(String) gettext (String)
2322 for a program. For a library, which has its own translation
2323 domain, it reads like this:
2325 #include <libintl.h>
2326 #define _(String) dgettext (PACKAGE, String)
2328 In other words, `dgettext' is used instead of `gettext'.
2329 Similary, the `dngettext' function should be used in place of the
2330 `ngettext' function.
2333 File: gettext.info, Node: Template, Next: Creating, Prev: Sources, Up: Top
2335 4 Making the PO Template File
2336 *****************************
2338 After preparing the sources, the programmer creates a PO template file.
2339 This section explains how to use `xgettext' for this purpose.
2341 `xgettext' creates a file named `DOMAINNAME.po'. You should then
2342 rename it to `DOMAINNAME.pot'. (Why doesn't `xgettext' create it under
2343 the name `DOMAINNAME.pot' right away? The answer is: for historical
2344 reasons. When `xgettext' was specified, the distinction between a PO
2345 file and PO file template was fuzzy, and the suffix `.pot' wasn't in
2350 * xgettext Invocation:: Invoking the `xgettext' Program
2353 File: gettext.info, Node: xgettext Invocation, Prev: Template, Up: Template
2355 4.1 Invoking the `xgettext' Program
2356 ===================================
2358 xgettext [OPTION] [INPUTFILE] ...
2360 The `xgettext' program extracts translatable strings from given
2363 4.1.1 Input file location
2364 -------------------------
2371 Read the names of the input files from FILE instead of getting
2372 them from the command line.
2375 `--directory=DIRECTORY'
2376 Add DIRECTORY to the list of directories. Source files are
2377 searched relative to this list of directories. The resulting `.po'
2378 file will be written relative to the current directory, though.
2381 If INPUTFILE is `-', standard input is read.
2383 4.1.2 Output file location
2384 --------------------------
2387 `--default-domain=NAME'
2388 Use `NAME.po' for output (instead of `messages.po').
2392 Write output to specified file (instead of `NAME.po' or
2397 Output files will be placed in directory DIR.
2400 If the output FILE is `-' or `/dev/stdout', the output is written to
2403 4.1.3 Choice of input file language
2404 -----------------------------------
2408 Specifies the language of the input files. The supported languages
2409 are `C', `C++', `ObjectiveC', `PO', `Python', `Lisp', `EmacsLisp',
2410 `librep', `Scheme', `Smalltalk', `Java', `JavaProperties', `C#',
2411 `awk', `YCP', `Tcl', `Perl', `PHP', `GCC-source', `NXStringTable',
2416 This is a shorthand for `--language=C++'.
2419 By default the language is guessed depending on the input file name
2422 4.1.4 Input file interpretation
2423 -------------------------------
2426 Specifies the encoding of the input files. This option is needed
2427 only if some untranslated message strings or their corresponding
2428 comments contain non-ASCII characters. Note that Python, Tcl, and
2429 Glade input files are always assumed to be in UTF-8, regardless of
2433 By default the input files are assumed to be in ASCII.
2435 4.1.5 Operation mode
2436 --------------------
2440 Join messages with existing file.
2443 `--exclude-file=FILE'
2444 Entries from FILE are not extracted. FILE should be a PO or POT
2448 `--add-comments[=TAG]'
2449 Place comment block with TAG (or those preceding keyword lines) in
2453 4.1.6 Language specific options
2454 -------------------------------
2458 Extract all strings.
2460 This option has an effect with most languages, namely C, C++,
2461 ObjectiveC, Shell, Python, Lisp, EmacsLisp, librep, Java, C#, awk,
2462 Tcl, Perl, PHP, GCC-source, Glade.
2465 `--keyword[=KEYWORDSPEC]'
2466 Additional keyword to be looked for (without KEYWORDSPEC means not
2467 to use default keywords).
2469 If KEYWORDSPEC is a C identifer ID, `xgettext' looks for strings
2470 in the first argument of each call to the function or macro ID.
2471 If KEYWORDSPEC is of the form `ID:ARGNUM', `xgettext' looks for
2472 strings in the ARGNUMth argument of the call. If KEYWORDSPEC is
2473 of the form `ID:ARGNUM1,ARGNUM2', `xgettext' looks for strings in
2474 the ARGNUM1st argument and in the ARGNUM2nd argument of the call,
2475 and treats them as singular/plural variants for a message with
2477 The default keyword specifications, which are always looked for if
2478 not explicitly disabled, are `gettext', `dgettext:2',
2479 `dcgettext:2', `ngettext:1,2', `dngettext:2,3', `dcngettext:2,3',
2481 This option has an effect with most languages, namely C, C++,
2482 ObjectiveC, Shell, Python, Lisp, EmacsLisp, librep, Java, C#, awk,
2483 Tcl, Perl, PHP, GCC-source, Glade.
2485 `--flag=WORD:ARG:FLAG'
2486 Specifies additional flags for strings occurring as part of the
2487 ARGth argument of the function WORD. The possible flags are the
2488 possible format string indicators, such as `c-format', and their
2489 negations, such as `no-c-format', possibly prefixed with `pass-'.
2490 The meaning of `--flag=FUNCTION:ARG:LANG-format' is that in
2491 language LANG, the specified FUNCTION expects as ARGth argument a
2492 format string. (For those of you familiar with GCC function
2493 attributes, `--flag=FUNCTION:ARG:c-format' is roughly equivalent
2494 to the declaration `__attribute__ ((__format__ (__printf__, ARG,
2495 ...)))' attached to FUNCTION in a C source file.) For example, if
2496 you use the `error' function from GNU libc, you can specify its
2497 behaviour through `--flag=error:3:c-format'. The effect of this
2498 specification is that `xgettext' will mark as format strings all
2499 `gettext' invocations that occur as ARGth argument of FUNCTION.
2500 This is useful when such strings contain no format string
2501 directives: together with the checks done by `msgfmt -c' it will
2502 ensure that translators cannot accidentally use format string
2503 directives that would lead to a crash at runtime.
2504 The meaning of `--flag=FUNCTION:ARG:pass-LANG-format' is that in
2505 language LANG, if the FUNCTION call occurs in a position that must
2506 yield a format string, then its ARGth argument must yield a format
2507 string of the same type as well. (If you know GCC function
2508 attributes, the `--flag=FUNCTION:ARG:pass-c-format' option is
2509 roughly equivalent to the declaration `__attribute__
2510 ((__format_arg__ (ARG)))' attached to FUNCTION in a C source file.)
2511 For example, if you use the `_' shortcut for the `gettext'
2512 function, you should use `--flag=_:1:pass-c-format'. The effect
2513 of this specification is that `xgettext' will propagate a format
2514 string requirement for a `_("string")' call to its first argument,
2515 the literal `"string"', and thus mark it as a format string. This
2516 is useful when such strings contain no format string directives:
2517 together with the checks done by `msgfmt -c' it will ensure that
2518 translators cannot accidentally use format string directives that
2519 would lead to a crash at runtime.
2520 This option has an effect with most languages, namely C, C++,
2521 ObjectiveC, Shell, Python, Lisp, EmacsLisp, librep, Scheme, Java,
2522 C#, awk, YCP, Tcl, Perl, PHP, GCC-source.
2526 Understand ANSI C trigraphs for input.
2527 This option has an effect only with the languages C, C++,
2531 Recognize Qt format strings.
2532 This option has an effect only with the language C++.
2535 Use the flags `c-format' and `possible-c-format' to show who was
2536 responsible for marking a message as a format string. The latter
2537 form is used if the `xgettext' program decided, the format form is
2538 used if the programmer prescribed it.
2540 By default only the `c-format' form is used. The translator should
2541 not have to care about these details.
2544 This implementation of `xgettext' is able to process a few awkward
2545 cases, like strings in preprocessor macros, ANSI concatenation of
2546 adjacent strings, and escaped end of lines for continued strings.
2548 4.1.7 Output details
2549 --------------------
2552 Always write an output file even if no message is defined.
2556 Write the .po file using indented style.
2559 Do not write `#: FILENAME:LINE' lines.
2563 Generate `#: FILENAME:LINE' lines (default).
2566 Write out a strict Uniforum conforming PO file. Note that this
2567 Uniforum format should be avoided because it doesn't support the
2570 `--properties-output'
2571 Write out a Java ResourceBundle in Java `.properties' syntax. Note
2572 that this file format doesn't support plural forms and silently
2573 drops obsolete messages.
2575 `--stringtable-output'
2576 Write out a NeXTstep/GNUstep localized resource file in `.strings'
2577 syntax. Note that this file format doesn't support plural forms.
2581 Set the output page width. Long strings in the output files will
2582 be split across multiple lines in order to ensure that each line's
2583 width (= number of screen columns) is less or equal to the given
2587 Do not break long message lines. Message lines whose width
2588 exceeds the output page width will not be split into several
2589 lines. Only file reference lines which are wider than the output
2590 page width will be split.
2594 Generate sorted output. Note that using this option makes it much
2595 harder for the translator to understand each message's context.
2599 Sort output by file location.
2602 Don't write header with `msgid ""' entry.
2604 This is useful for testing purposes because it eliminates a source
2605 of variance for generated `.gmo' files. With `--omit-header', two
2606 invocations of `xgettext' on the same files with the same options
2607 at different times are guaranteed to produce the same results.
2609 `--copyright-holder=STRING'
2610 Set the copyright holder in the output. STRING should be the
2611 copyright holder of the surrounding package. (Note that the msgstr
2612 strings, extracted from the package's sources, belong to the
2613 copyright holder of the package.) Translators are expected to
2614 transfer or disclaim the copyright for their translations, so that
2615 package maintainers can distribute them without legal risk. If
2616 STRING is empty, the output files are marked as being in the
2617 public domain; in this case, the translators are expected to
2618 disclaim their copyright, again so that package maintainers can
2619 distribute them without legal risk.
2621 The default value for STRING is the Free Software Foundation, Inc.,
2622 simply because `xgettext' was first used in the GNU project.
2625 Omit FSF copyright in output. This option is equivalent to
2626 `--copyright-holder='''. It can be useful for packages outside
2627 the GNU project that want their translations to be in the public
2630 `--msgid-bugs-address=EMAIL@ADDRESS'
2631 Set the reporting address for msgid bugs. This is the email
2632 address or URL to which the translators shall report bugs in the
2633 untranslated strings:
2635 - Strings which are not entire sentences, see the maintainer
2636 guidelines in *Note Preparing Strings::.
2638 - Strings which use unclear terms or require additional context
2641 - Strings which make invalid assumptions about notation of
2642 date, time or money.
2644 - Pluralisation problems.
2646 - Incorrect English spelling.
2648 - Incorrect formatting.
2650 It can be your email address, or a mailing list address where
2651 translators can write to without being subscribed, or the URL of a
2652 web page through which the translators can contact you.
2654 The default value is empty, which means that translators will be
2655 clueless! Don't forget to specify this option.
2658 `--msgstr-prefix[=STRING]'
2659 Use STRING (or "" if not specified) as prefix for msgstr entries.
2662 `--msgstr-suffix[=STRING]'
2663 Use STRING (or "" if not specified) as suffix for msgstr entries.
2666 4.1.8 Informative output
2667 ------------------------
2671 Display this help and exit.
2675 Output version information and exit.
2679 File: gettext.info, Node: Creating, Next: Updating, Prev: Template, Up: Top
2681 5 Creating a New PO File
2682 ************************
2684 When starting a new translation, the translator creates a file called
2685 `LANG.po', as a copy of the `PACKAGE.pot' template file with
2686 modifications in the initial comments (at the beginning of the file)
2687 and in the header entry (the first entry, near the beginning of the
2690 The easiest way to do so is by use of the `msginit' program. For
2693 $ cd PACKAGE-VERSION
2697 The alternative way is to do the copy and modifications by hand. To
2698 do so, the translator copies `PACKAGE.pot' to `LANG.po'. Then she
2699 modifies the initial comments and the header entry of this file.
2703 * msginit Invocation:: Invoking the `msginit' Program
2704 * Header Entry:: Filling in the Header Entry
2707 File: gettext.info, Node: msginit Invocation, Next: Header Entry, Prev: Creating, Up: Creating
2709 5.1 Invoking the `msginit' Program
2710 ==================================
2714 The `msginit' program creates a new PO file, initializing the meta
2715 information with values from the user's environment.
2717 5.1.1 Input file location
2718 -------------------------
2725 If no INPUTFILE is given, the current directory is searched for the
2726 POT file. If it is `-', standard input is read.
2728 5.1.2 Output file location
2729 --------------------------
2732 `--output-file=FILE'
2733 Write output to specified PO file.
2736 If no output file is given, it depends on the `--locale' option or
2737 the user's locale setting. If it is `-', the results are written to
2740 5.1.3 Input file syntax
2741 -----------------------
2744 `--properties-input'
2745 Assume the input file is a Java ResourceBundle in Java
2746 `.properties' syntax, not in PO file syntax.
2748 `--stringtable-input'
2749 Assume the input file is a NeXTstep/GNUstep localized resource
2750 file in `.strings' syntax, not in PO file syntax.
2753 5.1.4 Output details
2754 --------------------
2758 Set target locale. LL should be a language code, and CC should be
2759 a country code. The command `locale -a' can be used to output a
2760 list of all installed locales. The default is the user's locale
2764 Declares that the PO file will not have a human translator and is
2765 instead automatically generated.
2768 `--properties-output'
2769 Write out a Java ResourceBundle in Java `.properties' syntax. Note
2770 that this file format doesn't support plural forms and silently
2771 drops obsolete messages.
2773 `--stringtable-output'
2774 Write out a NeXTstep/GNUstep localized resource file in `.strings'
2775 syntax. Note that this file format doesn't support plural forms.
2779 Set the output page width. Long strings in the output files will
2780 be split across multiple lines in order to ensure that each line's
2781 width (= number of screen columns) is less or equal to the given
2785 Do not break long message lines. Message lines whose width
2786 exceeds the output page width will not be split into several
2787 lines. Only file reference lines which are wider than the output
2788 page width will be split.
2791 5.1.5 Informative output
2792 ------------------------
2796 Display this help and exit.
2800 Output version information and exit.
2804 File: gettext.info, Node: Header Entry, Prev: msginit Invocation, Up: Creating
2806 5.2 Filling in the Header Entry
2807 ===============================
2809 The initial comments "SOME DESCRIPTIVE TITLE", "YEAR" and "FIRST AUTHOR
2810 <EMAIL@ADDRESS>, YEAR" ought to be replaced by sensible information.
2811 This can be done in any text editor; if Emacs is used and it switched
2812 to PO mode automatically (because it has recognized the file's suffix),
2813 you can disable it by typing `M-x fundamental-mode'.
2815 Modifying the header entry can already be done using PO mode: in
2816 Emacs, type `M-x po-mode RET' and then `RET' again to start editing the
2817 entry. You should fill in the following fields.
2820 This is the name and version of the package.
2822 Report-Msgid-Bugs-To
2823 This has already been filled in by `xgettext'. It contains an
2824 email address or URL where you can report bugs in the untranslated
2827 - Strings which are not entire sentences, see the maintainer
2828 guidelines in *Note Preparing Strings::.
2830 - Strings which use unclear terms or require additional context
2833 - Strings which make invalid assumptions about notation of
2834 date, time or money.
2836 - Pluralisation problems.
2838 - Incorrect English spelling.
2840 - Incorrect formatting.
2843 This has already been filled in by `xgettext'.
2846 You don't need to fill this in. It will be filled by the Emacs PO
2847 mode when you save the file.
2850 Fill in your name and email address (without double quotes).
2853 Fill in the English name of the language, and the email address or
2854 homepage URL of the language team you are part of.
2856 Before starting a translation, it is a good idea to get in touch
2857 with your translation team, not only to make sure you don't do
2858 duplicated work, but also to coordinate difficult linguistic
2861 In the Free Translation Project, each translation team has its own
2862 mailing list. The up-to-date list of teams can be found at the
2863 Free Translation Project's homepage,
2864 `http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National
2868 Replace `CHARSET' with the character encoding used for your
2869 language, in your locale, or UTF-8. This field is needed for
2870 correct operation of the `msgmerge' and `msgfmt' programs, as well
2871 as for users whose locale's character encoding differs from yours
2872 (see *Note Charset conversion::).
2874 You get the character encoding of your locale by running the shell
2875 command `locale charmap'. If the result is `C' or
2876 `ANSI_X3.4-1968', which is equivalent to `ASCII' (= `US-ASCII'),
2877 it means that your locale is not correctly configured. In this
2878 case, ask your translation team which charset to use. `ASCII' is
2879 not usable for any language except Latin.
2881 Because the PO files must be portable to operating systems with
2882 less advanced internationalization facilities, the character
2883 encodings that can be used are limited to those supported by both
2884 GNU `libc' and GNU `libiconv'. These are: `ASCII', `ISO-8859-1',
2885 `ISO-8859-2', `ISO-8859-3', `ISO-8859-4', `ISO-8859-5',
2886 `ISO-8859-6', `ISO-8859-7', `ISO-8859-8', `ISO-8859-9',
2887 `ISO-8859-13', `ISO-8859-14', `ISO-8859-15', `KOI8-R', `KOI8-U',
2888 `KOI8-T', `CP850', `CP866', `CP874', `CP932', `CP949', `CP950',
2889 `CP1250', `CP1251', `CP1252', `CP1253', `CP1254', `CP1255',
2890 `CP1256', `CP1257', `GB2312', `EUC-JP', `EUC-KR', `EUC-TW',
2891 `BIG5', `BIG5-HKSCS', `GBK', `GB18030', `SHIFT_JIS', `JOHAB',
2892 `TIS-620', `VISCII', `GEORGIAN-PS', `UTF-8'.
2894 In the GNU system, the following encodings are frequently used for
2895 the corresponding languages.
2897 * `ISO-8859-1' for Afrikaans, Albanian, Basque, Breton,
2898 Catalan, Cornish, Danish, Dutch, English, Estonian, Faroese,
2899 Finnish, French, Galician, German, Greenlandic, Icelandic,
2900 Indonesian, Irish, Italian, Malay, Manx, Norwegian, Occitan,
2901 Portuguese, Spanish, Swedish, Tagalog, Uzbek, Walloon,
2903 * `ISO-8859-2' for Bosnian, Croatian, Czech, Hungarian, Polish,
2904 Romanian, Serbian, Slovak, Slovenian,
2906 * `ISO-8859-3' for Maltese,
2908 * `ISO-8859-5' for Macedonian, Serbian,
2910 * `ISO-8859-6' for Arabic,
2912 * `ISO-8859-7' for Greek,
2914 * `ISO-8859-8' for Hebrew,
2916 * `ISO-8859-9' for Turkish,
2918 * `ISO-8859-13' for Latvian, Lithuanian, Maori,
2920 * `ISO-8859-14' for Welsh,
2922 * `ISO-8859-15' for Basque, Catalan, Dutch, English, Finnish,
2923 French, Galician, German, Irish, Italian, Portuguese,
2924 Spanish, Swedish, Walloon,
2926 * `KOI8-R' for Russian,
2928 * `KOI8-U' for Ukrainian,
2930 * `KOI8-T' for Tajik,
2932 * `CP1251' for Bulgarian, Byelorussian,
2934 * `GB2312', `GBK', `GB18030' for simplified writing of Chinese,
2936 * `BIG5', `BIG5-HKSCS' for traditional writing of Chinese,
2938 * `EUC-JP' for Japanese,
2940 * `EUC-KR' for Korean,
2942 * `TIS-620' for Thai,
2944 * `GEORGIAN-PS' for Georgian,
2946 * `UTF-8' for any language, including those listed above.
2948 When single quote characters or double quote characters are used in
2949 translations for your language, and your locale's encoding is one
2950 of the ISO-8859-* charsets, it is best if you create your PO files
2951 in UTF-8 encoding, instead of your locale's encoding. This is
2952 because in UTF-8 the real quote characters can be represented
2953 (single quote characters: U+2018, U+2019, double quote characters:
2954 U+201C, U+201D), whereas none of ISO-8859-* charsets has them all.
2955 Users in UTF-8 locales will see the real quote characters,
2956 whereas users in ISO-8859-* locales will see the vertical
2957 apostrophe and the vertical double quote instead (because that's
2958 what the character set conversion will transliterate them to).
2960 To enter such quote characters under X11, you can change your
2961 keyboard mapping using the `xmodmap' program. The X11 names of
2962 the quote characters are "leftsinglequotemark",
2963 "rightsinglequotemark", "leftdoublequotemark",
2964 "rightdoublequotemark", "singlelowquotemark", "doublelowquotemark".
2966 Note that only recent versions of GNU Emacs support the UTF-8
2967 encoding: Emacs 20 with Mule-UCS, and Emacs 21. As of January
2968 2001, XEmacs doesn't support the UTF-8 encoding.
2970 The character encoding name can be written in either upper or
2971 lower case. Usually upper case is preferred.
2973 Content-Transfer-Encoding
2977 This field is optional. It is only needed if the PO file has
2978 plural forms. You can find them by searching for the
2979 `msgid_plural' keyword. The format of the plural forms field is
2980 described in *Note Plural forms::.
2983 File: gettext.info, Node: Updating, Next: Manipulating, Prev: Creating, Up: Top
2985 6 Updating Existing PO Files
2986 ****************************
2990 * msgmerge Invocation:: Invoking the `msgmerge' Program
2991 * Translated Entries:: Translated Entries
2992 * Fuzzy Entries:: Fuzzy Entries
2993 * Untranslated Entries:: Untranslated Entries
2994 * Obsolete Entries:: Obsolete Entries
2995 * Modifying Translations:: Modifying Translations
2996 * Modifying Comments:: Modifying Comments
2997 * Subedit:: Mode for Editing Translations
2998 * C Sources Context:: C Sources Context
2999 * Auxiliary:: Consulting Auxiliary PO Files
3000 * Compendium:: Using Translation Compendia
3003 File: gettext.info, Node: msgmerge Invocation, Next: Translated Entries, Prev: Updating, Up: Updating
3005 6.1 Invoking the `msgmerge' Program
3006 ===================================
3008 msgmerge [OPTION] DEF.po REF.pot
3010 The `msgmerge' program merges two Uniforum style .po files together.
3011 The DEF.po file is an existing PO file with translations which will be
3012 taken over to the newly created file as long as they still match;
3013 comments will be preserved, but extracted comments and file positions
3014 will be discarded. The REF.pot file is the last created PO file with
3015 up-to-date source references but old translations, or a PO Template file
3016 (generally created by `xgettext'); any translations or comments in the
3017 file will be discarded, however dot comments and file positions will be
3018 preserved. Where an exact match cannot be found, fuzzy matching is
3019 used to produce better results.
3021 6.1.1 Input file location
3022 -------------------------
3025 Translations referring to old sources.
3028 References to the new sources.
3031 `--directory=DIRECTORY'
3032 Add DIRECTORY to the list of directories. Source files are
3033 searched relative to this list of directories. The resulting `.po'
3034 file will be written relative to the current directory, though.
3038 Specify an additional library of message translations. *Note
3039 Compendium::. This option may be specified more than once.
3042 6.1.2 Operation mode
3043 --------------------
3047 Update DEF.po. Do nothing if DEF.po is already up to date.
3050 6.1.3 Output file location
3051 --------------------------
3054 `--output-file=FILE'
3055 Write output to specified file.
3058 The results are written to standard output if no output file is
3059 specified or if it is `-'.
3061 6.1.4 Output file location in update mode
3062 -----------------------------------------
3064 The result is written back to DEF.po.
3067 Make a backup of DEF.po
3070 Override the usual backup suffix.
3073 The version control method may be selected via the `--backup' option
3074 or through the `VERSION_CONTROL' environment variable. Here are the
3079 Never make backups (even if `--backup' is given).
3083 Make numbered backups.
3087 Make numbered backups if numbered backups for this file already
3088 exist, otherwise make simple backups.
3092 Always make simple backups.
3095 The backup suffix is `~', unless set with `--suffix' or the
3096 `SIMPLE_BACKUP_SUFFIX' environment variable.
3098 6.1.5 Operation modifiers
3099 -------------------------
3103 Apply REF.pot to each of the domains in DEF.po.
3106 `--no-fuzzy-matching'
3107 Do not use fuzzy matching when an exact match is not found. This
3108 may speed up the operation considerably.
3110 6.1.6 Input file syntax
3111 -----------------------
3114 `--properties-input'
3115 Assume the input files are Java ResourceBundles in Java
3116 `.properties' syntax, not in PO file syntax.
3118 `--stringtable-input'
3119 Assume the input files are NeXTstep/GNUstep localized resource
3120 files in `.strings' syntax, not in PO file syntax.
3123 6.1.7 Output details
3124 --------------------
3127 Always write an output file even if it contains no message.
3131 Write the .po file using indented style.
3134 Do not write `#: FILENAME:LINE' lines.
3137 Generate `#: FILENAME:LINE' lines (default).
3140 Write out a strict Uniforum conforming PO file. Note that this
3141 Uniforum format should be avoided because it doesn't support the
3145 `--properties-output'
3146 Write out a Java ResourceBundle in Java `.properties' syntax. Note
3147 that this file format doesn't support plural forms and silently
3148 drops obsolete messages.
3150 `--stringtable-output'
3151 Write out a NeXTstep/GNUstep localized resource file in `.strings'
3152 syntax. Note that this file format doesn't support plural forms.
3156 Set the output page width. Long strings in the output files will
3157 be split across multiple lines in order to ensure that each line's
3158 width (= number of screen columns) is less or equal to the given
3162 Do not break long message lines. Message lines whose width
3163 exceeds the output page width will not be split into several
3164 lines. Only file reference lines which are wider than the output
3165 page width will be split.
3169 Generate sorted output. Note that using this option makes it much
3170 harder for the translator to understand each message's context.
3174 Sort output by file location.
3177 6.1.8 Informative output
3178 ------------------------
3182 Display this help and exit.
3186 Output version information and exit.
3190 Increase verbosity level.
3195 Suppress progress indicators.
3199 File: gettext.info, Node: Translated Entries, Next: Fuzzy Entries, Prev: msgmerge Invocation, Up: Updating
3201 6.2 Translated Entries
3202 ======================
3204 Each PO file entry for which the `msgstr' field has been filled with a
3205 translation, and which is not marked as fuzzy (*note Fuzzy Entries::),
3206 is said to be a "translated" entry. Only translated entries will later
3207 be compiled by GNU `msgfmt' and become usable in programs. Other entry
3208 types will be excluded; translation will not occur for them.
3210 Some commands are more specifically related to translated entry
3214 Find the next translated entry (`po-next-translated-entry').
3217 Find the previous translated entry
3218 (`po-previous-translated-entry').
3221 The commands `t' (`po-next-translated-entry') and `T'
3222 (`po-previous-translated-entry') move forwards or backwards, chasing
3223 for an translated entry. If none is found, the search is extended and
3224 wraps around in the PO file buffer.
3226 Translated entries usually result from the translator having edited
3227 in a translation for them, *Note Modifying Translations::. However, if
3228 the variable `po-auto-fuzzy-on-edit' is not `nil', the entry having
3229 received a new translation first becomes a fuzzy entry, which ought to
3230 be later unfuzzied before becoming an official, genuine translated
3231 entry. *Note Fuzzy Entries::.
3234 File: gettext.info, Node: Fuzzy Entries, Next: Untranslated Entries, Prev: Translated Entries, Up: Updating
3239 Each PO file entry may have a set of "attributes", which are qualities
3240 given a name and explicitly associated with the translation, using a
3241 special system comment. One of these attributes has the name `fuzzy',
3242 and entries having this attribute are said to have a fuzzy translation.
3243 They are called fuzzy entries, for short.
3245 Fuzzy entries, even if they account for translated entries for most
3246 other purposes, usually call for revision by the translator. Those may
3247 be produced by applying the program `msgmerge' to update an older
3248 translated PO files according to a new PO template file, when this tool
3249 hypothesises that some new `msgid' has been modified only slightly out
3250 of an older one, and chooses to pair what it thinks to be the old
3251 translation for the new modified entry. The slight alteration in the
3252 original string (the `msgid' string) should often be reflected in the
3253 translated string, and this requires the intervention of the
3254 translator. For this reason, `msgmerge' might mark some entries as
3257 Also, the translator may decide herself to mark an entry as fuzzy
3258 for her own convenience, when she wants to remember that the entry has
3259 to be later revisited. So, some commands are more specifically related
3260 to fuzzy entry processing.
3263 Find the next fuzzy entry (`po-next-fuzzy-entry').
3266 Find the previous fuzzy entry (`po-previous-fuzzy-entry').
3269 Remove the fuzzy attribute of the current entry (`po-unfuzzy').
3272 The commands `z' (`po-next-fuzzy-entry') and `Z'
3273 (`po-previous-fuzzy-entry') move forwards or backwards, chasing for a
3274 fuzzy entry. If none is found, the search is extended and wraps around
3275 in the PO file buffer.
3277 The command `<TAB>' (`po-unfuzzy') removes the fuzzy attribute
3278 associated with an entry, usually leaving it translated. Further, if
3279 the variable `po-auto-select-on-unfuzzy' has not the `nil' value, the
3280 `<TAB>' command will automatically chase for another interesting entry
3281 to work on. The initial value of `po-auto-select-on-unfuzzy' is `nil'.
3283 The initial value of `po-auto-fuzzy-on-edit' is `nil'. However, if
3284 the variable `po-auto-fuzzy-on-edit' is set to `t', any entry edited
3285 through the `<RET>' command is marked fuzzy, as a way to ensure some
3286 kind of double check, later. In this case, the usual paradigm is that
3287 an entry becomes fuzzy (if not already) whenever the translator
3288 modifies it. If she is satisfied with the translation, she then uses
3289 `<TAB>' to pick another entry to work on, clearing the fuzzy attribute
3290 on the same blow. If she is not satisfied yet, she merely uses `<SPC>'
3291 to chase another entry, leaving the entry fuzzy.
3293 The translator may also use the `<DEL>' command
3294 (`po-fade-out-entry') over any translated entry to mark it as being
3295 fuzzy, when she wants to easily leave a trace she wants to later return
3296 working at this entry.
3298 Also, when time comes to quit working on a PO file buffer with the
3299 `q' command, the translator is asked for confirmation, if fuzzy string
3303 File: gettext.info, Node: Untranslated Entries, Next: Obsolete Entries, Prev: Fuzzy Entries, Up: Updating
3305 6.4 Untranslated Entries
3306 ========================
3308 When `xgettext' originally creates a PO file, unless told otherwise, it
3309 initializes the `msgid' field with the untranslated string, and leaves
3310 the `msgstr' string to be empty. Such entries, having an empty
3311 translation, are said to be "untranslated" entries. Later, when the
3312 programmer slightly modifies some string right in the program, this
3313 change is later reflected in the PO file by the appearance of a new
3314 untranslated entry for the modified string.
3316 The usual commands moving from entry to entry consider untranslated
3317 entries on the same level as active entries. Untranslated entries are
3318 easily recognizable by the fact they end with `msgstr ""'.
3320 The work of the translator might be (quite naively) seen as the
3321 process of seeking for an untranslated entry, editing a translation for
3322 it, and repeating these actions until no untranslated entries remain.
3323 Some commands are more specifically related to untranslated entry
3327 Find the next untranslated entry (`po-next-untranslated-entry').
3330 Find the previous untranslated entry
3331 (`po-previous-untransted-entry').
3334 Turn the current entry into an untranslated one (`po-kill-msgstr').
3337 The commands `u' (`po-next-untranslated-entry') and `U'
3338 (`po-previous-untransted-entry') move forwards or backwards, chasing
3339 for an untranslated entry. If none is found, the search is extended
3340 and wraps around in the PO file buffer.
3342 An entry can be turned back into an untranslated entry by merely
3343 emptying its translation, using the command `k' (`po-kill-msgstr').
3344 *Note Modifying Translations::.
3346 Also, when time comes to quit working on a PO file buffer with the
3347 `q' command, the translator is asked for confirmation, if some
3348 untranslated string still exists.
3351 File: gettext.info, Node: Obsolete Entries, Next: Modifying Translations, Prev: Untranslated Entries, Up: Updating
3353 6.5 Obsolete Entries
3354 ====================
3356 By "obsolete" PO file entries, we mean those entries which are
3357 commented out, usually by `msgmerge' when it found that the translation
3358 is not needed anymore by the package being localized.
3360 The usual commands moving from entry to entry consider obsolete
3361 entries on the same level as active entries. Obsolete entries are
3362 easily recognizable by the fact that all their lines start with `#',
3363 even those lines containing `msgid' or `msgstr'.
3365 Commands exist for emptying the translation or reinitializing it to
3366 the original untranslated string. Commands interfacing with the kill
3367 ring may force some previously saved text into the translation. The
3368 user may interactively edit the translation. All these commands may
3369 apply to obsolete entries, carefully leaving the entry obsolete after
3372 Moreover, some commands are more specifically related to obsolete
3376 Find the next obsolete entry (`po-next-obsolete-entry').
3379 Find the previous obsolete entry (`po-previous-obsolete-entry').
3382 Make an active entry obsolete, or zap out an obsolete entry
3383 (`po-fade-out-entry').
3386 The commands `o' (`po-next-obsolete-entry') and `O'
3387 (`po-previous-obsolete-entry') move forwards or backwards, chasing for
3388 an obsolete entry. If none is found, the search is extended and wraps
3389 around in the PO file buffer.
3391 PO mode does not provide ways for un-commenting an obsolete entry
3392 and making it active, because this would reintroduce an original
3393 untranslated string which does not correspond to any marked string in
3394 the program sources. This goes with the philosophy of never
3395 introducing useless `msgid' values.
3397 However, it is possible to comment out an active entry, so making it
3398 obsolete. GNU `gettext' utilities will later react to the
3399 disappearance of a translation by using the untranslated string. The
3400 command `<DEL>' (`po-fade-out-entry') pushes the current entry a little
3401 further towards annihilation. If the entry is active (it is a
3402 translated entry), then it is first made fuzzy. If it is already fuzzy,
3403 then the entry is merely commented out, with confirmation. If the entry
3404 is already obsolete, then it is completely deleted from the PO file.
3405 It is easy to recycle the translation so deleted into some other PO file
3406 entry, usually one which is untranslated. *Note Modifying
3409 Here is a quite interesting problem to solve for later development of
3410 PO mode, for those nights you are not sleepy. The idea would be that
3411 PO mode might become bright enough, one of these days, to make good
3412 guesses at retrieving the most probable candidate, among all obsolete
3413 entries, for initializing the translation of a newly appeared string.
3414 I think it might be a quite hard problem to do this algorithmically, as
3415 we have to develop good and efficient measures of string similarity.
3416 Right now, PO mode completely lets the decision to the translator, when
3417 the time comes to find the adequate obsolete translation, it merely
3418 tries to provide handy tools for helping her to do so.
3421 File: gettext.info, Node: Modifying Translations, Next: Modifying Comments, Prev: Obsolete Entries, Up: Updating
3423 6.6 Modifying Translations
3424 ==========================
3426 PO mode prevents direct modification of the PO file, by the usual means
3427 Emacs gives for altering a buffer's contents. By doing so, it pretends
3428 helping the translator to avoid little clerical errors about the
3429 overall file format, or the proper quoting of strings, as those errors
3430 would be easily made. Other kinds of errors are still possible, but
3431 some may be caught and diagnosed by the batch validation process, which
3432 the translator may always trigger by the `V' command. For all other
3433 errors, the translator has to rely on her own judgment, and also on the
3434 linguistic reports submitted to her by the users of the translated
3435 package, having the same mother tongue.
3437 When the time comes to create a translation, correct an error
3438 diagnosed mechanically or reported by a user, the translators have to
3439 resort to using the following commands for modifying the translations.
3442 Interactively edit the translation (`po-edit-msgstr').
3446 Reinitialize the translation with the original, untranslated string
3447 (`po-msgid-to-msgstr').
3450 Save the translation on the kill ring, and delete it
3454 Save the translation on the kill ring, without deleting it
3455 (`po-kill-ring-save-msgstr').
3458 Replace the translation, taking the new from the kill ring
3462 The command `<RET>' (`po-edit-msgstr') opens a new Emacs window
3463 meant to edit in a new translation, or to modify an already existing
3464 translation. The new window contains a copy of the translation taken
3465 from the current PO file entry, all ready for edition, expunged of all
3466 quoting marks, fully modifiable and with the complete extent of Emacs
3467 modifying commands. When the translator is done with her
3468 modifications, she may use `C-c C-c' to close the subedit window with
3469 the automatically requoted results, or `C-c C-k' to abort her
3470 modifications. *Note Subedit::, for more information.
3472 The command `<LFD>' (`po-msgid-to-msgstr') initializes, or
3473 reinitializes the translation with the original string. This command is
3474 normally used when the translator wants to redo a fresh translation of
3475 the original string, disregarding any previous work.
3477 It is possible to arrange so, whenever editing an untranslated
3478 entry, the `<LFD>' command be automatically executed. If you set
3479 `po-auto-edit-with-msgid' to `t', the translation gets initialised with
3480 the original string, in case none exists already. The default value
3481 for `po-auto-edit-with-msgid' is `nil'.
3483 In fact, whether it is best to start a translation with an empty
3484 string, or rather with a copy of the original string, is a matter of
3485 taste or habit. Sometimes, the source language and the target language
3486 are so different that is simply best to start writing on an empty page.
3487 At other times, the source and target languages are so close that it
3488 would be a waste to retype a number of words already being written in
3489 the original string. A translator may also like having the original
3490 string right under her eyes, as she will progressively overwrite the
3491 original text with the translation, even if this requires some extra
3492 editing work to get rid of the original.
3494 The command `k' (`po-kill-msgstr') merely empties the translation
3495 string, so turning the entry into an untranslated one. But while doing
3496 so, its previous contents is put apart in a special place, known as the
3497 kill ring. The command `w' (`po-kill-ring-save-msgstr') has also the
3498 effect of taking a copy of the translation onto the kill ring, but it
3499 otherwise leaves the entry alone, and does _not_ remove the translation
3500 from the entry. Both commands use exactly the Emacs kill ring, which
3501 is shared between buffers, and which is well known already to Emacs
3504 The translator may use `k' or `w' many times in the course of her
3505 work, as the kill ring may hold several saved translations. From the
3506 kill ring, strings may later be reinserted in various Emacs buffers.
3507 In particular, the kill ring may be used for moving translation strings
3508 between different entries of a single PO file buffer, or if the
3509 translator is handling many such buffers at once, even between PO files.
3511 To facilitate exchanges with buffers which are not in PO mode, the
3512 translation string put on the kill ring by the `k' command is fully
3513 unquoted before being saved: external quotes are removed, multi-line
3514 strings are concatenated, and backslash escaped sequences are turned
3515 into their corresponding characters. In the special case of obsolete
3516 entries, the translation is also uncommented prior to saving.
3518 The command `y' (`po-yank-msgstr') completely replaces the
3519 translation of the current entry by a string taken from the kill ring.
3520 Following Emacs terminology, we then say that the replacement string is
3521 "yanked" into the PO file buffer. *Note Yanking: (emacs)Yanking. The
3522 first time `y' is used, the translation receives the value of the most
3523 recent addition to the kill ring. If `y' is typed once again,
3524 immediately, without intervening keystrokes, the translation just
3525 inserted is taken away and replaced by the second most recent addition
3526 to the kill ring. By repeating `y' many times in a row, the translator
3527 may travel along the kill ring for saved strings, until she finds the
3528 string she really wanted.
3530 When a string is yanked into a PO file entry, it is fully and
3531 automatically requoted for complying with the format PO files should
3532 have. Further, if the entry is obsolete, PO mode then appropriately
3533 push the inserted string inside comments. Once again, translators
3534 should not burden themselves with quoting considerations besides, of
3535 course, the necessity of the translated string itself respective to the
3538 Note that `k' or `w' are not the only commands pushing strings on
3539 the kill ring, as almost any PO mode command replacing translation
3540 strings (or the translator comments) automatically saves the old string
3541 on the kill ring. The main exceptions to this general rule are the
3542 yanking commands themselves.
3544 To better illustrate the operation of killing and yanking, let's use
3545 an actual example, taken from a common situation. When the programmer
3546 slightly modifies some string right in the program, his change is later
3547 reflected in the PO file by the appearance of a new untranslated entry
3548 for the modified string, and the fact that the entry translating the
3549 original or unmodified string becomes obsolete. In many cases, the
3550 translator might spare herself some work by retrieving the unmodified
3551 translation from the obsolete entry, then initializing the untranslated
3552 entry `msgstr' field with this retrieved translation. Once this done,
3553 the obsolete entry is not wanted anymore, and may be safely deleted.
3555 When the translator finds an untranslated entry and suspects that a
3556 slight variant of the translation exists, she immediately uses `m' to
3557 mark the current entry location, then starts chasing obsolete entries
3558 with `o', hoping to find some translation corresponding to the
3559 unmodified string. Once found, she uses the `<DEL>' command for
3560 deleting the obsolete entry, knowing that `<DEL>' also _kills_ the
3561 translation, that is, pushes the translation on the kill ring. Then,
3562 `r' returns to the initial untranslated entry, and `y' then _yanks_ the
3563 saved translation right into the `msgstr' field. The translator is
3564 then free to use `<RET>' for fine tuning the translation contents, and
3565 maybe to later use `u', then `m' again, for going on with the next
3566 untranslated string.
3568 When some sequence of keys has to be typed over and over again, the
3569 translator may find it useful to become better acquainted with the Emacs
3570 capability of learning these sequences and playing them back under
3571 request. *Note Keyboard Macros: (emacs)Keyboard Macros.
3574 File: gettext.info, Node: Modifying Comments, Next: Subedit, Prev: Modifying Translations, Up: Updating
3576 6.7 Modifying Comments
3577 ======================
3579 Any translation work done seriously will raise many linguistic
3580 difficulties, for which decisions have to be made, and the choices
3581 further documented. These documents may be saved within the PO file in
3582 form of translator comments, which the translator is free to create,
3583 delete, or modify at will. These comments may be useful to herself
3584 when she returns to this PO file after a while.
3586 Comments not having whitespace after the initial `#', for example,
3587 those beginning with `#.' or `#:', are _not_ translator comments, they
3588 are exclusively created by other `gettext' tools. So, the commands
3589 below will never alter such system added comments, they are not meant
3590 for the translator to modify. *Note PO Files::.
3592 The following commands are somewhat similar to those modifying
3593 translations, so the general indications given for those apply here.
3594 *Note Modifying Translations::.
3597 Interactively edit the translator comments (`po-edit-comment').
3600 Save the translator comments on the kill ring, and delete it
3601 (`po-kill-comment').
3604 Save the translator comments on the kill ring, without deleting it
3605 (`po-kill-ring-save-comment').
3608 Replace the translator comments, taking the new from the kill ring
3609 (`po-yank-comment').
3612 These commands parallel PO mode commands for modifying the
3613 translation strings, and behave much the same way as they do, except
3614 that they handle this part of PO file comments meant for translator
3615 usage, rather than the translation strings. So, if the descriptions
3616 given below are slightly succinct, it is because the full details have
3617 already been given. *Note Modifying Translations::.
3619 The command `#' (`po-edit-comment') opens a new Emacs window
3620 containing a copy of the translator comments on the current PO file
3621 entry. If there are no such comments, PO mode understands that the
3622 translator wants to add a comment to the entry, and she is presented
3623 with an empty screen. Comment marks (`#') and the space following them
3624 are automatically removed before edition, and reinstated after. For
3625 translator comments pertaining to obsolete entries, the uncommenting
3626 and recommenting operations are done twice. Once in the editing
3627 window, the keys `C-c C-c' allow the translator to tell she is finished
3628 with editing the comment. *Note Subedit::, for further details.
3630 Functions found on `po-subedit-mode-hook', if any, are executed after
3631 the string has been inserted in the edit buffer.
3633 The command `K' (`po-kill-comment') gets rid of all translator
3634 comments, while saving those comments on the kill ring. The command
3635 `W' (`po-kill-ring-save-comment') takes a copy of the translator
3636 comments on the kill ring, but leaves them undisturbed in the current
3637 entry. The command `Y' (`po-yank-comment') completely replaces the
3638 translator comments by a string taken at the front of the kill ring.
3639 When this command is immediately repeated, the comments just inserted
3640 are withdrawn, and replaced by other strings taken along the kill ring.
3642 On the kill ring, all strings have the same nature. There is no
3643 distinction between _translation_ strings and _translator comments_
3644 strings. So, for example, let's presume the translator has just
3645 finished editing a translation, and wants to create a new translator
3646 comment to document why the previous translation was not good, just to
3647 remember what was the problem. Foreseeing that she will do that in her
3648 documentation, the translator may want to quote the previous
3649 translation in her translator comments. To do so, she may initialize
3650 the translator comments with the previous translation, still at the
3651 head of the kill ring. Because editing already pushed the previous
3652 translation on the kill ring, she merely has to type `M-w' prior to
3653 `#', and the previous translation will be right there, all ready for
3654 being introduced by some explanatory text.
3656 On the other hand, presume there are some translator comments already
3657 and that the translator wants to add to those comments, instead of
3658 wholly replacing them. Then, she should edit the comment right away
3659 with `#'. Once inside the editing window, she can use the regular
3660 Emacs commands `C-y' (`yank') and `M-y' (`yank-pop') to get the
3661 previous translation where she likes.
3664 File: gettext.info, Node: Subedit, Next: C Sources Context, Prev: Modifying Comments, Up: Updating
3666 6.8 Details of Sub Edition
3667 ==========================
3669 The PO subedit minor mode has a few peculiarities worth being described
3670 in fuller detail. It installs a few commands over the usual editing set
3671 of Emacs, which are described below.
3674 Complete edition (`po-subedit-exit').
3677 Abort edition (`po-subedit-abort').
3680 Consult auxiliary PO files (`po-subedit-cycle-auxiliary').
3683 The window's contents represents a translation for a given message,
3684 or a translator comment. The translator may modify this window to her
3685 heart's content. Once this is done, the command `C-c C-c'
3686 (`po-subedit-exit') may be used to return the edited translation into
3687 the PO file, replacing the original translation, even if it moved out of
3688 sight or if buffers were switched.
3690 If the translator becomes unsatisfied with her translation or
3691 comment, to the extent she prefers keeping what was existent prior to
3692 the `<RET>' or `#' command, she may use the command `C-c C-k'
3693 (`po-subedit-abort') to merely get rid of edition, while preserving the
3694 original translation or comment. Another way would be for her to exit
3695 normally with `C-c C-c', then type `U' once for undoing the whole
3696 effect of last edition.
3698 The command `C-c C-a' (`po-subedit-cycle-auxiliary') allows for
3699 glancing through translations already achieved in other languages,
3700 directly while editing the current translation. This may be quite
3701 convenient when the translator is fluent at many languages, but of
3702 course, only makes sense when such completed auxiliary PO files are
3703 already available to her (*note Auxiliary::).
3705 Functions found on `po-subedit-mode-hook', if any, are executed after
3706 the string has been inserted in the edit buffer.
3708 While editing her translation, the translator should pay attention
3709 to not inserting unwanted `<RET>' (newline) characters at the end of
3710 the translated string if those are not meant to be there, or to removing
3711 such characters when they are required. Since these characters are not
3712 visible in the editing buffer, they are easily introduced by mistake.
3713 To help her, `<RET>' automatically puts the character `<' at the end of
3714 the string being edited, but this `<' is not really part of the string.
3715 On exiting the editing window with `C-c C-c', PO mode automatically
3716 removes such `<' and all whitespace added after it. If the translator
3717 adds characters after the terminating `<', it looses its delimiting
3718 property and integrally becomes part of the string. If she removes the
3719 delimiting `<', then the edited string is taken _as is_, with all
3720 trailing newlines, even if invisible. Also, if the translated string
3721 ought to end itself with a genuine `<', then the delimiting `<' may not
3722 be removed; so the string should appear, in the editing window, as
3723 ending with two `<' in a row.
3725 When a translation (or a comment) is being edited, the translator
3726 may move the cursor back into the PO file buffer and freely move to
3727 other entries, browsing at will. If, with an edition pending, the
3728 translator wanders in the PO file buffer, she may decide to start
3729 modifying another entry. Each entry being edited has its own subedit
3730 buffer. It is possible to simultaneously edit the translation _and_
3731 the comment of a single entry, or to edit entries in different PO
3732 files, all at once. Typing `<RET>' on a field already being edited
3733 merely resumes that particular edit. Yet, the translator should better
3734 be comfortable at handling many Emacs windows!
3736 Pending subedits may be completed or aborted in any order, regardless
3737 of how or when they were started. When many subedits are pending and
3738 the translator asks for quitting the PO file (with the `q' command),
3739 subedits are automatically resumed one at a time, so she may decide for
3743 File: gettext.info, Node: C Sources Context, Next: Auxiliary, Prev: Subedit, Up: Updating
3745 6.9 C Sources Context
3746 =====================
3748 PO mode is particularly powerful when used with PO files created
3749 through GNU `gettext' utilities, as those utilities insert special
3750 comments in the PO files they generate. Some of these special comments
3751 relate the PO file entry to exactly where the untranslated string
3752 appears in the program sources.
3754 When the translator gets to an untranslated entry, she is fairly
3755 often faced with an original string which is not as informative as it
3756 normally should be, being succinct, cryptic, or otherwise ambiguous.
3757 Before choosing how to translate the string, she needs to understand
3758 better what the string really means and how tight the translation has
3759 to be. Most of the time, when problems arise, the only way left to make
3760 her judgment is looking at the true program sources from where this
3761 string originated, searching for surrounding comments the programmer
3762 might have put in there, and looking around for helping clues of _any_
3765 Surely, when looking at program sources, the translator will receive
3766 more help if she is a fluent programmer. However, even if she is not
3767 versed in programming and feels a little lost in C code, the translator
3768 should not be shy at taking a look, once in a while. It is most
3769 probable that she will still be able to find some of the hints she
3770 needs. She will learn quickly to not feel uncomfortable in program
3771 code, paying more attention to programmer's comments, variable and
3772 function names (if he dared choosing them well), and overall
3773 organization, than to the program code itself.
3775 The following commands are meant to help the translator at getting
3776 program source context for a PO file entry.
3779 Resume the display of a program source context, or cycle through
3780 them (`po-cycle-source-reference').
3783 Display of a program source context selected by menu
3784 (`po-select-source-reference').
3787 Add a directory to the search path for source files
3788 (`po-consider-source-path').
3791 Delete a directory from the search path for source files
3792 (`po-ignore-source-path').
3795 The commands `s' (`po-cycle-source-reference') and `M-s'
3796 (`po-select-source-reference') both open another window displaying some
3797 source program file, and already positioned in such a way that it shows
3798 an actual use of the string to be translated. By doing so, the command
3799 gives source program context for the string. But if the entry has no
3800 source context references, or if all references are unresolved along
3801 the search path for program sources, then the command diagnoses this as
3804 Even if `s' (or `M-s') opens a new window, the cursor stays in the
3805 PO file window. If the translator really wants to get into the program
3806 source window, she ought to do it explicitly, maybe by using command
3809 When `s' is typed for the first time, or for a PO file entry which
3810 is different of the last one used for getting source context, then the
3811 command reacts by giving the first context available for this entry, if
3812 any. If some context has already been recently displayed for the
3813 current PO file entry, and the translator wandered off to do other
3814 things, typing `s' again will merely resume, in another window, the
3815 context last displayed. In particular, if the translator moved the
3816 cursor away from the context in the source file, the command will bring
3817 the cursor back to the context. By using `s' many times in a row, with
3818 no other commands intervening, PO mode will cycle to the next available
3819 contexts for this particular entry, getting back to the first context
3820 once the last has been shown.
3822 The command `M-s' behaves differently. Instead of cycling through
3823 references, it lets the translator choose a particular reference among
3824 many, and displays that reference. It is best used with completion, if
3825 the translator types `<TAB>' immediately after `M-s', in response to
3826 the question, she will be offered a menu of all possible references, as
3827 a reminder of which are the acceptable answers. This command is useful
3828 only where there are really many contexts available for a single string
3831 Program source files are usually found relative to where the PO file
3832 stands. As a special provision, when this fails, the file is also
3833 looked for, but relative to the directory immediately above it. Those
3834 two cases take proper care of most PO files. However, it might happen
3835 that a PO file has been moved, or is edited in a different place than
3836 its normal location. When this happens, the translator should tell PO
3837 mode in which directory normally sits the genuine PO file. Many such
3838 directories may be specified, and all together, they constitute what is
3839 called the "search path" for program sources. The command `S'
3840 (`po-consider-source-path') is used to interactively enter a new
3841 directory at the front of the search path, and the command `M-S'
3842 (`po-ignore-source-path') is used to select, with completion, one of
3843 the directories she does not want anymore on the search path.
3846 File: gettext.info, Node: Auxiliary, Next: Compendium, Prev: C Sources Context, Up: Updating
3848 6.10 Consulting Auxiliary PO Files
3849 ==================================
3851 PO mode is able to help the knowledgeable translator, being fluent in
3852 many languages, at taking advantage of translations already achieved in
3853 other languages she just happens to know. It provides these other
3854 language translations as additional context for her own work. Moreover,
3855 it has features to ease the production of translations for many
3856 languages at once, for translators preferring to work in this way.
3858 An "auxiliary" PO file is an existing PO file meant for the same
3859 package the translator is working on, but targeted to a different mother
3860 tongue language. Commands exist for declaring and handling auxiliary
3861 PO files, and also for showing contexts for the entry under work.
3863 Here are the auxiliary file commands available in PO mode.
3866 Seek auxiliary files for another translation for the same entry
3867 (`po-cycle-auxiliary').
3870 Switch to a particular auxiliary file (`po-select-auxiliary').
3873 Declare this PO file as an auxiliary file
3874 (`po-consider-as-auxiliary').
3877 Remove this PO file from the list of auxiliary files
3878 (`po-ignore-as-auxiliary').
3881 Command `A' (`po-consider-as-auxiliary') adds the current PO file to
3882 the list of auxiliary files, while command `M-A'
3883 (`po-ignore-as-auxiliary' just removes it.
3885 The command `a' (`po-cycle-auxiliary') seeks all auxiliary PO files,
3886 round-robin, searching for a translated entry in some other language
3887 having an `msgid' field identical as the one for the current entry.
3888 The found PO file, if any, takes the place of the current PO file in
3889 the display (its window gets on top). Before doing so, the current PO
3890 file is also made into an auxiliary file, if not already. So, `a' in
3891 this newly displayed PO file will seek another PO file, and so on, so
3892 repeating `a' will eventually yield back the original PO file.
3894 The command `C-c C-a' (`po-select-auxiliary') asks the translator
3895 for her choice of a particular auxiliary file, with completion, and
3896 then switches to that selected PO file. The command also checks if the
3897 selected file has an `msgid' field identical as the one for the current
3898 entry, and if yes, this entry becomes current. Otherwise, the cursor
3899 of the selected file is left undisturbed.
3901 For all this to work fully, auxiliary PO files will have to be
3902 normalized, in that way that `msgid' fields should be written _exactly_
3903 the same way. It is possible to write `msgid' fields in various ways
3904 for representing the same string, different writing would break the
3905 proper behaviour of the auxiliary file commands of PO mode. This is not
3906 expected to be much a problem in practice, as most existing PO files
3907 have their `msgid' entries written by the same GNU `gettext' tools.
3909 However, PO files initially created by PO mode itself, while marking
3910 strings in source files, are normalised differently. So are PO files
3911 resulting of the the `M-x normalize' command. Until these
3912 discrepancies between PO mode and other GNU `gettext' tools get fully
3913 resolved, the translator should stay aware of normalisation issues.
3916 File: gettext.info, Node: Compendium, Prev: Auxiliary, Up: Updating
3918 6.11 Using Translation Compendia
3919 ================================
3921 A "compendium" is a special PO file containing a set of translations
3922 recurring in many different packages. The translator can use gettext
3923 tools to build a new compendium, to add entries to her compendium, and
3924 to initialize untranslated entries, or to update already translated
3925 entries, from translations kept in the compendium.
3929 * Creating Compendia:: Merging translations for later use
3930 * Using Compendia:: Using older translations if they fit
3933 File: gettext.info, Node: Creating Compendia, Next: Using Compendia, Prev: Compendium, Up: Compendium
3935 6.11.1 Creating Compendia
3936 -------------------------
3938 Basically every PO file consisting of translated entries only can be
3939 declared as a valid compendium. Often the translator wants to have
3940 special compendia; let's consider two cases: `concatenating PO files'
3941 and `extracting a message subset from a PO file'.
3943 6.11.1.1 Concatenate PO Files
3944 .............................
3946 To concatenate several valid PO files into one compendium file you can
3947 use `msgcomm' or `msgcat' (the latter preferred):
3949 msgcat -o compendium.po file1.po file2.po
3951 By default, `msgcat' will accumulate divergent translations for the
3952 same string. Those occurences will be marked as `fuzzy' and highly
3953 visible decorated; calling `msgcat' on `file1.po':
3957 msgid "Report bugs to <%s>.\n"
3958 msgstr "Comunicar `bugs' a <%s>.\n"
3964 msgid "Report bugs to <%s>.\n"
3965 msgstr "Comunicar \"bugs\" a <%s>.\n"
3969 #: src/hello.c:200 src/bye.c:100
3971 msgid "Report bugs to <%s>.\n"
3973 "#-#-#-#-# file1.po #-#-#-#-#\n"
3974 "Comunicar `bugs' a <%s>.\n"
3975 "#-#-#-#-# file2.po #-#-#-#-#\n"
3976 "Comunicar \"bugs\" a <%s>.\n"
3978 The translator will have to resolve this "conflict" manually; she has
3979 to decide whether the first or the second version is appropriate (or
3980 provide a new translation), to delete the "marker lines", and finally
3981 to remove the `fuzzy' mark.
3983 If the translator knows in advance the first found translation of a
3984 message is always the best translation she can make use to the
3985 `--use-first' switch:
3987 msgcat --use-first -o compendium.po file1.po file2.po
3989 A good compendium file must not contain `fuzzy' or untranslated
3990 entries. If input files are "dirty" you must preprocess the input
3991 files or postprocess the result using `msgattrib --translated
3994 6.11.1.2 Extract a Message Subset from a PO File
3995 ................................................
3997 Nobody wants to translate the same messages again and again; thus you
3998 may wish to have a compendium file containing `getopt.c' messages.
4000 To extract a message subset (e.g., all `getopt.c' messages) from an
4001 existing PO file into one compendium file you can use `msggrep':
4003 msggrep --location src/getopt.c -o compendium.po file.po
4006 File: gettext.info, Node: Using Compendia, Prev: Creating Compendia, Up: Compendium
4008 6.11.2 Using Compendia
4009 ----------------------
4011 You can use a compendium file to initialize a translation from scratch
4012 or to update an already existing translation.
4014 6.11.2.1 Initialize a New Translation File
4015 ..........................................
4017 Since a PO file with translations does not exist the translator can
4018 merely use `/dev/null' to fake the "old" translation file.
4020 msgmerge --compendium compendium.po -o file.po /dev/null file.pot
4022 6.11.2.2 Update an Existing Translation File
4023 ............................................
4025 Concatenate the compendium file(s) and the existing PO, merge the
4026 result with the POT file and remove the obsolete entries (optional,
4027 here done using `sed'):
4029 msgcat --use-first -o update.po compendium1.po compendium2.po file.po
4030 msgmerge update.po file.pot | sed -e '/^#~/d' > file.po
4033 File: gettext.info, Node: Manipulating, Next: Binaries, Prev: Updating, Up: Top
4035 7 Manipulating PO Files
4036 ***********************
4038 Sometimes it is necessary to manipulate PO files in a way that is better
4039 performed automatically than by hand. GNU `gettext' includes a
4040 complete set of tools for this purpose.
4042 When merging two packages into a single package, the resulting POT
4043 file will be the concatenation of the two packages' POT files. Thus the
4044 maintainer must concatenate the two existing package translations into
4045 a single translation catalog, for each language. This is best performed
4046 using `msgcat'. It is then the translators' duty to deal with any
4047 possible conflicts that arose during the merge.
4049 When a translator takes over the translation job from another
4050 translator, but she uses a different character encoding in her locale,
4051 she will convert the catalog to her character encoding. This is best
4052 done through the `msgconv' program.
4054 When a maintainer takes a source file with tagged messages from
4055 another package, he should also take the existing translations for this
4056 source file (and not let the translators do the same job twice). One
4057 way to do this is through `msggrep', another is to create a POT file for
4058 that source file and use `msgmerge'.
4060 When a translator wants to adjust some translation catalog for a
4061 special dialect or orthography -- for example, German as written in
4062 Switzerland versus German as written in Germany -- she needs to apply
4063 some text processing to every message in the catalog. The tool for
4064 doing this is `msgfilter'.
4066 Another use of `msgfilter' is to produce approximately the POT file
4067 for which a given PO file was made. This can be done through a filter
4068 command like `msgfilter sed -e d | sed -e '/^# /d''. Note that the
4069 original POT file may have had different comments and different plural
4070 message counts, that's why it's better to use the original POT file if
4073 When a translator wants to check her translations, for example
4074 according to orthography rules or using a non-interactive spell
4075 checker, she can do so using the `msgexec' program.
4077 When third party tools create PO or POT files, sometimes duplicates
4078 cannot be avoided. But the GNU `gettext' tools give an error when they
4079 encounter duplicate msgids in the same file and in the same domain. To
4080 merge duplicates, the `msguniq' program can be used.
4082 `msgcomm' is a more general tool for keeping or throwing away
4083 duplicates, occurring in different files.
4085 `msgcmp' can be used to check whether a translation catalog is
4086 completely translated.
4088 `msgattrib' can be used to select and extract only the fuzzy or
4089 untranslated messages of a translation catalog.
4091 `msgen' is useful as a first step for preparing English translation
4092 catalogs. It copies each message's msgid to its msgstr.
4094 Finally, for those applications where all these various programs are
4095 not sufficient, a library `libgettextpo' is provided that can be used to
4096 write other specialized programs that process PO files.
4100 * msgcat Invocation:: Invoking the `msgcat' Program
4101 * msgconv Invocation:: Invoking the `msgconv' Program
4102 * msggrep Invocation:: Invoking the `msggrep' Program
4103 * msgfilter Invocation:: Invoking the `msgfilter' Program
4104 * msguniq Invocation:: Invoking the `msguniq' Program
4105 * msgcomm Invocation:: Invoking the `msgcomm' Program
4106 * msgcmp Invocation:: Invoking the `msgcmp' Program
4107 * msgattrib Invocation:: Invoking the `msgattrib' Program
4108 * msgen Invocation:: Invoking the `msgen' Program
4109 * msgexec Invocation:: Invoking the `msgexec' Program
4110 * libgettextpo:: Writing your own programs that process PO files
4113 File: gettext.info, Node: msgcat Invocation, Next: msgconv Invocation, Prev: Manipulating, Up: Manipulating
4115 7.1 Invoking the `msgcat' Program
4116 =================================
4118 msgcat [OPTION] [INPUTFILE]...
4120 The `msgcat' program concatenates and merges the specified PO files.
4121 It finds messages which are common to two or more of the specified PO
4122 files. By using the `--more-than' option, greater commonality may be
4123 requested before messages are printed. Conversely, the `--less-than'
4124 option may be used to specify less commonality before messages are
4125 printed (i.e. `--less-than=2' will only print the unique messages).
4126 Translations, comments and extract comments will be cumulated, except
4127 that if `--use-first' is specified, they will be taken from the first
4128 PO file to define them. File positions from all PO files will be
4131 7.1.1 Input file location
4132 -------------------------
4139 Read the names of the input files from FILE instead of getting
4140 them from the command line.
4143 `--directory=DIRECTORY'
4144 Add DIRECTORY to the list of directories. Source files are
4145 searched relative to this list of directories. The resulting `.po'
4146 file will be written relative to the current directory, though.
4149 If INPUTFILE is `-', standard input is read.
4151 7.1.2 Output file location
4152 --------------------------
4155 `--output-file=FILE'
4156 Write output to specified file.
4159 The results are written to standard output if no output file is
4160 specified or if it is `-'.
4162 7.1.3 Message selection
4163 -----------------------
4166 `--less-than=NUMBER'
4167 Print messages with less than NUMBER definitions, defaults to
4168 infinite if not set.
4171 `--more-than=NUMBER'
4172 Print messages with more than NUMBER definitions, defaults to 0 if
4177 Shorthand for `--less-than=2'. Requests that only unique messages
4181 7.1.4 Input file syntax
4182 -----------------------
4185 `--properties-input'
4186 Assume the input files are Java ResourceBundles in Java
4187 `.properties' syntax, not in PO file syntax.
4189 `--stringtable-input'
4190 Assume the input files are NeXTstep/GNUstep localized resource
4191 files in `.strings' syntax, not in PO file syntax.
4194 7.1.5 Output details
4195 --------------------
4199 Specify encoding for output.
4202 Use first available translation for each message. Don't merge
4203 several translations into one.
4206 Always write an output file even if it contains no message.
4210 Write the .po file using indented style.
4213 Do not write `#: FILENAME:LINE' lines.
4217 Generate `#: FILENAME:LINE' lines (default).
4220 Write out a strict Uniforum conforming PO file. Note that this
4221 Uniforum format should be avoided because it doesn't support the
4225 `--properties-output'
4226 Write out a Java ResourceBundle in Java `.properties' syntax. Note
4227 that this file format doesn't support plural forms and silently
4228 drops obsolete messages.
4230 `--stringtable-output'
4231 Write out a NeXTstep/GNUstep localized resource file in `.strings'
4232 syntax. Note that this file format doesn't support plural forms.
4236 Set the output page width. Long strings in the output files will
4237 be split across multiple lines in order to ensure that each line's
4238 width (= number of screen columns) is less or equal to the given
4242 Do not break long message lines. Message lines whose width
4243 exceeds the output page width will not be split into several
4244 lines. Only file reference lines which are wider than the output
4245 page width will be split.
4249 Generate sorted output. Note that using this option makes it much
4250 harder for the translator to understand each message's context.
4254 Sort output by file location.
4257 7.1.6 Informative output
4258 ------------------------
4262 Display this help and exit.
4266 Output version information and exit.
4270 File: gettext.info, Node: msgconv Invocation, Next: msggrep Invocation, Prev: msgcat Invocation, Up: Manipulating
4272 7.2 Invoking the `msgconv' Program
4273 ==================================
4275 msgconv [OPTION] [INPUTFILE]
4277 The `msgconv' program converts a translation catalog to a different
4280 7.2.1 Input file location
4281 -------------------------
4287 `--directory=DIRECTORY'
4288 Add DIRECTORY to the list of directories. Source files are
4289 searched relative to this list of directories. The resulting `.po'
4290 file will be written relative to the current directory, though.
4293 If no INPUTFILE is given or if it is `-', standard input is read.
4295 7.2.2 Output file location
4296 --------------------------
4299 `--output-file=FILE'
4300 Write output to specified file.
4303 The results are written to standard output if no output file is
4304 specified or if it is `-'.
4306 7.2.3 Conversion target
4307 -----------------------
4311 Specify encoding for output.
4314 The default encoding is the current locale's encoding.
4316 7.2.4 Input file syntax
4317 -----------------------
4320 `--properties-input'
4321 Assume the input file is a Java ResourceBundle in Java
4322 `.properties' syntax, not in PO file syntax.
4324 `--stringtable-input'
4325 Assume the input file is a NeXTstep/GNUstep localized resource
4326 file in `.strings' syntax, not in PO file syntax.
4329 7.2.5 Output details
4330 --------------------
4333 Always write an output file even if it contains no message.
4337 Write the .po file using indented style.
4340 Do not write `#: FILENAME:LINE' lines.
4343 Generate `#: FILENAME:LINE' lines (default).
4346 Write out a strict Uniforum conforming PO file. Note that this
4347 Uniforum format should be avoided because it doesn't support the
4351 `--properties-output'
4352 Write out a Java ResourceBundle in Java `.properties' syntax. Note
4353 that this file format doesn't support plural forms and silently
4354 drops obsolete messages.
4356 `--stringtable-output'
4357 Write out a NeXTstep/GNUstep localized resource file in `.strings'
4358 syntax. Note that this file format doesn't support plural forms.
4362 Set the output page width. Long strings in the output files will
4363 be split across multiple lines in order to ensure that each line's
4364 width (= number of screen columns) is less or equal to the given
4368 Do not break long message lines. Message lines whose width
4369 exceeds the output page width will not be split into several
4370 lines. Only file reference lines which are wider than the output
4371 page width will be split.
4375 Generate sorted output. Note that using this option makes it much
4376 harder for the translator to understand each message's context.
4380 Sort output by file location.
4383 7.2.6 Informative output
4384 ------------------------
4388 Display this help and exit.
4392 Output version information and exit.
4396 File: gettext.info, Node: msggrep Invocation, Next: msgfilter Invocation, Prev: msgconv Invocation, Up: Manipulating
4398 7.3 Invoking the `msggrep' Program
4399 ==================================
4401 msggrep [OPTION] [INPUTFILE]
4403 The `msggrep' program extracts all messages of a translation catalog
4404 that match a given pattern or belong to some given source files.
4406 7.3.1 Input file location
4407 -------------------------
4413 `--directory=DIRECTORY'
4414 Add DIRECTORY to the list of directories. Source files are
4415 searched relative to this list of directories. The resulting `.po'
4416 file will be written relative to the current directory, though.
4419 If no INPUTFILE is given or if it is `-', standard input is read.
4421 7.3.2 Output file location
4422 --------------------------
4425 `--output-file=FILE'
4426 Write output to specified file.
4429 The results are written to standard output if no output file is
4430 specified or if it is `-'.
4432 7.3.3 Message selection
4433 -----------------------
4435 [-N SOURCEFILE]... [-M DOMAINNAME]...
4436 [-K MSGID-PATTERN] [-T MSGSTR-PATTERN] [-C COMMENT-PATTERN]
4438 A message is selected if
4439 * it comes from one of the specified source files,
4441 * or if it comes from one of the specified domains,
4443 * or if `-K' is given and its key (msgid or msgid_plural) matches
4446 * or if `-T' is given and its translation (msgstr) matches
4449 * or if `-C' is given and the translator's comment matches
4452 When more than one selection criterion is specified, the set of
4453 selected messages is the union of the selected messages of each
4456 MSGID-PATTERN or MSGSTR-PATTERN syntax:
4457 [-E | -F] [-e PATTERN | -f FILE]...
4458 PATTERNs are basic regular expressions by default, or extended
4459 regular expressions if -E is given, or fixed strings if -F is given.
4462 `--location=SOURCEFILE'
4463 Select messages extracted from SOURCEFILE. SOURCEFILE can be
4464 either a literal file name or a wildcard pattern.
4467 `--domain=DOMAINNAME'
4468 Select messages belonging to domain DOMAINNAME.
4472 Start of patterns for the msgid.
4476 Start of patterns for the msgstr.
4480 Start of patterns for the translator's comment.
4484 Specify that PATTERN is an extended regular expression.
4488 Specify that PATTERN is a set of newline-separated strings.
4492 Use PATTERN as a regular expression.
4496 Obtain PATTERN from FILE.
4500 Ignore case distinctions.
4503 7.3.4 Input file syntax
4504 -----------------------
4507 `--properties-input'
4508 Assume the input file is a Java ResourceBundle in Java
4509 `.properties' syntax, not in PO file syntax.
4511 `--stringtable-input'
4512 Assume the input file is a NeXTstep/GNUstep localized resource
4513 file in `.strings' syntax, not in PO file syntax.
4516 7.3.5 Output details
4517 --------------------
4520 Always write an output file even if it contains no message.
4523 Write the .po file using indented style.
4526 Do not write `#: FILENAME:LINE' lines.
4529 Generate `#: FILENAME:LINE' lines (default).
4532 Write out a strict Uniforum conforming PO file. Note that this
4533 Uniforum format should be avoided because it doesn't support the
4537 `--properties-output'
4538 Write out a Java ResourceBundle in Java `.properties' syntax. Note
4539 that this file format doesn't support plural forms and silently
4540 drops obsolete messages.
4542 `--stringtable-output'
4543 Write out a NeXTstep/GNUstep localized resource file in `.strings'
4544 syntax. Note that this file format doesn't support plural forms.
4548 Set the output page width. Long strings in the output files will
4549 be split across multiple lines in order to ensure that each line's
4550 width (= number of screen columns) is less or equal to the given
4554 Do not break long message lines. Message lines whose width
4555 exceeds the output page width will not be split into several
4556 lines. Only file reference lines which are wider than the output
4557 page width will be split.
4560 Generate sorted output. Note that using this option makes it much
4561 harder for the translator to understand each message's context.
4564 Sort output by file location.
4567 7.3.6 Informative output
4568 ------------------------
4572 Display this help and exit.
4576 Output version information and exit.
4580 File: gettext.info, Node: msgfilter Invocation, Next: msguniq Invocation, Prev: msggrep Invocation, Up: Manipulating
4582 7.4 Invoking the `msgfilter' Program
4583 ====================================
4585 msgfilter [OPTION] FILTER [FILTER-OPTION]
4587 The `msgfilter' program applies a filter to all translations of a
4588 translation catalog.
4590 7.4.1 Input file location
4591 -------------------------
4598 `--directory=DIRECTORY'
4599 Add DIRECTORY to the list of directories. Source files are
4600 searched relative to this list of directories. The resulting `.po'
4601 file will be written relative to the current directory, though.
4604 If no INPUTFILE is given or if it is `-', standard input is read.
4606 7.4.2 Output file location
4607 --------------------------
4610 `--output-file=FILE'
4611 Write output to specified file.
4614 The results are written to standard output if no output file is
4615 specified or if it is `-'.
4620 The FILTER can be any program that reads a translation from standard
4621 input and writes a modified translation to standard output. A
4622 frequently used filter is `sed'.
4624 Note: It is your responsibility to ensure that the FILTER can cope
4625 with input encoded in the translation catalog's encoding. If the
4626 FILTER wants input in a particular encoding, you can in a first step
4627 convert the translation catalog to that encoding using the `msgconv'
4628 program, before invoking `msgfilter'. If the FILTER wants input in the
4629 locale's encoding, but you want to avoid the locale's encoding, then
4630 you can first convert the translation catalog to UTF-8 using the
4631 `msgconv' program and then make `msgfilter' work in an UTF-8 locale, by
4632 using the `LC_ALL' environment variable.
4634 Note: Most translations in a translation catalog don't end with a
4635 newline character. For this reason, it is important that the FILTER
4636 recognizes its last input line even if it ends without a newline, and
4637 that it doesn't add an undesired trailing newline at the end. The `sed'
4638 program on some platforms is known to ignore the last line of input if
4639 it is not terminated with a newline. You can use GNU `sed' instead; it
4640 does not have this limitation.
4642 7.4.4 Useful FILTER-OPTIONs when the FILTER is `sed'
4643 ----------------------------------------------------
4646 `--expression=SCRIPT'
4647 Add SCRIPT to the commands to be executed.
4651 Add the contents of SCRIPTFILE to the commands to be executed.
4656 Suppress automatic printing of pattern space.
4659 7.4.5 Input file syntax
4660 -----------------------
4663 `--properties-input'
4664 Assume the input file is a Java ResourceBundle in Java
4665 `.properties' syntax, not in PO file syntax.
4667 `--stringtable-input'
4668 Assume the input file is a NeXTstep/GNUstep localized resource
4669 file in `.strings' syntax, not in PO file syntax.
4672 7.4.6 Output details
4673 --------------------
4676 Always write an output file even if it contains no message.
4679 Write the .po file using indented style.
4682 Keep the header entry, i.e. the message with `msgid ""',
4683 unmodified, instead of filtering it. By default, the header entry
4684 is subject to filtering like any other message.
4687 Do not write `#: FILENAME:LINE' lines.
4690 Generate `#: FILENAME:LINE' lines (default).
4693 Write out a strict Uniforum conforming PO file. Note that this
4694 Uniforum format should be avoided because it doesn't support the
4698 `--properties-output'
4699 Write out a Java ResourceBundle in Java `.properties' syntax. Note
4700 that this file format doesn't support plural forms and silently
4701 drops obsolete messages.
4703 `--stringtable-output'
4704 Write out a NeXTstep/GNUstep localized resource file in `.strings'
4705 syntax. Note that this file format doesn't support plural forms.
4709 Set the output page width. Long strings in the output files will
4710 be split across multiple lines in order to ensure that each line's
4711 width (= number of screen columns) is less or equal to the given
4715 Do not break long message lines. Message lines whose width
4716 exceeds the output page width will not be split into several
4717 lines. Only file reference lines which are wider than the output
4718 page width will be split.
4722 Generate sorted output. Note that using this option makes it much
4723 harder for the translator to understand each message's context.
4727 Sort output by file location.
4730 7.4.7 Informative output
4731 ------------------------
4735 Display this help and exit.
4739 Output version information and exit.
4743 File: gettext.info, Node: msguniq Invocation, Next: msgcomm Invocation, Prev: msgfilter Invocation, Up: Manipulating
4745 7.5 Invoking the `msguniq' Program
4746 ==================================
4748 msguniq [OPTION] [INPUTFILE]
4750 The `msguniq' program unifies duplicate translations in a translation
4751 catalog. It finds duplicate translations of the same message ID. Such
4752 duplicates are invalid input for other programs like `msgfmt',
4753 `msgmerge' or `msgcat'. By default, duplicates are merged together.
4754 When using the `--repeated' option, only duplicates are output, and all
4755 other messages are discarded. Comments and extracted comments will be
4756 cumulated, except that if `--use-first' is specified, they will be
4757 taken from the first translation. File positions will be cumulated.
4758 When using the `--unique' option, duplicates are discarded.
4760 7.5.1 Input file location
4761 -------------------------
4767 `--directory=DIRECTORY'
4768 Add DIRECTORY to the list of directories. Source files are
4769 searched relative to this list of directories. The resulting `.po'
4770 file will be written relative to the current directory, though.
4773 If no INPUTFILE is given or if it is `-', standard input is read.
4775 7.5.2 Output file location
4776 --------------------------
4779 `--output-file=FILE'
4780 Write output to specified file.
4783 The results are written to standard output if no output file is
4784 specified or if it is `-'.
4786 7.5.3 Message selection
4787 -----------------------
4791 Print only duplicates.
4795 Print only unique messages, discard duplicates.
4798 7.5.4 Input file syntax
4799 -----------------------
4802 `--properties-input'
4803 Assume the input file is a Java ResourceBundle in Java
4804 `.properties' syntax, not in PO file syntax.
4806 `--stringtable-input'
4807 Assume the input file is a NeXTstep/GNUstep localized resource
4808 file in `.strings' syntax, not in PO file syntax.
4811 7.5.5 Output details
4812 --------------------
4816 Specify encoding for output.
4819 Use first available translation for each message. Don't merge
4820 several translations into one.
4823 Always write an output file even if it contains no message.
4827 Write the .po file using indented style.
4830 Do not write `#: FILENAME:LINE' lines.
4834 Generate `#: FILENAME:LINE' lines (default).
4837 Write out a strict Uniforum conforming PO file. Note that this
4838 Uniforum format should be avoided because it doesn't support the
4842 `--properties-output'
4843 Write out a Java ResourceBundle in Java `.properties' syntax. Note
4844 that this file format doesn't support plural forms and silently
4845 drops obsolete messages.
4847 `--stringtable-output'
4848 Write out a NeXTstep/GNUstep localized resource file in `.strings'
4849 syntax. Note that this file format doesn't support plural forms.
4853 Set the output page width. Long strings in the output files will
4854 be split across multiple lines in order to ensure that each line's
4855 width (= number of screen columns) is less or equal to the given
4859 Do not break long message lines. Message lines whose width
4860 exceeds the output page width will not be split into several
4861 lines. Only file reference lines which are wider than the output
4862 page width will be split.
4866 Generate sorted output. Note that using this option makes it much
4867 harder for the translator to understand each message's context.
4871 Sort output by file location.
4874 7.5.6 Informative output
4875 ------------------------
4879 Display this help and exit.
4883 Output version information and exit.
4887 File: gettext.info, Node: msgcomm Invocation, Next: msgcmp Invocation, Prev: msguniq Invocation, Up: Manipulating
4889 7.6 Invoking the `msgcomm' Program
4890 ==================================
4892 msgcomm [OPTION] [INPUTFILE]...
4894 The `msgcomm' program finds messages which are common to two or more
4895 of the specified PO files. By using the `--more-than' option, greater
4896 commonality may be requested before messages are printed. Conversely,
4897 the `--less-than' option may be used to specify less commonality before
4898 messages are printed (i.e. `--less-than=2' will only print the unique
4899 messages). Translations, comments and extract comments will be
4900 preserved, but only from the first PO file to define them. File
4901 positions from all PO files will be cumulated.
4903 7.6.1 Input file location
4904 -------------------------
4911 Read the names of the input files from FILE instead of getting
4912 them from the command line.
4915 `--directory=DIRECTORY'
4916 Add DIRECTORY to the list of directories. Source files are
4917 searched relative to this list of directories. The resulting `.po'
4918 file will be written relative to the current directory, though.
4921 If INPUTFILE is `-', standard input is read.
4923 7.6.2 Output file location
4924 --------------------------
4927 `--output-file=FILE'
4928 Write output to specified file.
4931 The results are written to standard output if no output file is
4932 specified or if it is `-'.
4934 7.6.3 Message selection
4935 -----------------------
4938 `--less-than=NUMBER'
4939 Print messages with less than NUMBER definitions, defaults to
4940 infinite if not set.
4943 `--more-than=NUMBER'
4944 Print messages with more than NUMBER definitions, defaults to 1 if
4949 Shorthand for `--less-than=2'. Requests that only unique messages
4953 7.6.4 Input file syntax
4954 -----------------------
4957 `--properties-input'
4958 Assume the input files are Java ResourceBundles in Java
4959 `.properties' syntax, not in PO file syntax.
4961 `--stringtable-input'
4962 Assume the input files are NeXTstep/GNUstep localized resource
4963 files in `.strings' syntax, not in PO file syntax.
4966 7.6.5 Output details
4967 --------------------
4970 Always write an output file even if it contains no message.
4974 Write the .po file using indented style.
4977 Do not write `#: FILENAME:LINE' lines.
4981 Generate `#: FILENAME:LINE' lines (default).
4984 Write out a strict Uniforum conforming PO file. Note that this
4985 Uniforum format should be avoided because it doesn't support the
4989 `--properties-output'
4990 Write out a Java ResourceBundle in Java `.properties' syntax. Note
4991 that this file format doesn't support plural forms and silently
4992 drops obsolete messages.
4994 `--stringtable-output'
4995 Write out a NeXTstep/GNUstep localized resource file in `.strings'
4996 syntax. Note that this file format doesn't support plural forms.
5000 Set the output page width. Long strings in the output files will
5001 be split across multiple lines in order to ensure that each line's
5002 width (= number of screen columns) is less or equal to the given
5006 Do not break long message lines. Message lines whose width
5007 exceeds the output page width will not be split into several
5008 lines. Only file reference lines which are wider than the output
5009 page width will be split.
5013 Generate sorted output. Note that using this option makes it much
5014 harder for the translator to understand each message's context.
5018 Sort output by file location.
5021 Don't write header with `msgid ""' entry.
5024 7.6.6 Informative output
5025 ------------------------
5029 Display this help and exit.
5033 Output version information and exit.
5037 File: gettext.info, Node: msgcmp Invocation, Next: msgattrib Invocation, Prev: msgcomm Invocation, Up: Manipulating
5039 7.7 Invoking the `msgcmp' Program
5040 =================================
5042 msgcmp [OPTION] DEF.po REF.pot
5044 The `msgcmp' program compares two Uniforum style .po files to check
5045 that both contain the same set of msgid strings. The DEF.po file is an
5046 existing PO file with the translations. The REF.pot file is the last
5047 created PO file, or a PO Template file (generally created by
5048 `xgettext'). This is useful for checking that you have translated each
5049 and every message in your program. Where an exact match cannot be
5050 found, fuzzy matching is used to produce better diagnostics.
5052 7.7.1 Input file location
5053 -------------------------
5059 References to the sources.
5062 `--directory=DIRECTORY'
5063 Add DIRECTORY to the list of directories. Source files are
5064 searched relative to this list of directories.
5067 7.7.2 Operation modifiers
5068 -------------------------
5072 Apply REF.pot to each of the domains in DEF.po.
5075 7.7.3 Input file syntax
5076 -----------------------
5079 `--properties-input'
5080 Assume the input files are Java ResourceBundles in Java
5081 `.properties' syntax, not in PO file syntax.
5083 `--stringtable-input'
5084 Assume the input files are NeXTstep/GNUstep localized resource
5085 files in `.strings' syntax, not in PO file syntax.
5088 7.7.4 Informative output
5089 ------------------------
5093 Display this help and exit.
5097 Output version information and exit.
5101 File: gettext.info, Node: msgattrib Invocation, Next: msgen Invocation, Prev: msgcmp Invocation, Up: Manipulating
5103 7.8 Invoking the `msgattrib' Program
5104 ====================================
5106 msgattrib [OPTION] [INPUTFILE]
5108 The `msgattrib' program filters the messages of a translation catalog
5109 according to their attributes, and manipulates the attributes.
5111 7.8.1 Input file location
5112 -------------------------
5118 `--directory=DIRECTORY'
5119 Add DIRECTORY to the list of directories. Source files are
5120 searched relative to this list of directories. The resulting `.po'
5121 file will be written relative to the current directory, though.
5124 If no INPUTFILE is given or if it is `-', standard input is read.
5126 7.8.2 Output file location
5127 --------------------------
5130 `--output-file=FILE'
5131 Write output to specified file.
5134 The results are written to standard output if no output file is
5135 specified or if it is `-'.
5137 7.8.3 Message selection
5138 -----------------------
5141 Keep translated messages, remove untranslated messages.
5144 Keep untranslated messages, remove translated messages.
5147 Remove `fuzzy' marked messages.
5150 Keep `fuzzy' marked messages, remove all other messsages.
5153 Remove obsolete #~ messages.
5156 Keep obsolete #~ messages, remove all other messages.
5159 7.8.4 Attribute manipulation
5160 ----------------------------
5162 Attributes are modified after the message selection/removal has been
5163 performed. If the `--only-file' or `--ignore-file' option is
5164 specified, the attribute modification is applied only to those messages
5165 that are listed in the ONLY-FILE and not listed in the IGNORE-FILE.
5168 Set all messages `fuzzy'.
5171 Set all messages non-`fuzzy'.
5174 Set all messages obsolete.
5177 Set all messages non-obsolete.
5180 Limit the attribute changes to entries that are listed in FILE.
5181 FILE should be a PO or POT file.
5183 `--ignore-file=FILE'
5184 Limit the attribute changes to entries that are not listed in FILE.
5185 FILE should be a PO or POT file.
5188 Synonym for `--only-fuzzy --clear-fuzzy': It keeps only the fuzzy
5189 messages and removes their `fuzzy' mark.
5192 Synonym for `--only-obsolete --clear-obsolete': It keeps only the
5193 obsolete messages and makes them non-obsolete.
5196 7.8.5 Input file syntax
5197 -----------------------
5200 `--properties-input'
5201 Assume the input file is a Java ResourceBundle in Java
5202 `.properties' syntax, not in PO file syntax.
5204 `--stringtable-input'
5205 Assume the input file is a NeXTstep/GNUstep localized resource
5206 file in `.strings' syntax, not in PO file syntax.
5209 7.8.6 Output details
5210 --------------------
5213 Always write an output file even if it contains no message.
5217 Write the .po file using indented style.
5220 Do not write `#: FILENAME:LINE' lines.
5224 Generate `#: FILENAME:LINE' lines (default).
5227 Write out a strict Uniforum conforming PO file. Note that this
5228 Uniforum format should be avoided because it doesn't support the
5232 `--properties-output'
5233 Write out a Java ResourceBundle in Java `.properties' syntax. Note
5234 that this file format doesn't support plural forms and silently
5235 drops obsolete messages.
5237 `--stringtable-output'
5238 Write out a NeXTstep/GNUstep localized resource file in `.strings'
5239 syntax. Note that this file format doesn't support plural forms.
5243 Set the output page width. Long strings in the output files will
5244 be split across multiple lines in order to ensure that each line's
5245 width (= number of screen columns) is less or equal to the given
5249 Do not break long message lines. Message lines whose width
5250 exceeds the output page width will not be split into several
5251 lines. Only file reference lines which are wider than the output
5252 page width will be split.
5256 Generate sorted output. Note that using this option makes it much
5257 harder for the translator to understand each message's context.
5261 Sort output by file location.
5264 7.8.7 Informative output
5265 ------------------------
5269 Display this help and exit.
5273 Output version information and exit.
5277 File: gettext.info, Node: msgen Invocation, Next: msgexec Invocation, Prev: msgattrib Invocation, Up: Manipulating
5279 7.9 Invoking the `msgen' Program
5280 ================================
5282 msgen [OPTION] INPUTFILE
5284 The `msgen' program creates an English translation catalog. The
5285 input file is the last created English PO file, or a PO Template file
5286 (generally created by xgettext). Untranslated entries are assigned a
5287 translation that is identical to the msgid.
5289 Note: `msginit --no-translator --locale=en' performs a very similar
5290 task. The main difference is that `msginit' cares specially about the
5291 header entry, whereas `msgen' doesn't.
5293 7.9.1 Input file location
5294 -------------------------
5297 Input PO or POT file.
5300 `--directory=DIRECTORY'
5301 Add DIRECTORY to the list of directories. Source files are
5302 searched relative to this list of directories. The resulting `.po'
5303 file will be written relative to the current directory, though.
5306 If INPUTFILE is `-', standard input is read.
5308 7.9.2 Output file location
5309 --------------------------
5312 `--output-file=FILE'
5313 Write output to specified file.
5316 The results are written to standard output if no output file is
5317 specified or if it is `-'.
5319 7.9.3 Input file syntax
5320 -----------------------
5323 `--properties-input'
5324 Assume the input file is a Java ResourceBundle in Java
5325 `.properties' syntax, not in PO file syntax.
5327 `--stringtable-input'
5328 Assume the input file is a NeXTstep/GNUstep localized resource
5329 file in `.strings' syntax, not in PO file syntax.
5332 7.9.4 Output details
5333 --------------------
5336 Always write an output file even if it contains no message.
5340 Write the .po file using indented style.
5343 Do not write `#: FILENAME:LINE' lines.
5346 Generate `#: FILENAME:LINE' lines (default).
5349 Write out a strict Uniforum conforming PO file. Note that this
5350 Uniforum format should be avoided because it doesn't support the
5354 `--properties-output'
5355 Write out a Java ResourceBundle in Java `.properties' syntax. Note
5356 that this file format doesn't support plural forms and silently
5357 drops obsolete messages.
5359 `--stringtable-output'
5360 Write out a NeXTstep/GNUstep localized resource file in `.strings'
5361 syntax. Note that this file format doesn't support plural forms.
5365 Set the output page width. Long strings in the output files will
5366 be split across multiple lines in order to ensure that each line's
5367 width (= number of screen columns) is less or equal to the given
5371 Do not break long message lines. Message lines whose width
5372 exceeds the output page width will not be split into several
5373 lines. Only file reference lines which are wider than the output
5374 page width will be split.
5378 Generate sorted output. Note that using this option makes it much
5379 harder for the translator to understand each message's context.
5383 Sort output by file location.
5386 7.9.5 Informative output
5387 ------------------------
5391 Display this help and exit.
5395 Output version information and exit.
5399 File: gettext.info, Node: msgexec Invocation, Next: libgettextpo, Prev: msgen Invocation, Up: Manipulating
5401 7.10 Invoking the `msgexec' Program
5402 ===================================
5404 msgexec [OPTION] COMMAND [COMMAND-OPTION]
5406 The `msgexec' program applies a command to all translations of a
5407 translation catalog. The COMMAND can be any program that reads a
5408 translation from standard input. It is invoked once for each
5409 translation. Its output becomes msgexec's output. `msgexec''s return
5410 code is the maximum return code across all invocations.
5412 A special builtin command called `0' outputs the translation,
5413 followed by a null byte. The output of `msgexec 0' is suitable as
5414 input for `xargs -0'.
5416 During each COMMAND invocation, the environment variable
5417 `MSGEXEC_MSGID' is bound to the message's msgid, and the environment
5418 variable `MSGEXEC_LOCATION' is bound to the location in the PO file of
5421 Note: It is your responsibility to ensure that the COMMAND can cope
5422 with input encoded in the translation catalog's encoding. If the
5423 COMMAND wants input in a particular encoding, you can in a first step
5424 convert the translation catalog to that encoding using the `msgconv'
5425 program, before invoking `msgexec'. If the COMMAND wants input in the
5426 locale's encoding, but you want to avoid the locale's encoding, then
5427 you can first convert the translation catalog to UTF-8 using the
5428 `msgconv' program and then make `msgexec' work in an UTF-8 locale, by
5429 using the `LC_ALL' environment variable.
5431 7.10.1 Input file location
5432 --------------------------
5439 `--directory=DIRECTORY'
5440 Add DIRECTORY to the list of directories. Source files are
5441 searched relative to this list of directories. The resulting `.po'
5442 file will be written relative to the current directory, though.
5445 If no INPUTFILE is given or if it is `-', standard input is read.
5447 7.10.2 Input file syntax
5448 ------------------------
5451 `--properties-input'
5452 Assume the input file is a Java ResourceBundle in Java
5453 `.properties' syntax, not in PO file syntax.
5455 `--stringtable-input'
5456 Assume the input file is a NeXTstep/GNUstep localized resource
5457 file in `.strings' syntax, not in PO file syntax.
5460 7.10.3 Informative output
5461 -------------------------
5465 Display this help and exit.
5469 Output version information and exit.
5473 File: gettext.info, Node: libgettextpo, Prev: msgexec Invocation, Up: Manipulating
5475 7.11 Writing your own programs that process PO files
5476 ====================================================
5478 For the tasks for which a combination of `msgattrib', `msgcat' etc. is
5479 not sufficient, a set of C functions is provided in a library, to make
5480 it possible to process PO files in your own programs. When you use
5481 this library, you don't need to write routines to parse the PO file;
5482 instead, you retreive a pointer in memory to each of messages contained
5483 in the PO file. Functions for writing PO files are not provided at
5486 The functions are declared in the header file `<gettext-po.h>', and
5487 are defined in a library called `libgettextpo'.
5489 -- Data Type: po_file_t
5490 This is a pointer type that refers to the contents of a PO file,
5491 after it has been read into memory.
5493 -- Data Type: po_message_iterator_t
5494 This is a pointer type that refers to an iterator that produces a
5495 sequence of messages.
5497 -- Data Type: po_message_t
5498 This is a pointer type that refers to a message of a PO file,
5499 including its translation.
5501 -- Function: po_file_t po_file_read (const char *FILENAME)
5502 The `po_file_read' function reads a PO file into memory. The file
5503 name is given as argument. The return value is a handle to the PO
5504 file's contents, valid until `po_file_free' is called on it. In
5505 case of error, the return value is `NULL', and `errno' is set.
5507 -- Function: void po_file_free (po_file_t FILE)
5508 The `po_file_free' function frees a PO file's contents from memory,
5509 including all messages that are only implicitly accessible through
5512 -- Function: const char * const * po_file_domains (po_file_t FILE)
5513 The `po_file_domains' function returns the domains for which the
5514 given PO file has messages. The return value is a `NULL'
5515 terminated array which is valid as long as the FILE handle is
5516 valid. For PO files which contain no `domain' directive, the
5517 return value contains only one domain, namely the default domain
5520 -- Function: po_message_iterator_t po_message_iterator (po_file_t
5521 FILE, const char *DOMAIN)
5522 The `po_message_iterator' returns an iterator that will produce the
5523 messages of FILE that belong to the given DOMAIN. If DOMAIN is
5524 `NULL', the default domain is used instead. To list the messages,
5525 use the function `po_next_message' repeatedly.
5527 -- Function: void po_message_iterator_free (po_message_iterator_t
5529 The `po_message_iterator_free' function frees an iterator
5530 previously allocated through the `po_message_iterator' function.
5532 -- Function: po_message_t po_next_message (po_message_iterator_t
5534 The `po_next_message' function returns the next message from
5535 ITERATOR and advances the iterator. It returns `NULL' when the
5536 iterator has reached the end of its message list.
5538 The following functions returns details of a `po_message_t'. Recall
5539 that the results are valid as long as the FILE handle is valid.
5541 -- Function: const char * po_message_msgid (po_message_t MESSAGE)
5542 The `po_message_msgid' function returns the `msgid' (untranslated
5543 English string) of a message. This is guaranteed to be non-`NULL'.
5545 -- Function: const char * po_message_msgid_plural (po_message_t
5547 The `po_message_msgid_plural' function returns the `msgid_plural'
5548 (untranslated English plural string) of a message with plurals, or
5549 `NULL' for a message without plural.
5551 -- Function: const char * po_message_msgstr (po_message_t MESSAGE)
5552 The `po_message_msgstr' function returns the `msgstr' (translation)
5553 of a message. For an untranslated message, the return value is an
5556 -- Function: const char * po_message_msgstr_plural (po_message_t
5558 The `po_message_msgstr_plural' function returns the
5559 `msgstr[INDEX]' of a message with plurals, or `NULL' when the
5560 INDEX is out of range or for a message without plural.
5562 Here is an example code how these functions can be used.
5564 const char *filename = ...;
5565 po_file_t file = po_file_read (filename);
5568 error (EXIT_FAILURE, errno, "couldn't open the PO file %s", filename);
5570 const char * const *domains = po_file_domains (file);
5571 const char * const *domainp;
5573 for (domainp = domains; *domainp; domainp++)
5575 const char *domain = *domainp;
5576 po_message_iterator_t iterator = po_message_iterator (file, domain);
5580 po_message_t *message = po_next_message (iterator);
5582 if (message == NULL)
5585 const char *msgid = po_message_msgid (message);
5586 const char *msgstr = po_message_msgstr (message);
5591 po_message_iterator_free (iterator);
5594 po_file_free (file);
5597 File: gettext.info, Node: Binaries, Next: Users, Prev: Manipulating, Up: Top
5599 8 Producing Binary MO Files
5600 ***************************
5604 * msgfmt Invocation:: Invoking the `msgfmt' Program
5605 * msgunfmt Invocation:: Invoking the `msgunfmt' Program
5606 * MO Files:: The Format of GNU MO Files
5609 File: gettext.info, Node: msgfmt Invocation, Next: msgunfmt Invocation, Prev: Binaries, Up: Binaries
5611 8.1 Invoking the `msgfmt' Program
5612 =================================
5614 msgfmt [OPTION] FILENAME.po ...
5616 The `msgfmt' programs generates a binary message catalog from a
5617 textual translation description.
5619 8.1.1 Input file location
5620 -------------------------
5625 `--directory=DIRECTORY'
5626 Add DIRECTORY to the list of directories. Source files are
5627 searched relative to this list of directories. The resulting `.po'
5628 file will be written relative to the current directory, though.
5631 If an input file is `-', standard input is read.
5633 8.1.2 Operation mode
5634 --------------------
5638 Java mode: generate a Java `ResourceBundle' class.
5641 Like -java, and assume Java2 (JDK 1.2 or higher).
5644 C# mode: generate a .NET .dll file containing a subclass of
5645 `GettextResourceSet'.
5647 `--csharp-resources'
5648 C# resources mode: generate a .NET `.resources' file.
5651 Tcl mode: generate a tcl/msgcat `.msg' file.
5654 Qt mode: generate a Qt `.qm' file.
5657 8.1.3 Output file location
5658 --------------------------
5661 `--output-file=FILE'
5662 Write output to specified file.
5665 Direct the program to work strictly following the Uniforum/Sun
5666 implementation. Currently this only affects the naming of the
5667 output file. If this option is not given the name of the output
5668 file is the same as the domain name. If the strict Uniforum mode
5669 is enabled the suffix `.mo' is added to the file name if it is not
5672 We find this behaviour of Sun's implementation rather silly and so
5673 by default this mode is _not_ selected.
5676 If the output FILE is `-', output is written to standard output.
5678 8.1.4 Output file location in Java mode
5679 ---------------------------------------
5682 `--resource=RESOURCE'
5683 Specify the resource name.
5687 Specify the locale name, either a language specification of the
5688 form LL or a combined language and country specification of the
5692 Specify the base directory of classes directory hierarchy.
5695 The class name is determined by appending the locale name to the
5696 resource name, separated with an underscore. The `-d' option is
5697 mandatory. The class is written under the specified directory.
5699 8.1.5 Output file location in C# mode
5700 -------------------------------------
5703 `--resource=RESOURCE'
5704 Specify the resource name.
5708 Specify the locale name, either a language specification of the
5709 form LL or a combined language and country specification of the
5713 Specify the base directory for locale dependent `.dll' files.
5716 The `-l' and `-d' options are mandatory. The `.dll' file is written
5717 in a subdirectory of the specified directory whose name depends on the
5720 8.1.6 Output file location in Tcl mode
5721 --------------------------------------
5725 Specify the locale name, either a language specification of the
5726 form LL or a combined language and country specification of the
5730 Specify the base directory of `.msg' message catalogs.
5733 The `-l' and `-d' options are mandatory. The `.msg' file is written
5734 in the specified directory.
5736 8.1.7 Input file syntax
5737 -----------------------
5740 `--properties-input'
5741 Assume the input files are Java ResourceBundles in Java
5742 `.properties' syntax, not in PO file syntax.
5744 `--stringtable-input'
5745 Assume the input files are NeXTstep/GNUstep localized resource
5746 files in `.strings' syntax, not in PO file syntax.
5749 8.1.8 Input file interpretation
5750 -------------------------------
5754 Perform all the checks implied by `--check-format',
5755 `--check-header', `--check-domain'.
5758 Check language dependent format strings.
5760 If the string represents a format string used in a `printf'-like
5761 function both strings should have the same number of `%' format
5762 specifiers, with matching types. If the flag `c-format' or
5763 `possible-c-format' appears in the special comment <#,> for this
5764 entry a check is performed. For example, the check will diagnose
5765 using `%.*s' against `%s', or `%d' against `%s', or `%d' against
5766 `%x'. It can even handle positional parameters.
5768 Normally the `xgettext' program automatically decides whether a
5769 string is a format string or not. This algorithm is not perfect,
5770 though. It might regard a string as a format string though it is
5771 not used in a `printf'-like function and so `msgfmt' might report
5772 errors where there are none.
5774 To solve this problem the programmer can dictate the decision to
5775 the `xgettext' program (*note c-format::). The translator should
5776 not consider removing the flag from the <#,> line. This "fix"
5777 would be reversed again as soon as `msgmerge' is called the next
5781 Verify presence and contents of the header entry. *Note Header
5782 Entry::, for a description of the various fields in the header
5786 Check for conflicts between domain directives and the
5787 `--output-file' option
5790 `--check-compatibility'
5791 Check that GNU msgfmt behaves like X/Open msgfmt. This will give
5792 an error when attempting to use the GNU extensions.
5794 `--check-accelerators[=CHAR]'
5795 Check presence of keyboard accelerators for menu items. This is
5796 based on the convention used in some GUIs that a keyboard
5797 accelerator in a menu item string is designated by an immediately
5798 preceding `&' character. Sometimes a keyboard accelerator is also
5799 called "keyboard mnemonic". This check verifies that if the
5800 untranslated string has exactly one `&' character, the translated
5801 string has exactly one `&' as well. If this option is given with
5802 a CHAR argument, this CHAR should be a non-alphanumeric character
5803 and is used as keyboard accelerator mark instead of `&'.
5807 Use fuzzy entries in output. Note that using this option is
5808 usually wrong, because fuzzy messages are exactly those which have
5809 not been validated by a human translator.
5812 8.1.9 Output details
5813 --------------------
5816 `--alignment=NUMBER'
5817 Align strings to NUMBER bytes (default: 1).
5820 Don't include a hash table in the binary file. Lookup will be
5821 more expensive at run time (binary search instead of hash table
5825 8.1.10 Informative output
5826 -------------------------
5830 Display this help and exit.
5834 Output version information and exit.
5837 Print statistics about translations.
5841 Increase verbosity level.
5845 File: gettext.info, Node: msgunfmt Invocation, Next: MO Files, Prev: msgfmt Invocation, Up: Binaries
5847 8.2 Invoking the `msgunfmt' Program
5848 ===================================
5850 msgunfmt [OPTION] [FILE]...
5852 The `msgunfmt' program converts a binary message catalog to a
5853 Uniforum style .po file.
5855 8.2.1 Operation mode
5856 --------------------
5860 Java mode: input is a Java `ResourceBundle' class.
5863 C# mode: input is a .NET .dll file containing a subclass of
5864 `GettextResourceSet'.
5866 `--csharp-resources'
5867 C# resources mode: input is a .NET `.resources' file.
5870 Tcl mode: input is a tcl/msgcat `.msg' file.
5873 8.2.2 Input file location
5874 -------------------------
5880 If no input FILE is given or if it is `-', standard input is read.
5882 8.2.3 Input file location in Java mode
5883 --------------------------------------
5886 `--resource=RESOURCE'
5887 Specify the resource name.
5891 Specify the locale name, either a language specification of the
5892 form LL or a combined language and country specification of the
5896 The class name is determined by appending the locale name to the
5897 resource name, separated with an underscore. The class is located
5898 using the `CLASSPATH'.
5900 8.2.4 Input file location in C# mode
5901 ------------------------------------
5904 `--resource=RESOURCE'
5905 Specify the resource name.
5909 Specify the locale name, either a language specification of the
5910 form LL or a combined language and country specification of the
5914 Specify the base directory for locale dependent `.dll' files.
5917 The `-l' and `-d' options are mandatory. The `.msg' file is located
5918 in a subdirectory of the specified directory whose name depends on the
5921 8.2.5 Input file location in Tcl mode
5922 -------------------------------------
5926 Specify the locale name, either a language specification of the
5927 form LL or a combined language and country specification of the
5931 Specify the base directory of `.msg' message catalogs.
5934 The `-l' and `-d' options are mandatory. The `.msg' file is located
5935 in the specified directory.
5937 8.2.6 Output file location
5938 --------------------------
5941 `--output-file=FILE'
5942 Write output to specified file.
5945 The results are written to standard output if no output file is
5946 specified or if it is `-'.
5948 8.2.7 Output details
5949 --------------------
5952 Always write an output file even if it contains no message.
5956 Write the .po file using indented style.
5959 Write out a strict Uniforum conforming PO file. Note that this
5960 Uniforum format should be avoided because it doesn't support the
5964 `--properties-output'
5965 Write out a Java ResourceBundle in Java `.properties' syntax. Note
5966 that this file format doesn't support plural forms and silently
5967 drops obsolete messages.
5969 `--stringtable-output'
5970 Write out a NeXTstep/GNUstep localized resource file in `.strings'
5971 syntax. Note that this file format doesn't support plural forms.
5975 Set the output page width. Long strings in the output files will
5976 be split across multiple lines in order to ensure that each line's
5977 width (= number of screen columns) is less or equal to the given
5981 Do not break long message lines. Message lines whose width
5982 exceeds the output page width will not be split into several
5983 lines. Only file reference lines which are wider than the output
5984 page width will be split.
5988 Generate sorted output. Note that using this option makes it much
5989 harder for the translator to understand each message's context.
5992 8.2.8 Informative output
5993 ------------------------
5997 Display this help and exit.
6001 Output version information and exit.
6005 Increase verbosity level.
6009 File: gettext.info, Node: MO Files, Prev: msgunfmt Invocation, Up: Binaries
6011 8.3 The Format of GNU MO Files
6012 ==============================
6014 The format of the generated MO files is best described by a picture,
6015 which appears below.
6017 The first two words serve the identification of the file. The magic
6018 number will always signal GNU MO files. The number is stored in the
6019 byte order of the generating machine, so the magic number really is two
6020 numbers: `0x950412de' and `0xde120495'. The second word describes the
6021 current revision of the file format. For now the revision is 0. This
6022 might change in future versions, and ensures that the readers of MO
6023 files can distinguish new formats from old ones, so that both can be
6024 handled correctly. The version is kept separate from the magic number,
6025 instead of using different magic numbers for different formats, mainly
6026 because `/etc/magic' is not updated often. It might be better to have
6027 magic separated from internal format version identification.
6029 Follow a number of pointers to later tables in the file, allowing
6030 for the extension of the prefix part of MO files without having to
6031 recompile programs reading them. This might become useful for later
6032 inserting a few flag bits, indication about the charset used, new
6033 tables, or other things.
6035 Then, at offset O and offset T in the picture, two tables of string
6036 descriptors can be found. In both tables, each string descriptor uses
6037 two 32 bits integers, one for the string length, another for the offset
6038 of the string in the MO file, counting in bytes from the start of the
6039 file. The first table contains descriptors for the original strings,
6040 and is sorted so the original strings are in increasing lexicographical
6041 order. The second table contains descriptors for the translated
6042 strings, and is parallel to the first table: to find the corresponding
6043 translation one has to access the array slot in the second array with
6046 Having the original strings sorted enables the use of simple binary
6047 search, for when the MO file does not contain an hashing table, or for
6048 when it is not practical to use the hashing table provided in the MO
6049 file. This also has another advantage, as the empty string in a PO
6050 file GNU `gettext' is usually _translated_ into some system information
6051 attached to that particular MO file, and the empty string necessarily
6052 becomes the first in both the original and translated tables, making
6053 the system information very easy to find.
6055 The size S of the hash table can be zero. In this case, the hash
6056 table itself is not contained in the MO file. Some people might prefer
6057 this because a precomputed hashing table takes disk space, and does not
6058 win _that_ much speed. The hash table contains indices to the sorted
6059 array of strings in the MO file. Conflict resolution is done by double
6060 hashing. The precise hashing algorithm used is fairly dependent on GNU
6061 `gettext' code, and is not documented here.
6063 As for the strings themselves, they follow the hash file, and each
6064 is terminated with a <NUL>, and this <NUL> is not counted in the length
6065 which appears in the string descriptor. The `msgfmt' program has an
6066 option selecting the alignment for MO file strings. With this option,
6067 each string is separately aligned so it starts at an offset which is a
6068 multiple of the alignment value. On some RISC machines, a correct
6069 alignment will speed things up.
6071 Plural forms are stored by letting the plural of the original string
6072 follow the singular of the original string, separated through a <NUL>
6073 byte. The length which appears in the string descriptor includes both.
6074 However, only the singular of the original string takes part in the
6075 hash table lookup. The plural variants of the translation are all
6076 stored consecutively, separated through a <NUL> byte. Here also, the
6077 length in the string descriptor includes all of them.
6079 Nothing prevents a MO file from having embedded <NUL>s in strings.
6080 However, the program interface currently used already presumes that
6081 strings are <NUL> terminated, so embedded <NUL>s are somewhat useless.
6082 But the MO file format is general enough so other interfaces would be
6083 later possible, if for example, we ever want to implement wide
6084 characters right in MO files, where <NUL> bytes may accidently appear.
6085 (No, we don't want to have wide characters in MO files. They would
6086 make the file unnecessarily large, and the `wchar_t' type being
6087 platform dependent, MO files would be platform dependent as well.)
6089 This particular issue has been strongly debated in the GNU `gettext'
6090 development forum, and it is expectable that MO file format will evolve
6091 or change over time. It is even possible that many formats may later
6092 be supported concurrently. But surely, we have to start somewhere, and
6093 the MO file format described here is a good start. Nothing is cast in
6094 concrete, and the format may later evolve fairly easily, so we should
6095 feel comfortable with the current approach.
6098 +------------------------------------------+
6099 0 | magic number = 0x950412de |
6101 4 | file format revision = 0 |
6103 8 | number of strings | == N
6105 12 | offset of table with original strings | == O
6107 16 | offset of table with translation strings | == T
6109 20 | size of hashing table | == S
6111 24 | offset of hashing table | == H
6114 . (possibly more entries later) .
6117 O | length & offset 0th string ----------------.
6118 O + 8 | length & offset 1st string ------------------.
6120 O + ((N-1)*8)| length & offset (N-1)th string | | |
6122 T | length & offset 0th translation ---------------.
6123 T + 8 | length & offset 1st translation -----------------.
6125 T + ((N-1)*8)| length & offset (N-1)th translation | | | | |
6127 H | start hash table | | | | |
6129 H + S * 4 | end hash table | | | | |
6131 | NUL terminated 0th string <----------------' | | |
6133 | NUL terminated 1st string <------------------' | |
6137 | NUL terminated 0th translation <---------------' |
6139 | NUL terminated 1st translation <-----------------'
6143 +------------------------------------------+
6146 File: gettext.info, Node: Users, Next: Programmers, Prev: Binaries, Up: Top
6151 When GNU `gettext' will truly have reached its goal, average users
6152 should feel some kind of astonished pleasure, seeing the effect of that
6153 strange kind of magic that just makes their own native language appear
6154 everywhere on their screens. As for naive users, they would ideally
6155 have no special pleasure about it, merely taking their own language for
6156 _granted_, and becoming rather unhappy otherwise.
6158 So, let's try to describe here how we would like the magic to
6159 operate, as we want the users' view to be the simplest, among all ways
6160 one could look at GNU `gettext'. All other software engineers:
6161 programmers, translators, maintainers, should work together in such a
6162 way that the magic becomes possible. This is a long and progressive
6163 undertaking, and information is available about the progress of the
6164 Translation Project.
6166 When a package is distributed, there are two kinds of users:
6167 "installers" who fetch the distribution, unpack it, configure it,
6168 compile it and install it for themselves or others to use; and "end
6169 users" that call programs of the package, once these have been
6170 installed at their site. GNU `gettext' is offering magic for both
6171 installers and end users.
6175 * Matrix:: The Current `ABOUT-NLS' Matrix
6176 * Installers:: Magic for Installers
6177 * End Users:: Magic for End Users
6180 File: gettext.info, Node: Matrix, Next: Installers, Prev: Users, Up: Users
6182 9.1 The Current `ABOUT-NLS' Matrix
6183 ==================================
6185 Languages are not equally supported in all packages using GNU
6186 `gettext'. To know if some package uses GNU `gettext', one may check
6187 the distribution for the `ABOUT-NLS' information file, for some `LL.po'
6188 files, often kept together into some `po/' directory, or for an `intl/'
6189 directory. Internationalized packages have usually many `LL.po' files,
6190 where LL represents the language. *Note End Users:: for a complete
6191 description of the format for LL.
6193 More generally, a matrix is available for showing the current state
6194 of the Translation Project, listing which packages are prepared for
6195 multi-lingual messages, and which languages are supported by each.
6196 Because this information changes often, this matrix is not kept within
6197 this GNU `gettext' manual. This information is often found in file
6198 `ABOUT-NLS' from various distributions, but is also as old as the
6199 distribution itself. A recent copy of this `ABOUT-NLS' file,
6200 containing up-to-date information, should generally be found on the
6201 Translation Project sites, and also on most GNU archive sites.
6204 File: gettext.info, Node: Installers, Next: End Users, Prev: Matrix, Up: Users
6206 9.2 Magic for Installers
6207 ========================
6209 By default, packages fully using GNU `gettext', internally, are
6210 installed in such a way that they to allow translation of messages. At
6211 _configuration_ time, those packages should automatically detect
6212 whether the underlying host system already provides the GNU `gettext'
6213 functions. If not, the GNU `gettext' library should be automatically
6214 prepared and used. Installers may use special options at configuration
6215 time for changing this behavior. The command `./configure
6216 --with-included-gettext' bypasses system `gettext' to use the included
6217 GNU `gettext' instead, while `./configure --disable-nls' produces
6218 programs totally unable to translate messages.
6220 Internationalized packages have usually many `LL.po' files. Unless
6221 translations are disabled, all those available are installed together
6222 with the package. However, the environment variable `LINGUAS' may be
6223 set, prior to configuration, to limit the installed set. `LINGUAS'
6224 should then contain a space separated list of two-letter codes, stating
6225 which languages are allowed.
6228 File: gettext.info, Node: End Users, Prev: Installers, Up: Users
6230 9.3 Magic for End Users
6231 =======================
6233 We consider here those packages using GNU `gettext' internally, and for
6234 which the installers did not disable translation at _configure_ time.
6235 Then, users only have to set the `LANG' environment variable to the
6236 appropriate `LL_CC' combination prior to using the programs in the
6237 package. *Note Matrix::. For example, let's presume a German site.
6238 At the shell prompt, users merely have to execute `setenv LANG de_DE'
6239 (in `csh') or `export LANG; LANG=de_DE' (in `sh'). They could even do
6240 this from their `.login' or `.profile' file.
6243 File: gettext.info, Node: Programmers, Next: Translators, Prev: Users, Up: Top
6245 10 The Programmer's View
6246 ************************
6248 One aim of the current message catalog implementation provided by GNU
6249 `gettext' was to use the system's message catalog handling, if the
6250 installer wishes to do so. So we perhaps should first take a look at
6251 the solutions we know about. The people in the POSIX committee did not
6252 manage to agree on one of the semi-official standards which we'll
6253 describe below. In fact they couldn't agree on anything, so they
6254 decided only to include an example of an interface. The major Unix
6255 vendors are split in the usage of the two most important
6256 specifications: X/Open's catgets vs. Uniforum's gettext interface.
6257 We'll describe them both and later explain our solution of this dilemma.
6261 * catgets:: About `catgets'
6262 * gettext:: About `gettext'
6263 * Comparison:: Comparing the two interfaces
6264 * Using libintl.a:: Using libintl.a in own programs
6265 * gettext grok:: Being a `gettext' grok
6266 * Temp Programmers:: Temporary Notes for the Programmers Chapter
6269 File: gettext.info, Node: catgets, Next: gettext, Prev: Programmers, Up: Programmers
6271 10.1 About `catgets'
6272 ====================
6274 The `catgets' implementation is defined in the X/Open Portability
6275 Guide, Volume 3, XSI Supplementary Definitions, Chapter 5. But the
6276 process of creating this standard seemed to be too slow for some of the
6277 Unix vendors so they created their implementations on preliminary
6278 versions of the standard. Of course this leads again to problems while
6279 writing platform independent programs: even the usage of `catgets' does
6280 not guarantee a unique interface.
6282 Another, personal comment on this that only a bunch of committee
6283 members could have made this interface. They never really tried to
6284 program using this interface. It is a fast, memory-saving
6285 implementation, an user can happily live with it. But programmers hate
6286 it (at least I and some others do...)
6288 But we must not forget one point: after all the trouble with
6289 transfering the rights on Unix(tm) they at last came to X/Open, the
6290 very same who published this specification. This leads me to making
6291 the prediction that this interface will be in future Unix standards
6292 (e.g. Spec1170) and therefore part of all Unix implementation
6293 (implementations, which are _allowed_ to wear this name).
6297 * Interface to catgets:: The interface
6298 * Problems with catgets:: Problems with the `catgets' interface?!
6301 File: gettext.info, Node: Interface to catgets, Next: Problems with catgets, Prev: catgets, Up: catgets
6303 10.1.1 The Interface
6304 --------------------
6306 The interface to the `catgets' implementation consists of three
6307 functions which correspond to those used in file access: `catopen' to
6308 open the catalog for using, `catgets' for accessing the message tables,
6309 and `catclose' for closing after work is done. Prototypes for the
6310 functions and the needed definitions are in the `<nl_types.h>' header
6313 `catopen' is used like in this:
6315 nl_catd catd = catopen ("catalog_name", 0);
6317 The function takes as the argument the name of the catalog. This
6318 usual refers to the name of the program or the package. The second
6319 parameter is not further specified in the standard. I don't even know
6320 whether it is implemented consistently among various systems. So the
6321 common advice is to use `0' as the value. The return value is a handle
6322 to the message catalog, equivalent to handles to file returned by
6325 This handle is of course used in the `catgets' function which can be
6328 char *translation = catgets (catd, set_no, msg_id, "original string");
6330 The first parameter is this catalog descriptor. The second parameter
6331 specifies the set of messages in this catalog, in which the message
6332 described by `msg_id' is obtained. `catgets' therefore uses a
6333 three-stage addressing:
6335 catalog name => set number => message ID => translation
6337 The fourth argument is not used to address the translation. It is
6338 given as a default value in case when one of the addressing stages
6339 fail. One important thing to remember is that although the return type
6340 of catgets is `char *' the resulting string _must not_ be changed. It
6341 should better be `const char *', but the standard is published in 1988,
6342 one year before ANSI C.
6344 The last of these functions is used and behaves as expected:
6348 After this no `catgets' call using the descriptor is legal anymore.
6351 File: gettext.info, Node: Problems with catgets, Prev: Interface to catgets, Up: catgets
6353 10.1.2 Problems with the `catgets' Interface?!
6354 ----------------------------------------------
6356 Now that this description seemed to be really easy -- where are the
6357 problems we speak of? In fact the interface could be used in a
6358 reasonable way, but constructing the message catalogs is a pain. The
6359 reason for this lies in the third argument of `catgets': the unique
6360 message ID. This has to be a numeric value for all messages in a single
6361 set. Perhaps you could imagine the problems keeping such a list while
6362 changing the source code. Add a new message here, remove one there. Of
6363 course there have been developed a lot of tools helping to organize this
6364 chaos but one as the other fails in one aspect or the other. We don't
6365 want to say that the other approach has no problems but they are far
6366 more easy to manage.
6369 File: gettext.info, Node: gettext, Next: Comparison, Prev: catgets, Up: Programmers
6371 10.2 About `gettext'
6372 ====================
6374 The definition of the `gettext' interface comes from a Uniforum
6375 proposal. It was submitted there by Sun, who had implemented the
6376 `gettext' function in SunOS 4, around 1990. Nowadays, the `gettext'
6377 interface is specified by the OpenI18N standard.
6379 The main point about this solution is that it does not follow the
6380 method of normal file handling (open-use-close) and that it does not
6381 burden the programmer with so many tasks, especially the unique key
6382 handling. Of course here also a unique key is needed, but this key is
6383 the message itself (how long or short it is). See *Note Comparison::
6384 for a more detailed comparison of the two methods.
6386 The following section contains a rather detailed description of the
6387 interface. We make it that detailed because this is the interface we
6388 chose for the GNU `gettext' Library. Programmers interested in using
6389 this library will be interested in this description.
6393 * Interface to gettext:: The interface
6394 * Ambiguities:: Solving ambiguities
6395 * Locating Catalogs:: Locating message catalog files
6396 * Charset conversion:: How to request conversion to Unicode
6397 * Plural forms:: Additional functions for handling plurals
6398 * GUI program problems:: Another technique for solving ambiguities
6399 * Optimized gettext:: Optimization of the *gettext functions
6402 File: gettext.info, Node: Interface to gettext, Next: Ambiguities, Prev: gettext, Up: gettext
6404 10.2.1 The Interface
6405 --------------------
6407 The minimal functionality an interface must have is a) to select a
6408 domain the strings are coming from (a single domain for all programs is
6409 not reasonable because its construction and maintenance is difficult,
6410 perhaps impossible) and b) to access a string in a selected domain.
6412 This is principally the description of the `gettext' interface. It
6413 has a global domain which unqualified usages reference. Of course this
6414 domain is selectable by the user.
6416 char *textdomain (const char *domain_name);
6418 This provides the possibility to change or query the current status
6419 of the current global domain of the `LC_MESSAGE' category. The
6420 argument is a null-terminated string, whose characters must be legal in
6421 the use in filenames. If the DOMAIN_NAME argument is `NULL', the
6422 function returns the current value. If no value has been set before,
6423 the name of the default domain is returned: _messages_. Please note
6424 that although the return value of `textdomain' is of type `char *' no
6425 changing is allowed. It is also important to know that no checks of
6426 the availability are made. If the name is not available you will see
6427 this by the fact that no translations are provided.
6429 To use a domain set by `textdomain' the function
6431 char *gettext (const char *msgid);
6433 is to be used. This is the simplest reasonable form one can imagine.
6434 The translation of the string MSGID is returned if it is available in
6435 the current domain. If it is not available, the argument itself is
6436 returned. If the argument is `NULL' the result is undefined.
6438 One thing which should come into mind is that no explicit dependency
6439 to the used domain is given. The current value of the domain for the
6440 `LC_MESSAGES' locale is used. If this changes between two executions
6441 of the same `gettext' call in the program, both calls reference a
6442 different message catalog.
6444 For the easiest case, which is normally used in internationalized
6445 packages, once at the beginning of execution a call to `textdomain' is
6446 issued, setting the domain to a unique name, normally the package name.
6447 In the following code all strings which have to be translated are
6448 filtered through the gettext function. That's all, the package speaks
6452 File: gettext.info, Node: Ambiguities, Next: Locating Catalogs, Prev: Interface to gettext, Up: gettext
6454 10.2.2 Solving Ambiguities
6455 --------------------------
6457 While this single name domain works well for most applications there
6458 might be the need to get translations from more than one domain. Of
6459 course one could switch between different domains with calls to
6460 `textdomain', but this is really not convenient nor is it fast. A
6461 possible situation could be one case subject to discussion during this
6462 writing: all error messages of functions in the set of common used
6463 functions should go into a separate domain `error'. By this mean we
6464 would only need to translate them once. Another case are messages from
6465 a library, as these _have_ to be independent of the current domain set
6468 For this reasons there are two more functions to retrieve strings:
6470 char *dgettext (const char *domain_name, const char *msgid);
6471 char *dcgettext (const char *domain_name, const char *msgid,
6474 Both take an additional argument at the first place, which
6475 corresponds to the argument of `textdomain'. The third argument of
6476 `dcgettext' allows to use another locale but `LC_MESSAGES'. But I
6477 really don't know where this can be useful. If the DOMAIN_NAME is
6478 `NULL' or CATEGORY has an value beside the known ones, the result is
6479 undefined. It should also be noted that this function is not part of
6480 the second known implementation of this function family, the one found
6483 A second ambiguity can arise by the fact, that perhaps more than one
6484 domain has the same name. This can be solved by specifying where the
6485 needed message catalog files can be found.
6487 char *bindtextdomain (const char *domain_name,
6488 const char *dir_name);
6490 Calling this function binds the given domain to a file in the
6491 specified directory (how this file is determined follows below).
6492 Especially a file in the systems default place is not favored against
6493 the specified file anymore (as it would be by solely using
6494 `textdomain'). A `NULL' pointer for the DIR_NAME parameter returns the
6495 binding associated with DOMAIN_NAME. If DOMAIN_NAME itself is `NULL'
6496 nothing happens and a `NULL' pointer is returned. Here again as for
6497 all the other functions is true that none of the return value must be
6500 It is important to remember that relative path names for the
6501 DIR_NAME parameter can be trouble. Since the path is always computed
6502 relative to the current directory different results will be achieved
6503 when the program executes a `chdir' command. Relative paths should
6504 always be avoided to avoid dependencies and unreliabilities.
6507 File: gettext.info, Node: Locating Catalogs, Next: Charset conversion, Prev: Ambiguities, Up: gettext
6509 10.2.3 Locating Message Catalog Files
6510 -------------------------------------
6512 Because many different languages for many different packages have to be
6513 stored we need some way to add these information to file message catalog
6514 files. The way usually used in Unix environments is have this encoding
6515 in the file name. This is also done here. The directory name given in
6516 `bindtextdomain's second argument (or the default directory), followed
6517 by the value and name of the locale and the domain name are
6520 DIR_NAME/LOCALE/LC_CATEGORY/DOMAIN_NAME.mo
6522 The default value for DIR_NAME is system specific. For the GNU
6523 library, and for packages adhering to its conventions, it's:
6524 /usr/local/share/locale
6526 LOCALE is the value of the locale whose name is this `LC_CATEGORY'.
6527 For `gettext' and `dgettext' this `LC_CATEGORY' is always
6528 `LC_MESSAGES'.(1) The value of the locale is determined through
6529 `setlocale (LC_CATEGORY, NULL)'. (2) `dcgettext' specifies the locale
6530 category by the third argument.
6532 ---------- Footnotes ----------
6534 (1) Some system, eg Ultrix, don't have `LC_MESSAGES'. Here we use a
6535 more or less arbitrary value for it, namely 1729, the smallest positive
6536 integer which can be represented in two different ways as the sum of
6539 (2) When the system does not support `setlocale' its behavior in
6540 setting the locale values is simulated by looking at the environment
6544 File: gettext.info, Node: Charset conversion, Next: Plural forms, Prev: Locating Catalogs, Up: gettext
6546 10.2.4 How to specify the output character set `gettext' uses
6547 -------------------------------------------------------------
6549 `gettext' not only looks up a translation in a message catalog. It
6550 also converts the translation on the fly to the desired output character
6551 set. This is useful if the user is working in a different character set
6552 than the translator who created the message catalog, because it avoids
6553 distributing variants of message catalogs which differ only in the
6556 The output character set is, by default, the value of `nl_langinfo
6557 (CODESET)', which depends on the `LC_CTYPE' part of the current locale.
6558 But programs which store strings in a locale independent way (e.g.
6559 UTF-8) can request that `gettext' and related functions return the
6560 translations in that encoding, by use of the `bind_textdomain_codeset'
6563 Note that the MSGID argument to `gettext' is not subject to
6564 character set conversion. Also, when `gettext' does not find a
6565 translation for MSGID, it returns MSGID unchanged - independently of
6566 the current output character set. It is therefore recommended that all
6567 MSGIDs be US-ASCII strings.
6569 -- Function: char * bind_textdomain_codeset (const char *DOMAINNAME,
6570 const char *CODESET)
6571 The `bind_textdomain_codeset' function can be used to specify the
6572 output character set for message catalogs for domain DOMAINNAME.
6573 The CODESET argument must be a valid codeset name which can be used
6574 for the `iconv_open' function, or a null pointer.
6576 If the CODESET parameter is the null pointer,
6577 `bind_textdomain_codeset' returns the currently selected codeset
6578 for the domain with the name DOMAINNAME. It returns `NULL' if no
6579 codeset has yet been selected.
6581 The `bind_textdomain_codeset' function can be used several times.
6582 If used multiple times with the same DOMAINNAME argument, the
6583 later call overrides the settings made by the earlier one.
6585 The `bind_textdomain_codeset' function returns a pointer to a
6586 string containing the name of the selected codeset. The string is
6587 allocated internally in the function and must not be changed by the
6588 user. If the system went out of core during the execution of
6589 `bind_textdomain_codeset', the return value is `NULL' and the
6590 global variable ERRNO is set accordingly.
6593 File: gettext.info, Node: Plural forms, Next: GUI program problems, Prev: Charset conversion, Up: gettext
6595 10.2.5 Additional functions for plural forms
6596 --------------------------------------------
6598 The functions of the `gettext' family described so far (and all the
6599 `catgets' functions as well) have one problem in the real world which
6600 have been neglected completely in all existing approaches. What is
6601 meant here is the handling of plural forms.
6603 Looking through Unix source code before the time anybody thought
6604 about internationalization (and, sadly, even afterwards) one can often
6605 find code similar to the following:
6607 printf ("%d file%s deleted", n, n == 1 ? "" : "s");
6609 After the first complaints from people internationalizing the code
6610 people either completely avoided formulations like this or used strings
6611 like `"file(s)"'. Both look unnatural and should be avoided. First
6612 tries to solve the problem correctly looked like this:
6615 printf ("%d file deleted", n);
6617 printf ("%d files deleted", n);
6619 But this does not solve the problem. It helps languages where the
6620 plural form of a noun is not simply constructed by adding an `s' but
6621 that is all. Once again people fell into the trap of believing the
6622 rules their language is using are universal. But the handling of plural
6623 forms differs widely between the language families. For example, Rafal
6624 Maszkowski `<rzm@mat.uni.torun.pl>' reports:
6626 In Polish we use e.g. plik (file) this way:
6632 and so on (o' means 8859-2 oacute which should be rather okreska,
6633 similar to aogonek).
6635 There are two things which can differ between languages (and even
6636 inside language families);
6638 * The form how plural forms are built differs. This is a problem
6639 with languages which have many irregularities. German, for
6640 instance, is a drastic case. Though English and German are part
6641 of the same language family (Germanic), the almost regular forming
6642 of plural noun forms (appending an `s') is hardly found in German.
6644 * The number of plural forms differ. This is somewhat surprising for
6645 those who only have experiences with Romanic and Germanic languages
6646 since here the number is the same (there are two).
6648 But other language families have only one form or many forms. More
6649 information on this in an extra section.
6651 The consequence of this is that application writers should not try to
6652 solve the problem in their code. This would be localization since it is
6653 only usable for certain, hardcoded language environments. Instead the
6654 extended `gettext' interface should be used.
6656 These extra functions are taking instead of the one key string two
6657 strings and a numerical argument. The idea behind this is that using
6658 the numerical argument and the first string as a key, the implementation
6659 can select using rules specified by the translator the right plural
6660 form. The two string arguments then will be used to provide a return
6661 value in case no message catalog is found (similar to the normal
6662 `gettext' behavior). In this case the rules for Germanic language is
6663 used and it is assumed that the first string argument is the singular
6664 form, the second the plural form.
6666 This has the consequence that programs without language catalogs can
6667 display the correct strings only if the program itself is written using
6668 a Germanic language. This is a limitation but since the GNU C library
6669 (as well as the GNU `gettext' package) are written as part of the GNU
6670 package and the coding standards for the GNU project require program
6671 being written in English, this solution nevertheless fulfills its
6674 -- Function: char * ngettext (const char *MSGID1, const char *MSGID2,
6675 unsigned long int N)
6676 The `ngettext' function is similar to the `gettext' function as it
6677 finds the message catalogs in the same way. But it takes two
6678 extra arguments. The MSGID1 parameter must contain the singular
6679 form of the string to be converted. It is also used as the key
6680 for the search in the catalog. The MSGID2 parameter is the plural
6681 form. The parameter N is used to determine the plural form. If no
6682 message catalog is found MSGID1 is returned if `n == 1', otherwise
6685 An example for the use of this function is:
6687 printf (ngettext ("%d file removed", "%d files removed", n), n);
6689 Please note that the numeric value N has to be passed to the
6690 `printf' function as well. It is not sufficient to pass it only to
6693 -- Function: char * dngettext (const char *DOMAIN, const char *MSGID1,
6694 const char *MSGID2, unsigned long int N)
6695 The `dngettext' is similar to the `dgettext' function in the way
6696 the message catalog is selected. The difference is that it takes
6697 two extra parameter to provide the correct plural form. These two
6698 parameters are handled in the same way `ngettext' handles them.
6700 -- Function: char * dcngettext (const char *DOMAIN, const char
6701 *MSGID1, const char *MSGID2, unsigned long int N, int
6703 The `dcngettext' is similar to the `dcgettext' function in the way
6704 the message catalog is selected. The difference is that it takes
6705 two extra parameter to provide the correct plural form. These two
6706 parameters are handled in the same way `ngettext' handles them.
6708 Now, how do these functions solve the problem of the plural forms?
6709 Without the input of linguists (which was not available) it was not
6710 possible to determine whether there are only a few different forms in
6711 which plural forms are formed or whether the number can increase with
6712 every new supported language.
6714 Therefore the solution implemented is to allow the translator to
6715 specify the rules of how to select the plural form. Since the formula
6716 varies with every language this is the only viable solution except for
6717 hardcoding the information in the code (which still would require the
6718 possibility of extensions to not prevent the use of new languages).
6720 The information about the plural form selection has to be stored in
6721 the header entry of the PO file (the one with the empty `msgid' string).
6722 The plural form information looks like this:
6724 Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;
6726 The `nplurals' value must be a decimal number which specifies how
6727 many different plural forms exist for this language. The string
6728 following `plural' is an expression which is using the C language
6729 syntax. Exceptions are that no negative numbers are allowed, numbers
6730 must be decimal, and the only variable allowed is `n'. This expression
6731 will be evaluated whenever one of the functions `ngettext',
6732 `dngettext', or `dcngettext' is called. The numeric value passed to
6733 these functions is then substituted for all uses of the variable `n' in
6734 the expression. The resulting value then must be greater or equal to
6735 zero and smaller than the value given as the value of `nplurals'.
6737 The following rules are known at this point. The language with families
6738 are listed. But this does not necessarily mean the information can be
6739 generalized for the whole family (as can be easily seen in the table
6743 Some languages only require one single form. There is no
6744 distinction between the singular and plural form. An appropriate
6745 header entry would look like this:
6747 Plural-Forms: nplurals=1; plural=0;
6749 Languages with this property include:
6755 Japanese, Korean, Vietnamese
6757 Turkic/Altaic family
6760 Two forms, singular used for one only
6761 This is the form used in most existing programs since it is what
6762 English is using. A header entry would look like this:
6764 Plural-Forms: nplurals=2; plural=n != 1;
6766 (Note: this uses the feature of C expressions that boolean
6767 expressions have to value zero or one.)
6769 Languages with this property include:
6772 Danish, Dutch, English, Faroese, German, Norwegian, Swedish
6784 Italian, Portuguese, Spanish
6789 Two forms, singular used for zero and one
6790 Exceptional case in the language family. The header entry would
6793 Plural-Forms: nplurals=2; plural=n>1;
6795 Languages with this property include:
6798 French, Brazilian Portuguese
6800 Three forms, special case for zero
6801 The header entry would be:
6803 Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;
6805 Languages with this property include:
6810 Three forms, special cases for one and two
6811 The header entry would be:
6813 Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;
6815 Languages with this property include:
6820 Three forms, special case for numbers ending in 1[2-9]
6821 The header entry would look like this:
6823 Plural-Forms: nplurals=3; \
6824 plural=n%10==1 && n%100!=11 ? 0 : \
6825 n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2;
6827 Languages with this property include:
6832 Three forms, special cases for numbers ending in 1 and 2, 3, 4, except those ending in 1[1-4]
6833 The header entry would look like this:
6835 Plural-Forms: nplurals=3; \
6836 plural=n%10==1 && n%100!=11 ? 0 : \
6837 n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
6839 Languages with this property include:
6842 Croatian, Serbian, Russian, Ukrainian
6844 Three forms, special cases for 1 and 2, 3, 4
6845 The header entry would look like this:
6847 Plural-Forms: nplurals=3; \
6848 plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;
6850 Languages with this property include:
6855 Three forms, special case for one and some numbers ending in 2, 3, or 4
6856 The header entry would look like this:
6858 Plural-Forms: nplurals=3; \
6860 n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
6862 Languages with this property include:
6867 Four forms, special case for one and all numbers ending in 02, 03, or 04
6868 The header entry would look like this:
6870 Plural-Forms: nplurals=4; \
6871 plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;
6873 Languages with this property include:
6878 ---------- Footnotes ----------
6880 (1) Additions are welcome. Send appropriate information to
6881 <bug-glibc-manual@gnu.org>.
6884 File: gettext.info, Node: GUI program problems, Next: Optimized gettext, Prev: Plural forms, Up: gettext
6886 10.2.6 How to use `gettext' in GUI programs
6887 -------------------------------------------
6889 One place where the `gettext' functions, if used normally, have big
6890 problems is within programs with graphical user interfaces (GUIs). The
6891 problem is that many of the strings which have to be translated are very
6892 short. They have to appear in pull-down menus which restricts the
6893 length. But strings which are not containing entire sentences or at
6894 least large fragments of a sentence may appear in more than one
6895 situation in the program but might have different translations. This is
6896 especially true for the one-word strings which are frequently used in
6899 As a consequence many people say that the `gettext' approach is
6900 wrong and instead `catgets' should be used which indeed does not have
6901 this problem. But there is a very simple and powerful method to handle
6902 these kind of problems with the `gettext' functions.
6904 As as example consider the following fictional situation. A GUI program
6905 has a menu bar with the following entries:
6907 +------------+------------+--------------------------------------+
6908 | File | Printer | |
6909 +------------+------------+--------------------------------------+
6912 +----------+ | Connect |
6915 To have the strings `File', `Printer', `Open', `New', `Select', and
6916 `Connect' translated there has to be at some point in the code a call
6917 to a function of the `gettext' family. But in two places the string
6918 passed into the function would be `Open'. The translations might not
6919 be the same and therefore we are in the dilemma described above.
6921 One solution to this problem is to artificially enlengthen the
6922 strings to make them unambiguous. But what would the program do if no
6923 translation is available? The enlengthened string is not what should be
6924 printed. So we should use a little bit modified version of the
6927 To enlengthen the strings a uniform method should be used. E.g., in
6928 the example above the strings could be chosen as
6936 Menu|Printer|Connect
6938 Now all the strings are different and if now instead of `gettext'
6939 the following little wrapper function is used, everything works just
6943 sgettext (const char *msgid)
6945 char *msgval = gettext (msgid);
6946 if (msgval == msgid)
6947 msgval = strrchr (msgid, '|') + 1;
6951 What this little function does is to recognize the case when no
6952 translation is available. This can be done very efficiently by a
6953 pointer comparison since the return value is the input value. If there
6954 is no translation we know that the input string is in the format we used
6955 for the Menu entries and therefore contains a `|' character. We simply
6956 search for the last occurrence of this character and return a pointer
6957 to the character following it. That's it!
6959 If one now consistently uses the enlengthened string form and
6960 replaces the `gettext' calls with calls to `sgettext' (this is normally
6961 limited to very few places in the GUI implementation) then it is
6962 possible to produce a program which can be internationalized.
6964 The other `gettext' functions (`dgettext', `dcgettext' and the
6965 `ngettext' equivalents) can and should have corresponding functions as
6966 well which look almost identical, except for the parameters and the
6967 call to the underlying function.
6969 Now there is of course the question why such functions do not exist
6970 in the GNU gettext package? There are two parts of the answer to this
6973 * They are easy to write and therefore can be provided by the
6974 project they are used in. This is not an answer by itself and
6975 must be seen together with the second part which is:
6977 * There is no way the gettext package can contain a version which
6978 can work everywhere. The problem is the selection of the
6979 character to separate the prefix from the actual string in the
6980 enlenghtened string. The examples above used `|' which is a quite
6981 good choice because it resembles a notation frequently used in
6982 this context and it also is a character not often used in message
6985 But what if the character is used in message strings? Or if the
6986 chose character is not available in the character set on the
6987 machine one compiles (e.g., `|' is not required to exist for
6988 ISO C; this is why the `iso646.h' file exists in ISO C programming
6991 There is only one more comment to be said. The wrapper function
6992 above requires that the translations strings are not enlengthened
6993 themselves. This is only logical. There is no need to disambiguate
6994 the strings (since they are never used as keys for a search) and one
6995 also saves quite some memory and disk space by doing this.
6998 File: gettext.info, Node: Optimized gettext, Prev: GUI program problems, Up: gettext
7000 10.2.7 Optimization of the *gettext functions
7001 ---------------------------------------------
7003 At this point of the discussion we should talk about an advantage of the
7004 GNU `gettext' implementation. Some readers might have pointed out that
7005 an internationalized program might have a poor performance if some
7006 string has to be translated in an inner loop. While this is unavoidable
7007 when the string varies from one run of the loop to the other it is
7008 simply a waste of time when the string is always the same. Take the
7014 puts (gettext ("Hello world"));
7018 When the locale selection does not change between two runs the resulting
7019 string is always the same. One way to use this is:
7022 str = gettext ("Hello world");
7029 But this solution is not usable in all situation (e.g. when the locale
7030 selection changes) nor does it lead to legible code.
7032 For this reason, GNU `gettext' caches previous translation results.
7033 When the same translation is requested twice, with no new message
7034 catalogs being loaded in between, `gettext' will, the second time, find
7035 the result through a single cache lookup.
7038 File: gettext.info, Node: Comparison, Next: Using libintl.a, Prev: gettext, Up: Programmers
7040 10.3 Comparing the Two Interfaces
7041 =================================
7043 The following discussion is perhaps a little bit colored. As said
7044 above we implemented GNU `gettext' following the Uniforum proposal and
7045 this surely has its reasons. But it should show how we came to this
7048 First we take a look at the developing process. When we write an
7049 application using NLS provided by `gettext' we proceed as always. Only
7050 when we come to a string which might be seen by the users and thus has
7051 to be translated we use `gettext("...")' instead of `"..."'. At the
7052 beginning of each source file (or in a central header file) we define
7054 #define gettext(String) (String)
7056 Even this definition can be avoided when the system supports the
7057 `gettext' function in its C library. When we compile this code the
7058 result is the same as if no NLS code is used. When you take a look at
7059 the GNU `gettext' code you will see that we use `_("...")' instead of
7060 `gettext("...")'. This reduces the number of additional characters per
7061 translatable string to _3_ (in words: three).
7063 When now a production version of the program is needed we simply
7064 replace the definition
7066 #define _(String) (String)
7070 #include <libintl.h>
7071 #define _(String) gettext (String)
7073 Additionally we run the program `xgettext' on all source code file
7074 which contain translatable strings and that's it: we have a running
7075 program which does not depend on translations to be available, but which
7076 can use any that becomes available.
7078 The same procedure can be done for the `gettext_noop' invocations
7079 (*note Special cases::). One usually defines `gettext_noop' as a no-op
7080 macro. So you should consider the following code for your project:
7082 #define gettext_noop(String) String
7083 #define N_(String) gettext_noop (String)
7085 `N_' is a short form similar to `_'. The `Makefile' in the `po/'
7086 directory of GNU `gettext' knows by default both of the mentioned short
7087 forms so you are invited to follow this proposal for your own ease.
7089 Now to `catgets'. The main problem is the work for the programmer.
7090 Every time he comes to a translatable string he has to define a number
7091 (or a symbolic constant) which has also be defined in the message
7092 catalog file. He also has to take care for duplicate entries,
7093 duplicate message IDs etc. If he wants to have the same quality in the
7094 message catalog as the GNU `gettext' program provides he also has to
7095 put the descriptive comments for the strings and the location in all
7096 source code files in the message catalog. This is nearly a Mission:
7099 But there are also some points people might call advantages speaking
7100 for `catgets'. If you have a single word in a string and this string
7101 is used in different contexts it is likely that in one or the other
7102 language the word has different translations. Example:
7104 printf ("%s: %d", gettext ("number"), number_of_errors)
7106 printf ("you should see %d %s", number_count,
7107 number_count == 1 ? gettext ("number") : gettext ("numbers"))
7109 Here we have to translate two times the string `"number"'. Even if
7110 you do not speak a language beside English it might be possible to
7111 recognize that the two words have a different meaning. In German the
7112 first appearance has to be translated to `"Anzahl"' and the second to
7115 Now you can say that this example is really esoteric. And you are
7116 right! This is exactly how we felt about this problem and decide that
7117 it does not weight that much. The solution for the above problem could
7120 printf ("%s %d", gettext ("number:"), number_of_errors)
7122 printf (number_count == 1 ? gettext ("you should see %d number")
7123 : gettext ("you should see %d numbers"),
7126 We believe that we can solve all conflicts with this method. If it
7127 is difficult one can also consider changing one of the conflicting
7128 string a little bit. But it is not impossible to overcome.
7130 `catgets' allows same original entry to have different translations,
7131 but `gettext' has another, scalable approach for solving ambiguities of
7132 this kind: *Note Ambiguities::.
7135 File: gettext.info, Node: Using libintl.a, Next: gettext grok, Prev: Comparison, Up: Programmers
7137 10.4 Using libintl.a in own programs
7138 ====================================
7140 Starting with version 0.9.4 the library `libintl.h' should be
7141 self-contained. I.e., you can use it in your own programs without
7142 providing additional functions. The `Makefile' will put the header and
7143 the library in directories selected using the `$(prefix)'.
7146 File: gettext.info, Node: gettext grok, Next: Temp Programmers, Prev: Using libintl.a, Up: Programmers
7148 10.5 Being a `gettext' grok
7149 ===========================
7151 To fully exploit the functionality of the GNU `gettext' library it is
7152 surely helpful to read the source code. But for those who don't want
7153 to spend that much time in reading the (sometimes complicated) code here
7156 * Changing the language at runtime
7158 For interactive programs it might be useful to offer a selection
7159 of the used language at runtime. To understand how to do this one
7160 need to know how the used language is determined while executing
7161 the `gettext' function. The method which is presented here only
7162 works correctly with the GNU implementation of the `gettext'
7165 In the function `dcgettext' at every call the current setting of
7166 the highest priority environment variable is determined and used.
7167 Highest priority means here the following list with decreasing
7174 3. `LC_xxx', according to selected locale
7178 Afterwards the path is constructed using the found value and the
7179 translation file is loaded if available.
7181 What happens now when the value for, say, `LANGUAGE' changes?
7182 According to the process explained above the new value of this
7183 variable is found as soon as the `dcgettext' function is called.
7184 But this also means the (perhaps) different message catalog file
7185 is loaded. In other words: the used language is changed.
7187 But there is one little hook. The code for gcc-2.7.0 and up
7188 provides some optimization. This optimization normally prevents
7189 the calling of the `dcgettext' function as long as no new catalog
7190 is loaded. But if `dcgettext' is not called the program also
7191 cannot find the `LANGUAGE' variable be changed (*note Optimized
7192 gettext::). A solution for this is very easy. Include the
7193 following code in the language switching function.
7195 /* Change language. */
7196 setenv ("LANGUAGE", "fr", 1);
7198 /* Make change known. */
7200 extern int _nl_msg_cat_cntr;
7204 The variable `_nl_msg_cat_cntr' is defined in `loadmsgcat.c'. You
7205 don't need to know what this is for. But it can be used to detect
7206 whether a `gettext' implementation is GNU gettext and not non-GNU
7207 system's native gettext implementation.
7211 File: gettext.info, Node: Temp Programmers, Prev: gettext grok, Up: Programmers
7213 10.6 Temporary Notes for the Programmers Chapter
7214 ================================================
7218 * Temp Implementations:: Temporary - Two Possible Implementations
7219 * Temp catgets:: Temporary - About `catgets'
7220 * Temp WSI:: Temporary - Why a single implementation
7221 * Temp Notes:: Temporary - Notes
7224 File: gettext.info, Node: Temp Implementations, Next: Temp catgets, Prev: Temp Programmers, Up: Temp Programmers
7226 10.6.1 Temporary - Two Possible Implementations
7227 -----------------------------------------------
7229 There are two competing methods for language independent messages: the
7230 X/Open `catgets' method, and the Uniforum `gettext' method. The
7231 `catgets' method indexes messages by integers; the `gettext' method
7232 indexes them by their English translations. The `catgets' method has
7233 been around longer and is supported by more vendors. The `gettext'
7234 method is supported by Sun, and it has been heard that the COSE
7235 multi-vendor initiative is supporting it. Neither method is a POSIX
7236 standard; the POSIX.1 committee had a lot of disagreement in this area.
7238 Neither one is in the POSIX standard. There was much disagreement
7239 in the POSIX.1 committee about using the `gettext' routines vs.
7240 `catgets' (XPG). In the end the committee couldn't agree on anything,
7241 so no messaging system was included as part of the standard. I believe
7242 the informative annex of the standard includes the XPG3 messaging
7243 interfaces, "...as an example of a messaging system that has been
7246 They were very careful not to say anywhere that you should use one
7247 set of interfaces over the other. For more on this topic please see
7248 the Programming for Internationalization FAQ.
7251 File: gettext.info, Node: Temp catgets, Next: Temp WSI, Prev: Temp Implementations, Up: Temp Programmers
7253 10.6.2 Temporary - About `catgets'
7254 ----------------------------------
7256 There have been a few discussions of late on the use of `catgets' as a
7257 base. I think it important to present both sides of the argument and
7258 hence am opting to play devil's advocate for a little bit.
7260 I'll not deny the fact that `catgets' could have been designed a lot
7261 better. It currently has quite a number of limitations and these have
7262 already been pointed out.
7264 However there is a great deal to be said for consistency and
7265 standardization. A common recurring problem when writing Unix software
7266 is the myriad portability problems across Unix platforms. It seems as
7267 if every Unix vendor had a look at the operating system and found parts
7268 they could improve upon. Undoubtedly, these modifications are probably
7269 innovative and solve real problems. However, software developers have
7270 a hard time keeping up with all these changes across so many platforms.
7272 And this has prompted the Unix vendors to begin to standardize their
7273 systems. Hence the impetus for Spec1170. Every major Unix vendor has
7274 committed to supporting this standard and every Unix software developer
7275 waits with glee the day they can write software to this standard and
7276 simply recompile (without having to use autoconf) across different
7279 As I understand it, Spec1170 is roughly based upon version 4 of the
7280 X/Open Portability Guidelines (XPG4). Because `catgets' and friends
7281 are defined in XPG4, I'm led to believe that `catgets' is a part of
7282 Spec1170 and hence will become a standardized component of all Unix
7286 File: gettext.info, Node: Temp WSI, Next: Temp Notes, Prev: Temp catgets, Up: Temp Programmers
7288 10.6.3 Temporary - Why a single implementation
7289 ----------------------------------------------
7291 Now it seems kind of wasteful to me to have two different systems
7292 installed for accessing message catalogs. If we do want to remedy
7293 `catgets' deficiencies why don't we try to expand `catgets' (in a
7294 compatible manner) rather than implement an entirely new system.
7295 Otherwise, we'll end up with two message catalog access systems
7296 installed with an operating system - one set of routines for packages
7297 using GNU `gettext' for their internationalization, and another set of
7298 routines (catgets) for all other software. Bloated?
7300 Supposing another catalog access system is implemented. Which do we
7301 recommend? At least for Linux, we need to attract as many software
7302 developers as possible. Hence we need to make it as easy for them to
7303 port their software as possible. Which means supporting `catgets'. We
7304 will be implementing the `libintl' code within our `libc', but does
7305 this mean we also have to incorporate another message catalog access
7306 scheme within our `libc' as well? And what about people who are going
7307 to be using the `libintl' + non-`catgets' routines. When they port
7308 their software to other platforms, they're now going to have to include
7309 the front-end (`libintl') code plus the back-end code (the non-`catgets'
7310 access routines) with their software instead of just including the
7311 `libintl' code with their software.
7313 Message catalog support is however only the tip of the iceberg.
7314 What about the data for the other locale categories. They also have a
7315 number of deficiencies. Are we going to abandon them as well and
7316 develop another duplicate set of routines (should `libintl' expand
7317 beyond message catalog support)?
7319 Like many parts of Unix that can be improved upon, we're stuck with
7320 balancing compatibility with the past with useful improvements and
7321 innovations for the future.
7324 File: gettext.info, Node: Temp Notes, Prev: Temp WSI, Up: Temp Programmers
7326 10.6.4 Temporary - Notes
7327 ------------------------
7329 X/Open agreed very late on the standard form so that many
7330 implementations differ from the final form. Both of my system (old
7331 Linux catgets and Ultrix-4) have a strange variation.
7333 OK. After incorporating the last changes I have to spend some time
7334 on making the GNU/Linux `libc' `gettext' functions. So in future
7335 Solaris is not the only system having `gettext'.
7338 File: gettext.info, Node: Translators, Next: Maintainers, Prev: Programmers, Up: Top
7340 11 The Translator's View
7341 ************************
7345 * Trans Intro 0:: Introduction 0
7346 * Trans Intro 1:: Introduction 1
7347 * Discussions:: Discussions
7348 * Organization:: Organization
7349 * Information Flow:: Information Flow
7350 * Prioritizing messages:: How to find which messages to translate first
7353 File: gettext.info, Node: Trans Intro 0, Next: Trans Intro 1, Prev: Translators, Up: Translators
7358 Free software is going international! The Translation Project is a way
7359 to get maintainers, translators and users all together, so free software
7360 will gradually become able to speak many native languages.
7362 The GNU `gettext' tool set contains _everything_ maintainers need
7363 for internationalizing their packages for messages. It also contains
7364 quite useful tools for helping translators at localizing messages to
7365 their native language, once a package has already been
7368 To achieve the Translation Project, we need many interested people
7369 who like their own language and write it well, and who are also able to
7370 synergize with other translators speaking the same language. If you'd
7371 like to volunteer to _work_ at translating messages, please send mail
7372 to your translating team.
7374 Each team has its own mailing list, courtesy of Linux International.
7375 You may reach your translating team at the address `LL@li.org',
7376 replacing LL by the two-letter ISO 639 code for your language.
7377 Language codes are _not_ the same as country codes given in ISO 3166.
7378 The following translating teams exist:
7380 Chinese `zh', Czech `cs', Danish `da', Dutch `nl', Esperanto `eo',
7381 Finnish `fi', French `fr', Irish `ga', German `de', Greek `el',
7382 Italian `it', Japanese `ja', Indonesian `in', Norwegian `no',
7383 Polish `pl', Portuguese `pt', Russian `ru', Spanish `es', Swedish
7384 `sv' and Turkish `tr'.
7386 For example, you may reach the Chinese translating team by writing to
7387 `zh@li.org'. When you become a member of the translating team for your
7388 own language, you may subscribe to its list. For example, Swedish
7389 people can send a message to `sv-request@li.org', having this message
7394 Keep in mind that team members should be interested in _working_ at
7395 translations, or at solving translational difficulties, rather than
7396 merely lurking around. If your team does not exist yet and you want to
7397 start one, please write to `translation@iro.umontreal.ca'; you will
7398 then reach the coordinator for all translator teams.
7400 A handful of GNU packages have already been adapted and provided
7401 with message translations for several languages. Translation teams
7402 have begun to organize, using these packages as a starting point. But
7403 there are many more packages and many languages for which we have no
7404 volunteer translators. If you would like to volunteer to work at
7405 translating messages, please send mail to
7406 `translation@iro.umontreal.ca' indicating what language(s) you can work
7410 File: gettext.info, Node: Trans Intro 1, Next: Discussions, Prev: Trans Intro 0, Up: Translators
7415 This is now official, GNU is going international! Here is the
7416 announcement submitted for the January 1995 GNU Bulletin:
7418 A handful of GNU packages have already been adapted and provided
7419 with message translations for several languages. Translation
7420 teams have begun to organize, using these packages as a starting
7421 point. But there are many more packages and many languages for
7422 which we have no volunteer translators. If you'd like to
7423 volunteer to work at translating messages, please send mail to
7424 `translation@iro.umontreal.ca' indicating what language(s) you can
7427 This document should answer many questions for those who are curious
7428 about the process or would like to contribute. Please at least skim
7429 over it, hoping to cut down a little of the high volume of e-mail
7430 generated by this collective effort towards internationalization of
7433 Most free programming which is widely shared is done in English, and
7434 currently, English is used as the main communicating language between
7435 national communities collaborating to free software. This very document
7436 is written in English. This will not change in the foreseeable future.
7438 However, there is a strong appetite from national communities for
7439 having more software able to write using national language and habits,
7440 and there is an on-going effort to modify free software in such a way
7441 that it becomes able to do so. The experiments driven so far raised an
7442 enthusiastic response from pretesters, so we believe that
7443 internationalization of free software is dedicated to succeed.
7445 For suggestion clarifications, additions or corrections to this
7446 document, please e-mail to `translation@iro.umontreal.ca'.
7449 File: gettext.info, Node: Discussions, Next: Organization, Prev: Trans Intro 1, Up: Translators
7454 Facing this internationalization effort, a few users expressed their
7455 concerns. Some of these doubts are presented and discussed, here.
7459 Some languages are not spoken by a very large number of people, so
7460 people speaking them sometimes consider that there may not be all
7461 that much demand such versions of free software packages.
7462 Moreover, many people being _into computers_, in some countries,
7463 generally seem to prefer English versions of their software.
7465 On the other end, people might enjoy their own language a lot, and
7466 be very motivated at providing to themselves the pleasure of
7467 having their beloved free software speaking their mother tongue.
7468 They do themselves a personal favor, and do not pay that much
7469 attention to the number of people benefiting of their work.
7473 Other users are shy to push forward their own language, seeing in
7474 this some kind of misplaced propaganda. Someone thought there
7475 must be some users of the language over the networks pestering
7476 other people with it.
7478 But any spoken language is worth localization, because there are
7479 people behind the language for whom the language is important and
7480 dear to their hearts.
7484 The biggest problem is to find the right translations so that
7485 everybody can understand the messages. Translations are usually a
7486 little odd. Some people get used to English, to the extent they
7487 may find translations into their own language "rather pushy,
7488 obnoxious and sometimes even hilarious." As a French speaking
7489 man, I have the experience of those instruction manuals for goods,
7490 so poorly translated in French in Korea or Taiwan...
7492 The fact is that we sometimes have to create a kind of national
7493 computer culture, and this is not easy without the collaboration of
7494 many people liking their mother tongue. This is why translations
7495 are better achieved by people knowing and loving their own
7496 language, and ready to work together at improving the results they
7499 * Dependencies over the GPL or LGPL
7501 Some people wonder if using GNU `gettext' necessarily brings their
7502 package under the protective wing of the GNU General Public
7503 License or the GNU Library General Public License, when they do
7504 not want to make their program free, or want other kinds of
7505 freedom. The simplest answer is "normally not".
7507 The `gettext-runtime' part of GNU `gettext', i.e. the contents of
7508 `libintl', is covered by the GNU Library General Public License.
7509 The `gettext-tools' part of GNU `gettext', i.e. the rest of the
7510 GNU `gettext' package, is covered by the GNU General Public
7513 The mere marking of localizable strings in a package, or
7514 conditional inclusion of a few lines for initialization, is not
7515 really including GPL'ed or LGPL'ed code. However, since the
7516 localization routines in `libintl' are under the LGPL, the LGPL
7517 needs to be considered. It gives the right to distribute the
7518 complete unmodified source of `libintl' even with non-free
7519 programs. It also gives the right to use `libintl' as a shared
7520 library, even for non-free programs. But it gives the right to
7521 use `libintl' as a static library or to incorporate `libintl' into
7522 another library only to free software.
7526 File: gettext.info, Node: Organization, Next: Information Flow, Prev: Discussions, Up: Translators
7531 On a larger scale, the true solution would be to organize some kind of
7532 fairly precise set up in which volunteers could participate. I gave
7533 some thought to this idea lately, and realize there will be some touchy
7534 points. I thought of writing to Richard Stallman to launch such a
7535 project, but feel it might be good to shake out the ideas between
7536 ourselves first. Most probably that Linux International has some
7537 experience in the field already, or would like to orchestrate the
7538 volunteer work, maybe. Food for thought, in any case!
7540 I guess we have to setup something early, somehow, that will help
7541 many possible contributors of the same language to interlock and avoid
7542 work duplication, and further be put in contact for solving together
7543 problems particular to their tongue (in most languages, there are many
7544 difficulties peculiar to translating technical English). My Swedish
7545 contributor acknowledged these difficulties, and I'm well aware of them
7548 This is surely not a technical issue, but we should manage so the
7549 effort of locale contributors be maximally useful, despite the national
7550 team layer interface between contributors and maintainers.
7552 The Translation Project needs some setup for coordinating language
7553 coordinators. Localizing evolving programs will surely become a
7554 permanent and continuous activity in the free software community, once
7555 well started. The setup should be minimally completed and tested
7556 before GNU `gettext' becomes an official reality. The e-mail address
7557 `translation@iro.umontreal.ca' has been setup for receiving offers from
7558 volunteers and general e-mail on these topics. This address reaches
7559 the Translation Project coordinator.
7563 * Central Coordination:: Central Coordination
7564 * National Teams:: National Teams
7565 * Mailing Lists:: Mailing Lists
7568 File: gettext.info, Node: Central Coordination, Next: National Teams, Prev: Organization, Up: Organization
7570 11.4.1 Central Coordination
7571 ---------------------------
7573 I also think GNU will need sooner than it thinks, that someone setup a
7574 way to organize and coordinate these groups. Some kind of group of
7575 groups. My opinion is that it would be good that GNU delegates this
7576 task to a small group of collaborating volunteers, shortly. Perhaps in
7577 `gnu.announce' a list of this national committee's can be published.
7579 My role as coordinator would simply be to refer to Ulrich any German
7580 speaking volunteer interested to localization of free software
7581 packages, and maybe helping national groups to initially organize,
7582 while maintaining national registries for until national groups are
7583 ready to take over. In fact, the coordinator should ease volunteers to
7584 get in contact with one another for creating national teams, which
7585 should then select one coordinator per language, or country
7586 (regionalized language). If well done, the coordination should be
7587 useful without being an overwhelming task, the time to put delegations
7591 File: gettext.info, Node: National Teams, Next: Mailing Lists, Prev: Central Coordination, Up: Organization
7593 11.4.2 National Teams
7594 ---------------------
7596 I suggest we look for volunteer coordinators/editors for individual
7597 languages. These people will scan contributions of translation files
7598 for various programs, for their own languages, and will ensure high and
7599 uniform standards of diction.
7601 From my current experience with other people in these days, those who
7602 provide localizations are very enthusiastic about the process, and are
7603 more interested in the localization process than in the program they
7604 localize, and want to do many programs, not just one. This seems to
7605 confirm that having a coordinator/editor for each language is a good
7608 We need to choose someone who is good at writing clear and concise
7609 prose in the language in question. That is hard--we can't check it
7610 ourselves. So we need to ask a few people to judge each others'
7611 writing and select the one who is best.
7613 I announce my prerelease to a few dozen people, and you would not
7614 believe all the discussions it generated already. I shudder to think
7615 what will happen when this will be launched, for true, officially,
7616 world wide. Who am I to arbitrate between two Czekolsovak users
7617 contradicting each other, for example?
7619 I assume that your German is not much better than my French so that
7620 I would not be able to judge about these formulations. What I would
7621 suggest is that for each language there is a group for people who
7622 maintain the PO files and judge about changes. I suspect there will be
7623 cultural differences between how such groups of people will behave.
7624 Some will have relaxed ways, reach consensus easily, and have anyone of
7625 the group relate to the maintainers, while others will fight to death,
7626 organize heavy administrations up to national standards, and use strict
7629 The German team is putting out a good example. Right now, they are
7630 maybe half a dozen people revising translations of each other and
7631 discussing the linguistic issues. I do not even have all the names.
7632 Ulrich Drepper is taking care of coordinating the German team. He
7633 subscribed to all my pretest lists, so I do not even have to warn him
7634 specifically of incoming releases.
7636 I'm sure, that is a good idea to get teams for each language working
7637 on translations. That will make the translations better and more
7642 * Sub-Cultures:: Sub-Cultures
7643 * Organizational Ideas:: Organizational Ideas
7646 File: gettext.info, Node: Sub-Cultures, Next: Organizational Ideas, Prev: National Teams, Up: National Teams
7648 11.4.2.1 Sub-Cultures
7649 .....................
7651 Taking French for example, there are a few sub-cultures around computers
7652 which developed diverging vocabularies. Picking volunteers here and
7653 there without addressing this problem in an organized way, soon in the
7654 project, might produce a distasteful mix of internationalized programs,
7655 and possibly trigger endless quarrels among those who really care.
7657 Keeping some kind of unity in the way French localization of
7658 internationalized programs is achieved is a difficult (and delicate)
7659 job. Knowing the latin character of French people (:-), if we take this
7660 the wrong way, we could end up nowhere, or spoil a lot of energies.
7661 Maybe we should begin to address this problem seriously _before_ GNU
7662 `gettext' become officially published. And I suspect that this means
7666 File: gettext.info, Node: Organizational Ideas, Prev: Sub-Cultures, Up: National Teams
7668 11.4.2.2 Organizational Ideas
7669 .............................
7671 I expect the next big changes after the official release. Please note
7672 that I use the German translation of the short GPL message. We need to
7673 set a few good examples before the localization goes out for true in
7674 the free software community. Here are a few points to discuss:
7676 * Each group should have one FTP server (at least one master).
7678 * The files on the server should reflect the latest version (of
7679 course!) and it should also contain a RCS directory with the
7680 corresponding archives (I don't have this now).
7682 * There should also be a ChangeLog file (this is more useful than the
7683 RCS archive but can be generated automatically from the later by
7686 * A "core group" should judge about questionable changes (for now
7687 this group consists solely by me but I ask some others
7688 occasionally; this also seems to work).
7692 File: gettext.info, Node: Mailing Lists, Prev: National Teams, Up: Organization
7694 11.4.3 Mailing Lists
7695 --------------------
7697 If we get any inquiries about GNU `gettext', send them on to:
7699 `translation@iro.umontreal.ca'
7701 The `*-pretest' lists are quite useful to me, maybe the idea could
7702 be generalized to many GNU, and non-GNU packages. But each maintainer
7705 Franc,ois, we have a mechanism in place here at `gnu.ai.mit.edu' to
7706 track teams, support mailing lists for them and log members. We have a
7707 slight preference that you use it. If this is OK with you, I can get
7710 Things are changing! A few years ago, when Daniel Fekete and I
7711 asked for a mailing list for GNU localization, nested at the FSF, we
7712 were politely invited to organize it anywhere else, and so did we. For
7713 communicating with my pretesters, I later made a handful of mailing
7714 lists located at iro.umontreal.ca and administrated by `majordomo'.
7715 These lists have been _very_ dependable so far...
7717 I suspect that the German team will organize itself a mailing list
7718 located in Germany, and so forth for other countries. But before they
7719 organize for true, it could surely be useful to offer mailing lists
7720 located at the FSF to each national team. So yes, please explain me
7721 how I should proceed to create and handle them.
7723 We should create temporary mailing lists, one per country, to help
7724 people organize. Temporary, because once regrouped and structured, it
7725 would be fair the volunteers from country bring back _their_ list in
7726 there and manage it as they want. My feeling is that, in the long run,
7727 each team should run its own list, from within their country. There
7728 also should be some central list to which all teams could subscribe as
7729 they see fit, as long as each team is represented in it.
7732 File: gettext.info, Node: Information Flow, Next: Prioritizing messages, Prev: Organization, Up: Translators
7734 11.5 Information Flow
7735 =====================
7737 There will surely be some discussion about this messages after the
7738 packages are finally released. If people now send you some proposals
7739 for better messages, how do you proceed? Jim, please note that right
7740 now, as I put forward nearly a dozen of localizable programs, I receive
7741 both the translations and the coordination concerns about them.
7743 If I put one of my things to pretest, Ulrich receives the
7744 announcement and passes it on to the German team, who make last minute
7745 revisions. Then he submits the translation files to me _as the
7746 maintainer_. For free packages I do not maintain, I would not even
7747 hear about it. This scheme could be made to work for the whole
7748 Translation Project, I think. For security reasons, maybe Ulrich
7749 (national coordinators, in fact) should update central registry kept at
7750 the Translation Project (Jim, me, or Len's recruits) once in a while.
7752 In December/January, I was aggressively ready to internationalize
7753 all of GNU, giving myself the duty of one small GNU package per week or
7754 so, taking many weeks or months for bigger packages. But it does not
7755 work this way. I first did all the things I'm responsible for. I've
7756 nothing against some missionary work on other maintainers, but I'm also
7757 loosing a lot of energy over it--same debates over again.
7759 And when the first localized packages are released we'll get a lot of
7760 responses about ugly translations :-). Surely, and we need to have
7761 beforehand a fairly good idea about how to handle the information flow
7762 between the national teams and the package maintainers.
7764 Please start saving somewhere a quick history of each PO file. I
7765 know for sure that the file format will change, allowing for comments.
7766 It would be nice that each file has a kind of log, and references for
7767 those who want to submit comments or gripes, or otherwise contribute.
7768 I sent a proposal for a fast and flexible format, but it is not
7769 receiving acceptance yet by the GNU deciders. I'll tell you when I
7770 have more information about this.
7773 File: gettext.info, Node: Prioritizing messages, Prev: Information Flow, Up: Translators
7775 11.6 Prioritizing messages: How to determine which messages to translate first
7776 ==============================================================================
7778 A translator sometimes has only a limited amount of time per week to
7779 spend on a package, and some packages have quite large message catalogs
7780 (over 1000 messages). Therefore she wishes to translate the messages
7781 first that are the most visible to the user, or that occur most
7782 frequently. This section describes how to determine these "most
7783 urgent" messages. It also applies to determine the "next most urgent"
7784 messages after the message catalog has already been partially
7787 In a first step, she uses the programs like a user would do. While
7788 she does this, the GNU `gettext' library logs into a file the not yet
7789 translated messages for which a translation was requested from the
7792 In a second step, she uses the PO mode to translate precisely this
7795 Here a more details. The GNU `libintl' library (but not the
7796 corresponding functions in GNU `libc') supports an environment variable
7797 `GETTEXT_LOG_UNTRANSLATED'. The GNU `libintl' library will log into
7798 this file the messages for which `gettext()' and related functions
7799 couldn't find the translation. If the file doesn't exist, it will be
7800 created as needed. On systems with GNU `libc' a shared library
7801 `preloadable_libintl.so' is provided that can be used with the ELF
7802 `LD_PRELOAD' mechanism.
7804 So, in the first step, the translator uses these commands on systems
7807 $ LD_PRELOAD=/usr/local/lib/preloadable_libintl.so
7809 $ GETTEXT_LOG_UNTRANSLATED=$HOME/gettextlogused
7810 $ export GETTEXT_LOG_UNTRANSLATED
7812 and these commands on other systems:
7814 $ GETTEXT_LOG_UNTRANSLATED=$HOME/gettextlogused
7815 $ export GETTEXT_LOG_UNTRANSLATED
7817 Then she uses and peruses the programs. (It is a good and
7818 recommended practice to use the programs for which you provide
7819 translations: it gives you the needed context.) When done, she removes
7820 the environment variables:
7823 $ unset GETTEXT_LOG_UNTRANSLATED
7825 The second step starts with removing duplicates:
7827 $ msguniq $HOME/gettextlogused > missing.po
7829 The result is a PO file, but needs some preprocessing before the
7830 Emacs PO mode can be used with it. First, it is a multi-domain PO
7831 file, containing messages from many translation domains. Second, it
7832 lacks all translator comments and source references. Here is how to
7833 get a list of the affected translation domains:
7835 $ sed -n -e 's,^domain "\(.*\)"$,\1,p' < missing.po | sort | uniq
7837 Then the translator can handle the domains one by one. For
7838 simplicity, let's use environment variables to denote the language,
7839 domain and source package.
7841 $ lang=nl # your language
7842 $ domain=coreutils # the name of the domain to be handled
7843 $ package=/usr/src/gnu/coreutils-4.5.4 # the package where it comes from
7845 She takes the latest copy of `$lang.po' from the Translation Project,
7846 or from the package (in most cases, `$package/po/$lang.po'), or creates
7847 a fresh one if she's the first translator (see *Note Creating::). She
7848 then uses the following commands to mark the not urgent messages as
7849 "obsolete". (This doesn't mean that these messages - translated and
7850 untranslated ones - will go away. It simply means that Emacs PO mode
7851 will ignore them in the following editing session.)
7853 $ msggrep --domain=$domain missing.po | grep -v '^domain' \
7854 > $domain-missing.po
7855 $ msgattrib --set-obsolete --ignore-file $domain-missing.po $domain.$lang.po \
7856 > $domain.$lang-urgent.po
7858 The she translates `$domain.$lang-urgent.po' by use of Emacs PO mode.
7859 (FIXME: I don't know whether `KBabel' and `gtranslator' also preserve
7860 obsolete messages, as they should.) Finally she restores the not
7861 urgent messages (with their earlier translations, for those which were
7862 already translated) through this command:
7864 $ msgmerge --no-fuzzy-matching $domain.$lang-urgent.po $package/po/$domain.pot \
7867 Then she can submit `$domain.$lang.po' and proceed to the next
7871 File: gettext.info, Node: Maintainers, Next: Programming Languages, Prev: Translators, Up: Top
7873 12 The Maintainer's View
7874 ************************
7876 The maintainer of a package has many responsibilities. One of them is
7877 ensuring that the package will install easily on many platforms, and
7878 that the magic we described earlier (*note Users::) will work for
7879 installers and end users.
7881 Of course, there are many possible ways by which GNU `gettext' might
7882 be integrated in a distribution, and this chapter does not cover them
7883 in all generality. Instead, it details one possible approach which is
7884 especially adequate for many free software distributions following GNU
7885 standards, or even better, Gnits standards, because GNU `gettext' is
7886 purposely for helping the internationalization of the whole GNU
7887 project, and as many other good free packages as possible. So, the
7888 maintainer's view presented here presumes that the package already has
7889 a `configure.in' file and uses GNU Autoconf.
7891 Nevertheless, GNU `gettext' may surely be useful for free packages
7892 not following GNU standards and conventions, but the maintainers of such
7893 packages might have to show imagination and initiative in organizing
7894 their distributions so `gettext' work for them in all situations.
7895 There are surely many, out there.
7897 Even if `gettext' methods are now stabilizing, slight adjustments
7898 might be needed between successive `gettext' versions, so you should
7899 ideally revise this chapter in subsequent releases, looking for changes.
7903 * Flat and Non-Flat:: Flat or Non-Flat Directory Structures
7904 * Prerequisites:: Prerequisite Works
7905 * gettextize Invocation:: Invoking the `gettextize' Program
7906 * Adjusting Files:: Files You Must Create or Alter
7907 * autoconf macros:: Autoconf macros for use in `configure.in'
7908 * CVS Issues:: Integrating with CVS
7909 * Release Management:: Creating a Distribution Tarball
7912 File: gettext.info, Node: Flat and Non-Flat, Next: Prerequisites, Prev: Maintainers, Up: Maintainers
7914 12.1 Flat or Non-Flat Directory Structures
7915 ==========================================
7917 Some free software packages are distributed as `tar' files which unpack
7918 in a single directory, these are said to be "flat" distributions.
7919 Other free software packages have a one level hierarchy of
7920 subdirectories, using for example a subdirectory named `doc/' for the
7921 Texinfo manual and man pages, another called `lib/' for holding
7922 functions meant to replace or complement C libraries, and a
7923 subdirectory `src/' for holding the proper sources for the package.
7924 These other distributions are said to be "non-flat".
7926 We cannot say much about flat distributions. A flat directory
7927 structure has the disadvantage of increasing the difficulty of updating
7928 to a new version of GNU `gettext'. Also, if you have many PO files,
7929 this could somewhat pollute your single directory. Also, GNU
7930 `gettext''s libintl sources consist of C sources, shell scripts, `sed'
7931 scripts and complicated Makefile rules, which don't fit well into an
7932 existing flat structure. For these reasons, we recommend to use
7933 non-flat approach in this case as well.
7935 Maybe because GNU `gettext' itself has a non-flat structure, we have
7936 more experience with this approach, and this is what will be described
7937 in the remaining of this chapter. Some maintainers might use this as
7938 an opportunity to unflatten their package structure.
7941 File: gettext.info, Node: Prerequisites, Next: gettextize Invocation, Prev: Flat and Non-Flat, Up: Maintainers
7943 12.2 Prerequisite Works
7944 =======================
7946 There are some works which are required for using GNU `gettext' in one
7947 of your package. These works have some kind of generality that escape
7948 the point by point descriptions used in the remainder of this chapter.
7949 So, we describe them here.
7951 * Before attempting to use `gettextize' you should install some
7952 other packages first. Ensure that recent versions of GNU `m4',
7953 GNU Autoconf and GNU `gettext' are already installed at your site,
7954 and if not, proceed to do this first. If you get to install these
7955 things, beware that GNU `m4' must be fully installed before GNU
7956 Autoconf is even _configured_.
7958 To further ease the task of a package maintainer the `automake'
7959 package was designed and implemented. GNU `gettext' now uses this
7960 tool and the `Makefile's in the `intl/' and `po/' therefore know
7961 about all the goals necessary for using `automake' and `libintl'
7964 Those four packages are only needed by you, as a maintainer; the
7965 installers of your own package and end users do not really need
7966 any of GNU `m4', GNU Autoconf, GNU `gettext', or GNU `automake'
7967 for successfully installing and running your package, with messages
7968 properly translated. But this is not completely true if you
7969 provide internationalized shell scripts within your own package:
7970 GNU `gettext' shall then be installed at the user site if the end
7971 users want to see the translation of shell script messages.
7973 * Your package should use Autoconf and have a `configure.in' or
7974 `configure.ac' file. If it does not, you have to learn how. The
7975 Autoconf documentation is quite well written, it is a good idea
7976 that you print it and get familiar with it.
7978 * Your C sources should have already been modified according to
7979 instructions given earlier in this manual. *Note Sources::.
7981 * Your `po/' directory should receive all PO files submitted to you
7982 by the translator teams, each having `LL.po' as a name. This is
7983 not usually easy to get translation work done before your package
7984 gets internationalized and available! Since the cycle has to
7985 start somewhere, the easiest for the maintainer is to start with
7986 absolutely no PO files, and wait until various translator teams
7987 get interested in your package, and submit PO files.
7990 It is worth adding here a few words about how the maintainer should
7991 ideally behave with PO files submissions. As a maintainer, your role is
7992 to authenticate the origin of the submission as being the representative
7993 of the appropriate translating teams of the Translation Project (forward
7994 the submission to `translation@iro.umontreal.ca' in case of doubt), to
7995 ensure that the PO file format is not severely broken and does not
7996 prevent successful installation, and for the rest, to merely put these
7997 PO files in `po/' for distribution.
7999 As a maintainer, you do not have to take on your shoulders the
8000 responsibility of checking if the translations are adequate or
8001 complete, and should avoid diving into linguistic matters. Translation
8002 teams drive themselves and are fully responsible of their linguistic
8003 choices for the Translation Project. Keep in mind that translator
8004 teams are _not_ driven by maintainers. You can help by carefully
8005 redirecting all communications and reports from users about linguistic
8006 matters to the appropriate translation team, or explain users how to
8007 reach or join their team. The simplest might be to send them the
8010 Maintainers should _never ever_ apply PO file bug reports
8011 themselves, short-cutting translation teams. If some translator has
8012 difficulty to get some of her points through her team, it should not be
8013 an option for her to directly negotiate translations with maintainers.
8014 Teams ought to settle their problems themselves, if any. If you, as a
8015 maintainer, ever think there is a real problem with a team, please
8016 never try to _solve_ a team's problem on your own.
8019 File: gettext.info, Node: gettextize Invocation, Next: Adjusting Files, Prev: Prerequisites, Up: Maintainers
8021 12.3 Invoking the `gettextize' Program
8022 ======================================
8024 The `gettextize' program is an interactive tool that helps the
8025 maintainer of a package internationalized through GNU `gettext'. It is
8026 used for two purposes:
8028 * As a wizard, when a package is modified to use GNU `gettext' for
8031 * As a migration tool, for upgrading the GNU `gettext' support in a
8032 package from a previous to a newer version of GNU `gettext'.
8034 This program performs the following tasks:
8036 * It copies into the package some files that are consistently and
8037 identically needed in every package internationalized through GNU
8040 * It performs as many of the tasks mentioned in the next section
8041 *Note Adjusting Files:: as can be performed automatically.
8043 * It removes obsolete files and idioms used for previous GNU
8044 `gettext' versions to the form recommended for the current GNU
8047 * It prints a summary of the tasks that ought to be done manually
8048 and could not be done automatically by `gettextize'.
8050 It can be invoked as follows:
8052 gettextize [ OPTION... ] [ DIRECTORY ]
8054 and accepts the following options:
8058 Copy the needed files instead of making symbolic links. Using
8059 links would allow the package to always use the latest `gettext'
8060 code available on the system, but it might disturb some mechanism
8061 the maintainer is used to apply to the sources. Because running
8062 `gettextize' is easy there shouldn't be problems with using copies.
8066 Force replacement of files which already exist.
8069 Install the libintl sources in a subdirectory named `intl/'. This
8070 libintl will be used to provide internationalization on systems
8071 that don't have GNU libintl installed. If this option is omitted,
8072 the call to `AM_GNU_GETTEXT' in `configure.in' should read:
8073 `AM_GNU_GETTEXT([external])', and internationalization will not be
8074 enabled on systems lacking GNU gettext.
8077 Don't update or create ChangeLog files. By default, `gettextize'
8078 logs all changes (file additions, modifications and removals) in a
8079 file called `ChangeLog' in each affected directory.
8083 Print modifications but don't perform them. All actions that
8084 `gettextize' would normally execute are inhibited and instead only
8085 listed on standard output.
8088 Display this help and exit.
8091 Output version information and exit.
8094 If DIRECTORY is given, this is the top level directory of a package
8095 to prepare for using GNU `gettext'. If not given, it is assumed that
8096 the current directory is the top level directory of such a package.
8098 The program `gettextize' provides the following files. However, no
8099 existing file will be replaced unless the option `--force' (`-f') is
8102 1. The `ABOUT-NLS' file is copied in the main directory of your
8103 package, the one being at the top level. This file gives the main
8104 indications about how to install and use the Native Language
8105 Support features of your program. You might elect to use a more
8106 recent copy of this `ABOUT-NLS' file than the one provided through
8107 `gettextize', if you have one handy. You may also fetch a more
8108 recent copy of file `ABOUT-NLS' from Translation Project sites,
8109 and from most GNU archive sites.
8111 2. A `po/' directory is created for eventually holding all
8112 translation files, but initially only containing the file
8113 `po/Makefile.in.in' from the GNU `gettext' distribution (beware
8114 the double `.in' in the file name) and a few auxiliary files. If
8115 the `po/' directory already exists, it will be preserved along
8116 with the files it contains, and only `Makefile.in.in' and the
8117 auxiliary files will be overwritten.
8119 3. Only if `--intl' has been specified: A `intl/' directory is
8120 created and filled with most of the files originally in the
8121 `intl/' directory of the GNU `gettext' distribution. Also, if
8122 option `--force' (`-f') is given, the `intl/' directory is emptied
8125 4. The files `config.rpath' and `mkinstalldirs' are copied into the
8126 directory containing configuration support files. It is needed by
8127 the `AM_GNU_GETTEXT' autoconf macro.
8129 5. Only if the project is using GNU `automake': A set of `autoconf'
8130 macro files is copied into the package's `autoconf' macro
8131 repository, usually in a directory called `m4/'.
8133 If your site support symbolic links, `gettextize' will not actually
8134 copy the files into your package, but establish symbolic links instead.
8135 This avoids duplicating the disk space needed in all packages. Merely
8136 using the `-h' option while creating the `tar' archive of your
8137 distribution will resolve each link by an actual copy in the
8138 distribution archive. So, to insist, you really should use `-h' option
8139 with `tar' within your `dist' goal of your main `Makefile.in'.
8141 Furthermore, `gettextize' will update all `Makefile.am' files in
8142 each affected directory, as well as the top level `configure.in' or
8143 `configure.ac' file.
8145 It is interesting to understand that most new files for supporting
8146 GNU `gettext' facilities in one package go in `intl/', `po/' and `m4/'
8147 subdirectories. One distinction between `intl/' and the two other
8148 directories is that `intl/' is meant to be completely identical in all
8149 packages using GNU `gettext', while the other directories will mostly
8150 contain package dependent files.
8152 The `gettextize' program makes backup files for all files it
8153 replaces or changes, and also write ChangeLog entries about these
8154 changes. This way, the careful maintainer can check after running
8155 `gettextize' whether its changes are acceptable to him, and possibly
8156 adjust them. An exception to this rule is the `intl/' directory, which
8157 is added or replaced or removed as a whole.
8159 It is important to understand that `gettextize' can not do the
8160 entire job of adapting a package for using GNU `gettext'. The amount
8161 of remaining work depends on whether the package uses GNU `automake' or
8162 not. But in any case, the maintainer should still read the section
8163 *Note Adjusting Files:: after invoking `gettextize'.
8165 It is also important to understand that `gettextize' is not part of
8166 the GNU build system, in the sense that it should not be invoked
8167 automatically, and not be invoked by someone who doesn't assume the
8168 responsibilities of a package maintainer. For the latter purpose, a
8169 separate tool is provided, see *Note autopoint Invocation::.
8172 File: gettext.info, Node: Adjusting Files, Next: autoconf macros, Prev: gettextize Invocation, Up: Maintainers
8174 12.4 Files You Must Create or Alter
8175 ===================================
8177 Besides files which are automatically added through `gettextize', there
8178 are many files needing revision for properly interacting with GNU
8179 `gettext'. If you are closely following GNU standards for Makefile
8180 engineering and auto-configuration, the adaptations should be easier to
8181 achieve. Here is a point by point description of the changes needed in
8184 So, here comes a list of files, each one followed by a description of
8185 all alterations it needs. Many examples are taken out from the GNU
8186 `gettext' 0.14.4 distribution itself, or from the GNU `hello'
8187 distribution (`http://www.franken.de/users/gnu/ke/hello' or
8188 `http://www.gnu.franken.de/ke/hello/') You may indeed refer to the
8189 source code of the GNU `gettext' and GNU `hello' packages, as they are
8190 intended to be good examples for using GNU gettext functionality.
8194 * po/POTFILES.in:: `POTFILES.in' in `po/'
8195 * po/LINGUAS:: `LINGUAS' in `po/'
8196 * po/Makevars:: `Makevars' in `po/'
8197 * configure.in:: `configure.in' at top level
8198 * config.guess:: `config.guess', `config.sub' at top level
8199 * mkinstalldirs:: `mkinstalldirs' at top level
8200 * aclocal:: `aclocal.m4' at top level
8201 * acconfig:: `acconfig.h' at top level
8202 * config.h.in:: `config.h.in' at top level
8203 * Makefile:: `Makefile.in' at top level
8204 * src/Makefile:: `Makefile.in' in `src/'
8205 * lib/gettext.h:: `gettext.h' in `lib/'
8208 File: gettext.info, Node: po/POTFILES.in, Next: po/LINGUAS, Prev: Adjusting Files, Up: Adjusting Files
8210 12.4.1 `POTFILES.in' in `po/'
8211 -----------------------------
8213 The `po/' directory should receive a file named `POTFILES.in'. This
8214 file tells which files, among all program sources, have marked strings
8215 needing translation. Here is an example of such a file:
8217 # List of source files containing translatable strings.
8218 # Copyright (C) 1995 Free Software Foundation, Inc.
8220 # Common library files
8225 # Package source files
8230 Hash-marked comments and white lines are ignored. All other lines list
8231 those source files containing strings marked for translation (*note
8232 Mark Keywords::), in a notation relative to the top level of your whole
8233 distribution, rather than the location of the `POTFILES.in' file itself.
8235 When a C file is automatically generated by a tool, like `flex' or
8236 `bison', that doesn't introduce translatable strings by itself, it is
8237 recommended to list in `po/POTFILES.in' the real source file (ending in
8238 `.l' in the case of `flex', or in `.y' in the case of `bison'), not the
8242 File: gettext.info, Node: po/LINGUAS, Next: po/Makevars, Prev: po/POTFILES.in, Up: Adjusting Files
8244 12.4.2 `LINGUAS' in `po/'
8245 -------------------------
8247 The `po/' directory should also receive a file named `LINGUAS'. This
8248 file contains the list of available translations. It is a whitespace
8249 separated list. Hash-marked comments and white lines are ignored.
8250 Here is an example file:
8252 # Set of available languages.
8255 This example means that German and French PO files are available, so
8256 that these languages are currently supported by your package. If you
8257 want to further restrict, at installation time, the set of installed
8258 languages, this should not be done by modifying the `LINGUAS' file, but
8259 rather by using the `LINGUAS' environment variable (*note Installers::).
8261 It is recommended that you add the "languages" `en@quot' and
8262 `en@boldquot' to the `LINGUAS' file. `en@quot' is a variant of English
8263 message catalogs (`en') which uses real quotation marks instead of the
8264 ugly looking asymmetric ASCII substitutes ``' and `''. `en@boldquot'
8265 is a variant of `en@quot' that additionally outputs quoted pieces of
8266 text in a bold font, when used in a terminal emulator which supports
8267 the VT100 escape sequences (such as `xterm' or the Linux console, but
8268 not Emacs in `M-x shell' mode).
8270 These extra message catalogs `en@quot' and `en@boldquot' are
8271 constructed automatically, not by translators; to support them, you
8272 need the files `Rules-quot', `quot.sed', `boldquot.sed',
8273 `en@quot.header', `en@boldquot.header', `insert-header.sin' in the
8274 `po/' directory. You can copy them from GNU gettext's `po/' directory;
8275 they are also installed by running `gettextize'.
8278 File: gettext.info, Node: po/Makevars, Next: configure.in, Prev: po/LINGUAS, Up: Adjusting Files
8280 12.4.3 `Makevars' in `po/'
8281 --------------------------
8283 The `po/' directory also has a file named `Makevars'. It can be left
8284 unmodified if your package has a single message domain and,
8285 accordingly, a single `po/' directory. Only packages which have
8286 multiple `po/' directories at different locations need to adjust the
8287 three variables defined in `Makevars'.
8289 `po/Makevars' gets inserted into the `po/Makefile' when the latter
8290 is created. At the same time, all files called `Rules-*' in the `po/'
8291 directory get appended to the `po/Makefile'. They present an
8292 opportunity to add rules for special PO files to the Makefile, without
8293 needing to mess with `po/Makefile.in.in'.
8295 GNU gettext comes with a `Rules-quot' file, containing rules for
8296 building catalogs `en@quot.po' and `en@boldquot.po'. The effect of
8297 `en@quot.po' is that people who set their `LANGUAGE' environment
8298 variable to `en@quot' will get messages with proper looking symmetric
8299 Unicode quotation marks instead of abusing the ASCII grave accent and
8300 the ASCII apostrophe for indicating quotations. To enable this
8301 catalog, simply add `en@quot' to the `po/LINGUAS' file. The effect of
8302 `en@boldquot.po' is that people who set `LANGUAGE' to `en@boldquot'
8303 will get not only proper quotation marks, but also the quoted text will
8304 be shown in a bold font on terminals and consoles. This catalog is
8305 useful only for command-line programs, not GUI programs. To enable it,
8306 similarly add `en@boldquot' to the `po/LINGUAS' file.
8309 File: gettext.info, Node: configure.in, Next: config.guess, Prev: po/Makevars, Up: Adjusting Files
8311 12.4.4 `configure.in' at top level
8312 ----------------------------------
8314 `configure.in' or `configure.ac' - this is the source from which
8315 `autoconf' generates the `configure' script.
8317 1. Declare the package and version.
8319 This is done by a set of lines like these:
8323 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
8324 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
8328 or, if you are using GNU `automake', by a line like this:
8330 AM_INIT_AUTOMAKE(gettext, 0.14.4)
8332 Of course, you replace `gettext' with the name of your package,
8333 and `0.14.4' by its version numbers, exactly as they should appear
8334 in the packaged `tar' file name of your distribution
8335 (`gettext-0.14.4.tar.gz', here).
8337 2. Check for internationalization support.
8339 Here is the main `m4' macro for triggering internationalization
8340 support. Just add this line to `configure.in':
8344 This call is purposely simple, even if it generates a lot of
8345 configure time checking and actions.
8347 If you have suppressed the `intl/' subdirectory by calling
8348 `gettextize' without `--intl' option, this call should read
8350 AM_GNU_GETTEXT([external])
8352 3. Have output files created.
8354 The `AC_OUTPUT' directive, at the end of your `configure.in' file,
8355 needs to be modified in two ways:
8357 AC_OUTPUT([EXISTING CONFIGURATION FILES intl/Makefile po/Makefile.in],
8358 [EXISTING ADDITIONAL ACTIONS])
8360 The modification to the first argument to `AC_OUTPUT' asks for
8361 substitution in the `intl/' and `po/' directories. Note the `.in'
8362 suffix used for `po/' only. This is because the distributed file
8363 is really `po/Makefile.in.in'.
8365 If you have suppressed the `intl/' subdirectory by calling
8366 `gettextize' without `--intl' option, then you don't need to add
8367 `intl/Makefile' to the `AC_OUTPUT' line.
8371 File: gettext.info, Node: config.guess, Next: mkinstalldirs, Prev: configure.in, Up: Adjusting Files
8373 12.4.5 `config.guess', `config.sub' at top level
8374 ------------------------------------------------
8376 If you haven't suppressed the `intl/' subdirectory, you need to add the
8377 GNU `config.guess' and `config.sub' files to your distribution. They
8378 are needed because the `intl/' directory has platform dependent support
8379 for determining the locale's character encoding and therefore needs to
8380 identify the platform.
8382 You can obtain the newest version of `config.guess' and `config.sub'
8383 from the CVS of the `config' project at `http://savannah.gnu.org/'. The
8384 commands to fetch them are
8385 $ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess'
8386 $ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub'
8387 Less recent versions are also contained in the GNU `automake' and
8388 GNU `libtool' packages.
8390 Normally, `config.guess' and `config.sub' are put at the top level
8391 of a distribution. But it is also possible to put them in a
8392 subdirectory, altogether with other configuration support files like
8393 `install-sh', `ltconfig', `ltmain.sh', `mkinstalldirs' or `missing'.
8394 All you need to do, other than moving the files, is to add the
8395 following line to your `configure.in'.
8397 AC_CONFIG_AUX_DIR([SUBDIR])
8400 File: gettext.info, Node: mkinstalldirs, Next: aclocal, Prev: config.guess, Up: Adjusting Files
8402 12.4.6 `mkinstalldirs' at top level
8403 -----------------------------------
8405 If `gettextize' has not already done it, you need to add the GNU
8406 `mkinstalldirs' script to your distribution. It is needed because
8407 `mkdir -p' is not portable enough. You find this script in the GNU
8408 `automake' distribution.
8410 Normally, `mkinstalldirs' is put at the top level of a distribution.
8411 But it is also possible to put it in a subdirectory, altogether with
8412 other configuration support files like `install-sh', `ltconfig',
8413 `ltmain.sh' or `missing'. All you need to do, other than moving the
8414 files, is to add the following line to your `configure.in'.
8416 AC_CONFIG_AUX_DIR([SUBDIR])
8419 File: gettext.info, Node: aclocal, Next: acconfig, Prev: mkinstalldirs, Up: Adjusting Files
8421 12.4.7 `aclocal.m4' at top level
8422 --------------------------------
8424 If you do not have an `aclocal.m4' file in your distribution, the
8425 simplest is to concatenate the files `codeset.m4', `gettext.m4',
8426 `glibc2.m4', `glibc21.m4', `iconv.m4', `intdiv0.m4', `intmax.m4',
8427 `inttypes.m4', `inttypes_h.m4', `inttypes-pri.m4', `isc-posix.m4',
8428 `lcmessage.m4', `lib-ld.m4', `lib-link.m4', `lib-prefix.m4',
8429 `longdouble.m4', `longlong.m4', `printf-posix.m4', `progtest.m4',
8430 `signed.m4', `size_max.m4', `stdint_h.m4', `uintmax_t.m4',
8431 `ulonglong.m4', `wchar_t.m4', `wint_t.m4', `xsize.m4' from GNU
8432 `gettext''s `m4/' directory into a single file. If you have suppressed
8433 the `intl/' directory, only `gettext.m4', `iconv.m4', `lib-ld.m4',
8434 `lib-link.m4', `lib-prefix.m4', `progtest.m4' need to be concatenated.
8436 If you already have an `aclocal.m4' file, then you will have to
8437 merge the said macro files into your `aclocal.m4'. Note that if you
8438 are upgrading from a previous release of GNU `gettext', you should most
8439 probably _replace_ the macros (`AM_GNU_GETTEXT', etc.), as they usually
8440 change a little from one release of GNU `gettext' to the next. Their
8441 contents may vary as we get more experience with strange systems out
8444 If you are using GNU `automake' 1.5 or newer, it is enough to put
8445 these macro files into a subdirectory named `m4/' and add the line
8447 ACLOCAL_AMFLAGS = -I m4
8449 to your top level `Makefile.am'.
8451 These macros check for the internationalization support functions
8452 and related informations. Hopefully, once stabilized, these macros
8453 might be integrated in the standard Autoconf set, because this piece of
8454 `m4' code will be the same for all projects using GNU `gettext'.
8457 File: gettext.info, Node: acconfig, Next: config.h.in, Prev: aclocal, Up: Adjusting Files
8459 12.4.8 `acconfig.h' at top level
8460 --------------------------------
8462 Earlier GNU `gettext' releases required to put definitions for
8463 `ENABLE_NLS', `HAVE_GETTEXT' and `HAVE_LC_MESSAGES', `HAVE_STPCPY',
8464 `PACKAGE' and `VERSION' into an `acconfig.h' file. This is not needed
8465 any more; you can remove them from your `acconfig.h' file unless your
8466 package uses them independently from the `intl/' directory.
8469 File: gettext.info, Node: config.h.in, Next: Makefile, Prev: acconfig, Up: Adjusting Files
8471 12.4.9 `config.h.in' at top level
8472 ---------------------------------
8474 The include file template that holds the C macros to be defined by
8475 `configure' is usually called `config.h.in' and may be maintained
8476 either manually or automatically.
8478 If `gettextize' has created an `intl/' directory, this file must be
8479 called `config.h.in' and must be at the top level. If, however, you
8480 have suppressed the `intl/' directory by calling `gettextize' without
8481 `--intl' option, then you can choose the name of this file and its
8484 If it is maintained automatically, by use of the `autoheader'
8485 program, you need to do nothing about it. This is the case in
8486 particular if you are using GNU `automake'.
8488 If it is maintained manually, and if `gettextize' has created an
8489 `intl/' directory, you should switch to using `autoheader'. The list
8490 of C macros to be added for the sake of the `intl/' directory is just
8491 too long to be maintained manually; it also changes between different
8492 versions of GNU `gettext'.
8494 If it is maintained manually, and if on the other hand you have
8495 suppressed the `intl/' directory by calling `gettextize' without
8496 `--intl' option, then you can get away by adding the following lines to
8499 /* Define to 1 if translation of program messages to the user's
8500 native language is requested. */
8504 File: gettext.info, Node: Makefile, Next: src/Makefile, Prev: config.h.in, Up: Adjusting Files
8506 12.4.10 `Makefile.in' at top level
8507 ----------------------------------
8509 Here are a few modifications you need to make to your main, top-level
8512 1. Add the following lines near the beginning of your `Makefile.in',
8513 so the `dist:' goal will work properly (as explained further down):
8518 2. Add file `ABOUT-NLS' to the `DISTFILES' definition, so the file
8521 3. Wherever you process subdirectories in your `Makefile.in', be sure
8522 you also process the subdirectories `intl' and `po'. Special
8523 rules in the `Makefiles' take care for the case where no
8524 internationalization is wanted.
8526 If you are using Makefiles, either generated by automake, or
8527 hand-written so they carefully follow the GNU coding standards,
8528 the effected goals for which the new subdirectories must be
8529 handled include `installdirs', `install', `uninstall', `clean',
8532 Here is an example of a canonical order of processing. In this
8533 example, we also define `SUBDIRS' in `Makefile.in' for it to be
8534 further used in the `dist:' goal.
8536 SUBDIRS = doc intl lib src po
8538 Note that you must arrange for `make' to descend into the `intl'
8539 directory before descending into other directories containing code
8540 which make use of the `libintl.h' header file. For this reason,
8541 here we mention `intl' before `lib' and `src'.
8543 4. A delicate point is the `dist:' goal, as both `intl/Makefile' and
8544 `po/Makefile' will later assume that the proper directory has been
8545 set up from the main `Makefile'. Here is an example at what the
8546 `dist:' goal might look like:
8548 distdir = $(PACKAGE)-$(VERSION)
8552 chmod 777 $(distdir)
8553 for file in $(DISTFILES); do \
8554 ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir); \
8556 for subdir in $(SUBDIRS); do \
8557 mkdir $(distdir)/$$subdir || exit 1; \
8558 chmod 777 $(distdir)/$$subdir; \
8559 (cd $$subdir && $(MAKE) $@) || exit 1; \
8561 tar chozf $(distdir).tar.gz $(distdir)
8565 Note that if you are using GNU `automake', `Makefile.in' is
8566 automatically generated from `Makefile.am', and all needed changes to
8567 `Makefile.am' are already made by running `gettextize'.
8570 File: gettext.info, Node: src/Makefile, Next: lib/gettext.h, Prev: Makefile, Up: Adjusting Files
8572 12.4.11 `Makefile.in' in `src/'
8573 -------------------------------
8575 Some of the modifications made in the main `Makefile.in' will also be
8576 needed in the `Makefile.in' from your package sources, which we assume
8577 here to be in the `src/' subdirectory. Here are all the modifications
8578 needed in `src/Makefile.in':
8580 1. In view of the `dist:' goal, you should have these lines near the
8581 beginning of `src/Makefile.in':
8586 2. If not done already, you should guarantee that `top_srcdir' gets
8587 defined. This will serve for `cpp' include files. Just add the
8590 top_srcdir = @top_srcdir@
8592 3. You might also want to define `subdir' as `src', later allowing
8593 for almost uniform `dist:' goals in all your `Makefile.in'. At
8594 list, the `dist:' goal below assume that you used:
8598 4. The `main' function of your program will normally call
8599 `bindtextdomain' (see *note Triggering::), like this:
8601 bindtextdomain (PACKAGE, LOCALEDIR);
8602 textdomain (PACKAGE);
8604 To make LOCALEDIR known to the program, add the following lines to
8608 localedir = $(datadir)/locale
8609 DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
8611 Note that `@datadir@' defaults to `$(prefix)/share', thus
8612 `$(localedir)' defaults to `$(prefix)/share/locale'.
8614 5. You should ensure that the final linking will use `@LIBINTL@' or
8615 `@LTLIBINTL@' as a library. `@LIBINTL@' is for use without
8616 `libtool', `@LTLIBINTL@' is for use with `libtool'. An easy way
8617 to achieve this is to manage that it gets into `LIBS', like this:
8619 LIBS = @LIBINTL@ @LIBS@
8621 In most packages internationalized with GNU `gettext', one will
8622 find a directory `lib/' in which a library containing some helper
8623 functions will be build. (You need at least the few functions
8624 which the GNU `gettext' Library itself needs.) However some of
8625 the functions in the `lib/' also give messages to the user which
8626 of course should be translated, too. Taking care of this, the
8627 support library (say `libsupport.a') should be placed before
8628 `@LIBINTL@' and `@LIBS@' in the above example. So one has to
8631 LIBS = ../lib/libsupport.a @LIBINTL@ @LIBS@
8633 6. You should also ensure that directory `intl/' will be searched for
8634 C preprocessor include files in all circumstances. So, you have to
8635 manage so both `-I../intl' and `-I$(top_srcdir)/intl' will be
8636 given to the C compiler.
8638 7. Your `dist:' goal has to conform with others. Here is a
8639 reasonable definition for it:
8641 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
8642 dist: Makefile $(DISTFILES)
8643 for file in $(DISTFILES); do \
8644 ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir) || exit 1; \
8648 Note that if you are using GNU `automake', `Makefile.in' is
8649 automatically generated from `Makefile.am', and the first three changes
8650 and the last change are not necessary. The remaining needed
8651 `Makefile.am' modifications are the following:
8653 1. To make LOCALEDIR known to the program, add the following to
8656 <module>_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
8658 for each specific module or compilation unit, or
8660 AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
8662 for all modules and compilation units together. Furthermore, add
8663 this line to define `localedir':
8665 localedir = $(datadir)/locale
8667 2. To ensure that the final linking will use `@LIBINTL@' or
8668 `@LTLIBINTL@' as a library, add the following to `Makefile.am':
8670 <program>_LDADD = @LIBINTL@
8672 for each specific program, or
8676 for all programs together. Remember that when you use `libtool'
8677 to link a program, you need to use @LTLIBINTL@ instead of @LIBINTL@
8680 3. If you have an `intl/' directory, whose contents is created by
8681 `gettextize', then to ensure that it will be searched for C
8682 preprocessor include files in all circumstances, add something like
8683 this to `Makefile.am':
8685 AM_CPPFLAGS = -I../intl -I$(top_srcdir)/intl
8689 File: gettext.info, Node: lib/gettext.h, Prev: src/Makefile, Up: Adjusting Files
8691 12.4.12 `gettext.h' in `lib/'
8692 -----------------------------
8694 Internationalization of packages, as provided by GNU `gettext', is
8695 optional. It can be turned off in two situations:
8697 * When the installer has specified `./configure --disable-nls'. This
8698 can be useful when small binaries are more important than
8699 features, for example when building utilities for boot diskettes.
8700 It can also be useful in order to get some specific C compiler
8701 warnings about code quality with some older versions of GCC (older
8704 * When the package does not include the `intl/' subdirectory, and the
8705 libintl.h header (with its associated libintl library, if any) is
8706 not already installed on the system, it is preferrable that the
8707 package builds without internationalization support, rather than
8708 to give a compilation error.
8710 A C preprocessor macro can be used to detect these two cases.
8711 Usually, when `libintl.h' was found and not explicitly disabled, the
8712 `ENABLE_NLS' macro will be defined to 1 in the autoconf generated
8713 configuration file (usually called `config.h'). In the two negative
8714 situations, however, this macro will not be defined, thus it will
8715 evaluate to 0 in C preprocessor expressions.
8717 `gettext.h' is a convenience header file for conditional use of
8718 `<libintl.h>', depending on the `ENABLE_NLS' macro. If `ENABLE_NLS' is
8719 set, it includes `<libintl.h>'; otherwise it defines no-op substitutes
8720 for the libintl.h functions. We recommend the use of `"gettext.h"'
8721 over direct use of `<libintl.h>', so that portability to older systems
8722 is guaranteed and installers can turn off internationalization if they
8723 want to. In the C code, you will then write
8725 #include "gettext.h"
8729 #include <libintl.h>
8731 The location of `gettext.h' is usually in a directory containing
8732 auxiliary include files. In many GNU packages, there is a directory
8733 `lib/' containing helper functions; `gettext.h' fits there. In other
8734 packages, it can go into the `src' directory.
8736 Do not install the `gettext.h' file in public locations. Every
8737 package that needs it should contain a copy of it on its own.
8740 File: gettext.info, Node: autoconf macros, Next: CVS Issues, Prev: Adjusting Files, Up: Maintainers
8742 12.5 Autoconf macros for use in `configure.in'
8743 ==============================================
8745 GNU `gettext' installs macros for use in a package's `configure.in' or
8746 `configure.ac'. *Note Introduction: (autoconf)Top. The primary macro
8747 is, of course, `AM_GNU_GETTEXT'.
8751 * AM_GNU_GETTEXT:: AM_GNU_GETTEXT in `gettext.m4'
8752 * AM_GNU_GETTEXT_VERSION:: AM_GNU_GETTEXT_VERSION in `gettext.m4'
8753 * AM_PO_SUBDIRS:: AM_PO_SUBDIRS in `po.m4'
8754 * AM_ICONV:: AM_ICONV in `iconv.m4'
8757 File: gettext.info, Node: AM_GNU_GETTEXT, Next: AM_GNU_GETTEXT_VERSION, Prev: autoconf macros, Up: autoconf macros
8759 12.5.1 AM_GNU_GETTEXT in `gettext.m4'
8760 -------------------------------------
8762 The `AM_GNU_GETTEXT' macro tests for the presence of the GNU gettext
8763 function family in either the C library or a separate `libintl' library
8764 (shared or static libraries are both supported) or in the package's
8765 `intl/' directory. It also invokes `AM_PO_SUBDIRS', thus preparing the
8766 `po/' directories of the package for building.
8768 `AM_GNU_GETTEXT' accepts up to three optional arguments. The general
8771 AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR])
8773 INTLSYMBOL can be `external' or `no-libtool'. The default (if it is
8774 not specified or empty) is `no-libtool'. INTLSYMBOL should be
8775 `external' for packages with no `intl/' directory, and `no-libtool' for
8776 packages with an `intl/' directory. In the latter case, a static
8777 library `$(top_builddir)/intl/libintl.a' will be created.
8779 If NEEDSYMBOL is specified and is `need-ngettext', then GNU gettext
8780 implementations (in libc or libintl) without the `ngettext()' function
8781 will be ignored. If NEEDSYMBOL is specified and is
8782 `need-formatstring-macros', then GNU gettext implementations that don't
8783 support the ISO C 99 `<inttypes.h>' formatstring macros will be ignored.
8784 Only one NEEDSYMBOL can be specified. To specify more than one
8785 requirement, just specify the strongest one among them. The hierarchy
8786 among the various alternatives is as follows: `need-formatstring-macros'
8787 implies `need-ngettext'.
8789 INTLDIR is used to find the intl libraries. If empty, the value
8790 `$(top_builddir)/intl/' is used.
8792 The `AM_GNU_GETTEXT' macro determines whether GNU gettext is
8793 available and should be used. If so, it sets the `USE_NLS' variable to
8794 `yes'; it defines `ENABLE_NLS' to 1 in the autoconf generated
8795 configuration file (usually called `config.h'); it sets the variables
8796 `LIBINTL' and `LTLIBINTL' to the linker options for use in a Makefile
8797 (`LIBINTL' for use without libtool, `LTLIBINTL' for use with libtool);
8798 it adds an `-I' option to `CPPFLAGS' if necessary. In the negative
8799 case, it sets `USE_NLS' to `no'; it sets `LIBINTL' and `LTLIBINTL' to
8800 empty and doesn't change `CPPFLAGS'.
8802 The complexities that `AM_GNU_GETTEXT' deals with are the following:
8804 * Some operating systems have `gettext' in the C library, for example
8805 glibc. Some have it in a separate library `libintl'. GNU
8806 `libintl' might have been installed as part of the GNU `gettext'
8809 * GNU `libintl', if installed, is not necessarily already in the
8810 search path (`CPPFLAGS' for the include file search path,
8811 `LDFLAGS' for the library search path).
8813 * Except for glibc, the operating system's native `gettext' cannot
8814 exploit the GNU mo files, doesn't have the necessary locale
8815 dependency features, and cannot convert messages from the
8816 catalog's text encoding to the user's locale encoding.
8818 * GNU `libintl', if installed, is not necessarily already in the run
8819 time library search path. To avoid the need for setting an
8820 environment variable like `LD_LIBRARY_PATH', the macro adds the
8821 appropriate run time search path options to the `LIBINTL' and
8822 `LTLIBINTL' variables. This works on most systems, but not on
8823 some operating systems with limited shared library support, like
8826 * GNU `libintl' relies on POSIX/XSI `iconv'. The macro checks for
8827 linker options needed to use iconv and appends them to the
8828 `LIBINTL' and `LTLIBINTL' variables.
8831 File: gettext.info, Node: AM_GNU_GETTEXT_VERSION, Next: AM_PO_SUBDIRS, Prev: AM_GNU_GETTEXT, Up: autoconf macros
8833 12.5.2 AM_GNU_GETTEXT_VERSION in `gettext.m4'
8834 ---------------------------------------------
8836 The `AM_GNU_GETTEXT_VERSION' macro declares the version number of the
8837 GNU gettext infrastructure that is used by the package.
8839 The use of this macro is optional; only the `autopoint' program makes
8840 use of it (*note CVS Issues::).
8843 File: gettext.info, Node: AM_PO_SUBDIRS, Next: AM_ICONV, Prev: AM_GNU_GETTEXT_VERSION, Up: autoconf macros
8845 12.5.3 AM_PO_SUBDIRS in `po.m4'
8846 -------------------------------
8848 The `AM_PO_SUBDIRS' macro prepares the `po/' directories of the package
8849 for building. This macro should be used in internationalized programs
8850 written in other programming languages than C, C++, Objective C, for
8851 example `sh', `Python', `Lisp'. See *Note Programming Languages:: for
8852 a list of programming languages that support localization through PO
8855 The `AM_PO_SUBDIRS' macro determines whether internationalization
8856 should be used. If so, it sets the `USE_NLS' variable to `yes',
8857 otherwise to `no'. It also determines the right values for Makefile
8858 variables in each `po/' directory.
8861 File: gettext.info, Node: AM_ICONV, Prev: AM_PO_SUBDIRS, Up: autoconf macros
8863 12.5.4 AM_ICONV in `iconv.m4'
8864 -----------------------------
8866 The `AM_ICONV' macro tests for the presence of the POSIX/XSI `iconv'
8867 function family in either the C library or a separate `libiconv'
8868 library. If found, it sets the `am_cv_func_iconv' variable to `yes';
8869 it defines `HAVE_ICONV' to 1 in the autoconf generated configuration
8870 file (usually called `config.h'); it defines `ICONV_CONST' to `const'
8871 or to empty, depending on whether the second argument of `iconv()' is
8872 of type `const char **' or `char **'; it sets the variables `LIBICONV'
8873 and `LTLIBICONV' to the linker options for use in a Makefile
8874 (`LIBICONV' for use without libtool, `LTLIBICONV' for use with
8875 libtool); it adds an `-I' option to `CPPFLAGS' if necessary. If not
8876 found, it sets `LIBICONV' and `LTLIBICONV' to empty and doesn't change
8879 The complexities that `AM_ICONV' deals with are the following:
8881 * Some operating systems have `iconv' in the C library, for example
8882 glibc. Some have it in a separate library `libiconv', for example
8883 OSF/1 or FreeBSD. Regardless of the operating system, GNU
8884 `libiconv' might have been installed. In that case, it should be
8885 used instead of the operating system's native `iconv'.
8887 * GNU `libiconv', if installed, is not necessarily already in the
8888 search path (`CPPFLAGS' for the include file search path,
8889 `LDFLAGS' for the library search path).
8891 * GNU `libiconv' is binary incompatible with some operating system's
8892 native `iconv', for example on FreeBSD. Use of an `iconv.h' and
8893 `libiconv.so' that don't fit together would produce program
8896 * GNU `libiconv', if installed, is not necessarily already in the
8897 run time library search path. To avoid the need for setting an
8898 environment variable like `LD_LIBRARY_PATH', the macro adds the
8899 appropriate run time search path options to the `LIBICONV'
8900 variable. This works on most systems, but not on some operating
8901 systems with limited shared library support, like SCO.
8903 `iconv.m4' is distributed with the GNU gettext package because
8904 `gettext.m4' relies on it.
8907 File: gettext.info, Node: CVS Issues, Next: Release Management, Prev: autoconf macros, Up: Maintainers
8909 12.6 Integrating with CVS
8910 =========================
8912 Many projects use CVS for distributed development, version control and
8913 source backup. This section gives some advice how to manage the uses
8914 of `cvs', `gettextize', `autopoint' and `autoconf'.
8918 * Distributed CVS:: Avoiding version mismatch in distributed development
8919 * Files under CVS:: Files to put under CVS version control
8920 * autopoint Invocation:: Invoking the `autopoint' Program
8923 File: gettext.info, Node: Distributed CVS, Next: Files under CVS, Prev: CVS Issues, Up: CVS Issues
8925 12.6.1 Avoiding version mismatch in distributed development
8926 -----------------------------------------------------------
8928 In a project development with multiple developers, using CVS, there
8929 should be a single developer who occasionally - when there is desire to
8930 upgrade to a new `gettext' version - runs `gettextize' and performs the
8931 changes listed in *Note Adjusting Files::, and then commits his changes
8934 It is highly recommended that all developers on a project use the
8935 same version of GNU `gettext' in the package. In other words, if a
8936 developer runs `gettextize', he should go the whole way, make the
8937 necessary remaining changes and commit his changes to the CVS.
8938 Otherwise the following damages will likely occur:
8940 * Apparent version mismatch between developers. Since some `gettext'
8941 specific portions in `configure.in', `configure.ac' and
8942 `Makefile.am', `Makefile.in' files depend on the `gettext'
8943 version, the use of infrastructure files belonging to different
8944 `gettext' versions can easily lead to build errors.
8946 * Hidden version mismatch. Such version mismatch can also lead to
8947 malfunctioning of the package, that may be undiscovered by the
8948 developers. The worst case of hidden version mismatch is that
8949 internationalization of the package doesn't work at all.
8951 * Release risks. All developers implicitly perform constant testing
8952 on a package. This is important in the days and weeks before a
8953 release. If the guy who makes the release tar files uses a
8954 different version of GNU `gettext' than the other developers, the
8955 distribution will be less well tested than if all had been using
8956 the same `gettext' version. For example, it is possible that a
8957 platform specific bug goes undiscovered due to this constellation.
8960 File: gettext.info, Node: Files under CVS, Next: autopoint Invocation, Prev: Distributed CVS, Up: CVS Issues
8962 12.6.2 Files to put under CVS version control
8963 ---------------------------------------------
8965 There are basically three ways to deal with generated files in the
8966 context of a CVS repository, such as `configure' generated from
8967 `configure.in', `PARSER.c' generated from `PARSER.y', or
8968 `po/Makefile.in.in' autoinstalled by `gettextize' or `autopoint'.
8970 1. All generated files are always committed into the repository.
8972 2. All generated files are committed into the repository occasionally,
8973 for example each time a release is made.
8975 3. Generated files are never committed into the repository.
8977 Each of these three approaches has different advantages and
8980 1. The advantage is that anyone can check out the CVS at any moment
8981 and gets a working build. The drawbacks are: 1a. It requires
8982 some frequent "cvs commit" actions by the maintainers. 1b. The
8983 repository grows in size quite fast.
8985 2. The advantage is that anyone can check out the CVS, and the usual
8986 "./configure; make" will work. The drawbacks are: 2a. The one who
8987 checks out the repository needs tools like GNU `automake', GNU
8988 `autoconf', GNU `m4' installed in his PATH; sometimes he even
8989 needs particular versions of them. 2b. When a release is made and
8990 a commit is made on the generated files, the other developers get
8991 conflicts on the generated files after doing "cvs update".
8992 Although these conflicts are easy to resolve, they are annoying.
8994 3. The advantage is less work for the maintainers. The drawback is
8995 that anyone who checks out the CVS not only needs tools like GNU
8996 `automake', GNU `autoconf', GNU `m4' installed in his PATH, but
8997 also that he needs to perform a package specific pre-build step
8998 before being able to "./configure; make".
9000 For the first and second approach, all files modified or brought in
9001 by the occasional `gettextize' invocation and update should be
9002 committed into the CVS.
9004 For the third approach, the maintainer can omit from the CVS
9005 repository all the files that `gettextize' mentions as "copy".
9006 Instead, he adds to the `configure.in' or `configure.ac' a line of the
9009 AM_GNU_GETTEXT_VERSION(0.14.4)
9011 and adds to the package's pre-build script an invocation of
9012 `autopoint'. For everyone who checks out the CVS, this `autopoint'
9013 invocation will copy into the right place the `gettext' infrastructure
9014 files that have been omitted from the CVS.
9016 The version number used as argument to `AM_GNU_GETTEXT_VERSION' is
9017 the version of the `gettext' infrastructure that the package wants to
9018 use. It is also the minimum version number of the `autopoint' program.
9019 So, if you write `AM_GNU_GETTEXT_VERSION(0.11.5)' then the developers
9020 can have any version >= 0.11.5 installed; the package will work with
9021 the 0.11.5 infrastructure in all developers' builds. When the
9022 maintainer then runs gettextize from, say, version 0.12.1 on the
9023 package, the occurrence of `AM_GNU_GETTEXT_VERSION(0.11.5)' will be
9024 changed into `AM_GNU_GETTEXT_VERSION(0.12.1)', and all other developers
9025 that use the CVS will henceforth need to have GNU `gettext' 0.12.1 or
9029 File: gettext.info, Node: autopoint Invocation, Prev: Files under CVS, Up: CVS Issues
9031 12.6.3 Invoking the `autopoint' Program
9032 ---------------------------------------
9034 autopoint [OPTION]...
9036 The `autopoint' program copies standard gettext infrastructure files
9037 into a source package. It extracts from a macro call of the form
9038 `AM_GNU_GETTEXT_VERSION(VERSION)', found in the package's
9039 `configure.in' or `configure.ac' file, the gettext version used by the
9040 package, and copies the infrastructure files belonging to this version
9048 Force overwriting of files that already exist.
9052 Print modifications but don't perform them. All file copying
9053 actions that `autopoint' would normally execute are inhibited and
9054 instead only listed on standard output.
9057 12.6.3.2 Informative output
9058 ...........................
9061 Display this help and exit.
9064 Output version information and exit.
9067 `autopoint' supports the GNU `gettext' versions from 0.10.35 to the
9068 current one, 0.14.4. In order to apply `autopoint' to a package using
9069 a `gettext' version newer than 0.14.4, you need to install this same
9070 version of GNU `gettext' at least.
9072 In packages using GNU `automake', an invocation of `autopoint'
9073 should be followed by invocations of `aclocal' and then `autoconf' and
9074 `autoheader'. The reason is that `autopoint' installs some autoconf
9075 macro files, which are used by `aclocal' to create `aclocal.m4', and
9076 the latter is used by `autoconf' to create the package's `configure'
9077 script and by `autoheader' to create the package's `config.h.in'
9078 include file template.
9080 The name `autopoint' is an abbreviation of `auto-po-intl-m4'; the
9081 tool copies or updates mostly files in the `po', `intl', `m4'
9085 File: gettext.info, Node: Release Management, Prev: CVS Issues, Up: Maintainers
9087 12.7 Creating a Distribution Tarball
9088 ====================================
9090 In projects that use GNU `automake', the usual commands for creating a
9091 distribution tarball, `make dist' or `make distcheck', automatically
9092 update the PO files as needed.
9094 If GNU `automake' is not used, the maintainer needs to perform this
9095 update before making a release:
9098 $ (cd po; make update-po)
9102 File: gettext.info, Node: Programming Languages, Next: Conclusion, Prev: Maintainers, Up: Top
9104 13 Other Programming Languages
9105 ******************************
9107 While the presentation of `gettext' focuses mostly on C and implicitly
9108 applies to C++ as well, its scope is far broader than that: Many
9109 programming languages, scripting languages and other textual data like
9110 GUI resources or package descriptions can make use of the gettext
9115 * Language Implementors:: The Language Implementor's View
9116 * Programmers for other Languages:: The Programmer's View
9117 * Translators for other Languages:: The Translator's View
9118 * Maintainers for other Languages:: The Maintainer's View
9119 * List of Programming Languages:: Individual Programming Languages
9120 * List of Data Formats:: Internationalizable Data
9123 File: gettext.info, Node: Language Implementors, Next: Programmers for other Languages, Prev: Programming Languages, Up: Programming Languages
9125 13.1 The Language Implementor's View
9126 ====================================
9128 All programming and scripting languages that have the notion of strings
9129 are eligible to supporting `gettext'. Supporting `gettext' means the
9132 1. You should add to the language a syntax for translatable strings.
9133 In principle, a function call of `gettext' would do, but a
9134 shorthand syntax helps keeping the legibility of internationalized
9135 programs. For example, in C we use the syntax `_("string")', and
9136 in GNU awk we use the shorthand `_"string"'.
9138 2. You should arrange that evaluation of such a translatable string at
9139 runtime calls the `gettext' function, or performs equivalent
9142 3. Similarly, you should make the functions `ngettext', `dcgettext',
9143 `dcngettext' available from within the language. These functions
9144 are less often used, but are nevertheless necessary for particular
9145 purposes: `ngettext' for correct plural handling, and `dcgettext'
9146 and `dcngettext' for obeying other locale environment variables
9147 than `LC_MESSAGES', such as `LC_TIME' or `LC_MONETARY'. For these
9148 latter functions, you need to make the `LC_*' constants, available
9149 in the C header `<locale.h>', referenceable from within the
9150 language, usually either as enumeration values or as strings.
9152 4. You should allow the programmer to designate a message domain,
9153 either by making the `textdomain' function available from within
9154 the language, or by introducing a magic variable called
9155 `TEXTDOMAIN'. Similarly, you should allow the programmer to
9156 designate where to search for message catalogs, by providing
9157 access to the `bindtextdomain' function.
9159 5. You should either perform a `setlocale (LC_ALL, "")' call during
9160 the startup of your language runtime, or allow the programmer to
9161 do so. Remember that gettext will act as a no-op if the
9162 `LC_MESSAGES' and `LC_CTYPE' locale facets are not both set.
9164 6. A programmer should have a way to extract translatable strings
9165 from a program into a PO file. The GNU `xgettext' program is being
9166 extended to support very different programming languages. Please
9167 contact the GNU `gettext' maintainers to help them doing this. If
9168 the string extractor is best integrated into your language's
9169 parser, GNU `xgettext' can function as a front end to your string
9172 7. The language's library should have a string formatting facility
9173 where the arguments of a format string are denoted by a positional
9174 number or a name. This is needed because for some languages and
9175 some messages with more than one substitutable argument, the
9176 translation will need to output the substituted arguments in
9177 different order. *Note c-format Flag::.
9179 8. If the language has more than one implementation, and not all of
9180 the implementations use `gettext', but the programs should be
9181 portable across implementations, you should provide a no-i18n
9182 emulation, that makes the other implementations accept programs
9183 written for yours, without actually translating the strings.
9185 9. To help the programmer in the task of marking translatable strings,
9186 which is usually performed using the Emacs PO mode, you are
9187 welcome to contact the GNU `gettext' maintainers, so they can add
9188 support for your language to `po-mode.el'.
9190 On the implementation side, three approaches are possible, with
9191 different effects on portability and copyright:
9193 * You may integrate the GNU `gettext''s `intl/' directory in your
9194 package, as described in *Note Maintainers::. This allows you to
9195 have internationalization on all kinds of platforms. Note that
9196 when you then distribute your package, it legally falls under the
9197 GNU General Public License, and the GNU project will be glad about
9198 your contribution to the Free Software pool.
9200 * You may link against GNU `gettext' functions if they are found in
9201 the C library. For example, an autoconf test for `gettext()' and
9202 `ngettext()' will detect this situation. For the moment, this test
9203 will succeed on GNU systems and not on other platforms. No severe
9204 copyright restrictions apply.
9206 * You may emulate or reimplement the GNU `gettext' functionality.
9207 This has the advantage of full portability and no copyright
9208 restrictions, but also the drawback that you have to reimplement
9209 the GNU `gettext' features (such as the `LANGUAGE' environment
9210 variable, the locale aliases database, the automatic charset
9211 conversion, and plural handling).
9214 File: gettext.info, Node: Programmers for other Languages, Next: Translators for other Languages, Prev: Language Implementors, Up: Programming Languages
9216 13.2 The Programmer's View
9217 ==========================
9219 For the programmer, the general procedure is the same as for the C
9220 language. The Emacs PO mode supports other languages, and the GNU
9221 `xgettext' string extractor recognizes other languages based on the
9222 file extension or a command-line option. In some languages,
9223 `setlocale' is not needed because it is already performed by the
9224 underlying language runtime.
9227 File: gettext.info, Node: Translators for other Languages, Next: Maintainers for other Languages, Prev: Programmers for other Languages, Up: Programming Languages
9229 13.3 The Translator's View
9230 ==========================
9232 The translator works exactly as in the C language case. The only
9233 difference is that when translating format strings, she has to be aware
9234 of the language's particular syntax for positional arguments in format
9239 * c-format:: C Format Strings
9240 * objc-format:: Objective C Format Strings
9241 * sh-format:: Shell Format Strings
9242 * python-format:: Python Format Strings
9243 * lisp-format:: Lisp Format Strings
9244 * elisp-format:: Emacs Lisp Format Strings
9245 * librep-format:: librep Format Strings
9246 * scheme-format:: Scheme Format Strings
9247 * smalltalk-format:: Smalltalk Format Strings
9248 * java-format:: Java Format Strings
9249 * csharp-format:: C# Format Strings
9250 * awk-format:: awk Format Strings
9251 * object-pascal-format:: Object Pascal Format Strings
9252 * ycp-format:: YCP Format Strings
9253 * tcl-format:: Tcl Format Strings
9254 * perl-format:: Perl Format Strings
9255 * php-format:: PHP Format Strings
9256 * gcc-internal-format:: GCC internal Format Strings
9257 * qt-format:: Qt Format Strings
9260 File: gettext.info, Node: c-format, Next: objc-format, Prev: Translators for other Languages, Up: Translators for other Languages
9262 13.3.1 C Format Strings
9263 -----------------------
9265 C format strings are described in POSIX (IEEE P1003.1 2001), section
9267 `http://www.opengroup.org/onlinepubs/007904975/functions/fprintf.html'.
9268 See also the fprintf(3) manual page,
9269 `http://www.linuxvalley.it/encyclopedia/ldp/manpage/man3/printf.3.php',
9270 `http://informatik.fh-wuerzburg.de/student/i510/man/printf.html'.
9272 Although format strings with positions that reorder arguments, such
9275 "Only %2$d bytes free on '%1$s'."
9277 which is semantically equivalent to
9279 "'%s' has only %d bytes free."
9281 are a POSIX/XSI feature and not specified by ISO C 99, translators can
9282 rely on this reordering ability: On the few platforms where `printf()',
9283 `fprintf()' etc. don't support this feature natively, `libintl.a' or
9284 `libintl.so' provides replacement functions, and GNU `<libintl.h>'
9285 activates these replacement functions automatically.
9287 As a special feature for Farsi (Persian) and maybe Arabic,
9288 translators can insert an `I' flag into numeric format directives. For
9289 example, the translation of `"%d"' can be `"%Id"'. The effect of this
9290 flag, on systems with GNU `libc', is that in the output, the ASCII
9291 digits are replaced with the `outdigits' defined in the `LC_CTYPE'
9292 locale facet. On other systems, the `gettext' function removes this
9293 flag, so that it has no effect.
9295 Note that the programmer should _not_ put this flag into the
9296 untranslated string. (Putting the `I' format directive flag into an
9297 MSGID string would lead to undefined behaviour on platforms without
9298 glibc when NLS is disabled.)
9301 File: gettext.info, Node: objc-format, Next: sh-format, Prev: c-format, Up: Translators for other Languages
9303 13.3.2 Objective C Format Strings
9304 ---------------------------------
9306 Objective C format strings are like C format strings. They support an
9307 additional format directive: "$@", which when executed consumes an
9308 argument of type `Object *'.
9311 File: gettext.info, Node: sh-format, Next: python-format, Prev: objc-format, Up: Translators for other Languages
9313 13.3.3 Shell Format Strings
9314 ---------------------------
9316 Shell format strings, as supported by GNU gettext and the `envsubst'
9317 program, are strings with references to shell variables in the form
9318 `$VARIABLE' or `${VARIABLE}'. References of the form
9319 `${VARIABLE-DEFAULT}', `${VARIABLE:-DEFAULT}', `${VARIABLE=DEFAULT}',
9320 `${VARIABLE:=DEFAULT}', `${VARIABLE+REPLACEMENT}',
9321 `${VARIABLE:+REPLACEMENT}', `${VARIABLE?IGNORED}',
9322 `${VARIABLE:?IGNORED}', that would be valid inside shell scripts, are
9323 not supported. The VARIABLE names must consist solely of alphanumeric
9324 or underscore ASCII characters, not start with a digit and be nonempty;
9325 otherwise such a variable reference is ignored.
9328 File: gettext.info, Node: python-format, Next: lisp-format, Prev: sh-format, Up: Translators for other Languages
9330 13.3.4 Python Format Strings
9331 ----------------------------
9333 Python format strings are described in Python Library reference /
9334 2. Built-in Types, Exceptions and Functions / 2.2. Built-in Types /
9335 2.2.6. Sequence Types / 2.2.6.2. String Formatting Operations.
9336 `http://www.python.org/doc/2.2.1/lib/typesseq-strings.html'.
9339 File: gettext.info, Node: lisp-format, Next: elisp-format, Prev: python-format, Up: Translators for other Languages
9341 13.3.5 Lisp Format Strings
9342 --------------------------
9344 Lisp format strings are described in the Common Lisp HyperSpec, chapter
9345 22.3 Formatted Output,
9346 `http://www.lisp.org/HyperSpec/Body/sec_22-3.html'.
9349 File: gettext.info, Node: elisp-format, Next: librep-format, Prev: lisp-format, Up: Translators for other Languages
9351 13.3.6 Emacs Lisp Format Strings
9352 --------------------------------
9354 Emacs Lisp format strings are documented in the Emacs Lisp reference,
9355 section Formatting Strings,
9356 `http://www.gnu.org/manual/elisp-manual-21-2.8/html_chapter/elisp_4.html#SEC75'.
9357 Note that as of version 21, XEmacs supports numbered argument
9358 specifications in format strings while FSF Emacs doesn't.
9361 File: gettext.info, Node: librep-format, Next: scheme-format, Prev: elisp-format, Up: Translators for other Languages
9363 13.3.7 librep Format Strings
9364 ----------------------------
9366 librep format strings are documented in the librep manual, section
9368 `http://librep.sourceforge.net/librep-manual.html#Formatted%20Output',
9369 `http://www.gwinnup.org/research/docs/librep.html#SEC122'.
9372 File: gettext.info, Node: scheme-format, Next: smalltalk-format, Prev: librep-format, Up: Translators for other Languages
9374 13.3.8 Scheme Format Strings
9375 ----------------------------
9377 Scheme format strings are documented in the SLIB manual, section
9378 Format Specification.
9381 File: gettext.info, Node: smalltalk-format, Next: java-format, Prev: scheme-format, Up: Translators for other Languages
9383 13.3.9 Smalltalk Format Strings
9384 -------------------------------
9386 Smalltalk format strings are described in the GNU Smalltalk
9387 documentation, class `CharArray', methods `bindWith:' and
9388 `bindWithArguments:'.
9389 `http://www.gnu.org/software/smalltalk/gst-manual/gst_68.html#SEC238'.
9390 In summary, a directive starts with `%' and is followed by `%' or a
9391 nonzero digit (`1' to `9').
9394 File: gettext.info, Node: java-format, Next: csharp-format, Prev: smalltalk-format, Up: Translators for other Languages
9396 13.3.10 Java Format Strings
9397 ---------------------------
9399 Java format strings are described in the JDK documentation for class
9400 `java.text.MessageFormat',
9401 `http://java.sun.com/j2se/1.4/docs/api/java/text/MessageFormat.html'.
9402 See also the ICU documentation
9403 `http://oss.software.ibm.com/icu/apiref/classMessageFormat.html'.
9406 File: gettext.info, Node: csharp-format, Next: awk-format, Prev: java-format, Up: Translators for other Languages
9408 13.3.11 C# Format Strings
9409 -------------------------
9411 C# format strings are described in the .NET documentation for class
9412 `System.String' and in
9413 `http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpConFormattingOverview.asp'.
9416 File: gettext.info, Node: awk-format, Next: object-pascal-format, Prev: csharp-format, Up: Translators for other Languages
9418 13.3.12 awk Format Strings
9419 --------------------------
9421 awk format strings are described in the gawk documentation, section
9422 Printf, `http://www.gnu.org/manual/gawk/html_node/Printf.html#Printf'.
9425 File: gettext.info, Node: object-pascal-format, Next: ycp-format, Prev: awk-format, Up: Translators for other Languages
9427 13.3.13 Object Pascal Format Strings
9428 ------------------------------------
9430 Where is this documented?
9433 File: gettext.info, Node: ycp-format, Next: tcl-format, Prev: object-pascal-format, Up: Translators for other Languages
9435 13.3.14 YCP Format Strings
9436 --------------------------
9438 YCP sformat strings are described in the libycp documentation
9439 `file:/usr/share/doc/packages/libycp/YCP-builtins.html'. In summary, a
9440 directive starts with `%' and is followed by `%' or a nonzero digit
9444 File: gettext.info, Node: tcl-format, Next: perl-format, Prev: ycp-format, Up: Translators for other Languages
9446 13.3.15 Tcl Format Strings
9447 --------------------------
9449 Tcl format strings are described in the `format.n' manual page,
9450 `http://www.scriptics.com/man/tcl8.3/TclCmd/format.htm'.
9453 File: gettext.info, Node: perl-format, Next: php-format, Prev: tcl-format, Up: Translators for other Languages
9455 13.3.16 Perl Format Strings
9456 ---------------------------
9458 There are two kinds format strings in Perl: those acceptable to the
9459 Perl built-in function `printf', labelled as `perl-format', and those
9460 acceptable to the `libintl-perl' function `__x', labelled as
9461 `perl-brace-format'.
9463 Perl `printf' format strings are described in the `sprintf' section
9466 Perl brace format strings are described in the
9467 `Locale::TextDomain(3pm)' manual page of the CPAN package libintl-perl.
9468 In brief, Perl format uses placeholders put between braces (`{' and
9469 `}'). The placeholder must have the syntax of simple identifiers.
9472 File: gettext.info, Node: php-format, Next: gcc-internal-format, Prev: perl-format, Up: Translators for other Languages
9474 13.3.17 PHP Format Strings
9475 --------------------------
9477 PHP format strings are described in the documentation of the PHP
9478 function `sprintf', in `phpdoc/manual/function.sprintf.html' or
9479 `http://www.php.net/manual/en/function.sprintf.php'.
9482 File: gettext.info, Node: gcc-internal-format, Next: qt-format, Prev: php-format, Up: Translators for other Languages
9484 13.3.18 GCC internal Format Strings
9485 -----------------------------------
9487 These format strings are used inside the GCC sources. In such a format
9488 string, a directive starts with `%', is optionally followed by a size
9489 specifier `l', an optional flag `+', another optional flag `#', and is
9490 finished by a specifier: `%' denotes a literal percent sign, `c'
9491 denotes a character, `s' denotes a string, `i' and `d' denote an
9492 integer, `o', `u', `x' denote an unsigned integer, `.*s' denotes a
9493 string preceded by a width specification, `H' denotes a `location_t *'
9494 pointer, `D' denotes a general declaration, `F' denotes a function
9495 declaration, `T' denotes a type, `A' denotes a function argument, `C'
9496 denotes a tree code, `E' denotes an expression, `L' denotes a
9497 programming language, `O' denotes a binary operator, `P' denotes a
9498 function parameter, `Q' denotes an assignment operator, `V' denotes a
9499 const/volatile qualifier.
9502 File: gettext.info, Node: qt-format, Prev: gcc-internal-format, Up: Translators for other Languages
9504 13.3.19 Qt Format Strings
9505 -------------------------
9507 Qt format strings are described in the documentation of the QString
9508 class `file:/usr/lib/qt-3.0.5/doc/html/qstring.html'. In summary, a
9509 directive consists of a `%' followed by a digit. The same directive
9510 cannot occur more than once in a format string.
9513 File: gettext.info, Node: Maintainers for other Languages, Next: List of Programming Languages, Prev: Translators for other Languages, Up: Programming Languages
9515 13.4 The Maintainer's View
9516 ==========================
9518 For the maintainer, the general procedure differs from the C language
9521 * For those languages that don't use GNU gettext, the `intl/'
9522 directory is not needed and can be omitted. This means that the
9523 maintainer calls the `gettextize' program without the `--intl'
9524 option, and that he invokes the `AM_GNU_GETTEXT' autoconf macro via
9525 `AM_GNU_GETTEXT([external])'.
9527 * If only a single programming language is used, the
9528 `XGETTEXT_OPTIONS' variable in `po/Makevars' (*note po/Makevars::)
9529 should be adjusted to match the `xgettext' options for that
9530 particular programming language. If the package uses more than
9531 one programming language with `gettext' support, it becomes
9532 necessary to change the POT file construction rule in
9533 `po/Makefile.in.in'. It is recommended to make one `xgettext'
9534 invocation per programming language, each with the options
9535 appropriate for that language, and to combine the resulting files
9539 File: gettext.info, Node: List of Programming Languages, Next: List of Data Formats, Prev: Maintainers for other Languages, Up: Programming Languages
9541 13.5 Individual Programming Languages
9542 =====================================
9546 * C:: C, C++, Objective C
9547 * sh:: sh - Shell Script
9548 * bash:: bash - Bourne-Again Shell Script
9550 * Common Lisp:: GNU clisp - Common Lisp
9551 * clisp C:: GNU clisp C sources
9552 * Emacs Lisp:: Emacs Lisp
9554 * Scheme:: GNU guile - Scheme
9555 * Smalltalk:: GNU Smalltalk
9559 * Pascal:: Pascal - Free Pascal Compiler
9560 * wxWindows:: wxWindows library
9561 * YCP:: YCP - YaST2 scripting language
9562 * Tcl:: Tcl - Tk's scripting language
9564 * PHP:: PHP Hypertext Preprocessor
9566 * GCC-source:: GNU Compiler Collection sources
9569 File: gettext.info, Node: C, Next: sh, Prev: List of Programming Languages, Up: List of Programming Languages
9571 13.5.1 C, C++, Objective C
9572 --------------------------
9575 gcc, gpp, gobjc, glibc, gettext
9579 For C++: `C', `c++', `cc', `cxx', `cpp', `hpp'.
9580 For Objective C: `m'.
9588 gettext/ngettext functions
9589 `gettext', `dgettext', `dcgettext', `ngettext', `dngettext',
9593 `textdomain' function
9596 `bindtextdomain' function
9599 Programmer must call `setlocale (LC_ALL, "")'
9602 `#include <libintl.h>'
9603 `#include <locale.h>'
9604 `#define _(string) gettext (string)'
9606 Use or emulate GNU gettext
9612 Formatting with positions
9613 `fprintf "%2$d %1$d"'
9614 In C++: `autosprintf "%2$d %1$d"' (*note Introduction:
9618 autoconf (gettext.m4) and #if ENABLE_NLS
9623 The following examples are available in the `examples' directory:
9624 `hello-c', `hello-c-gnome', `hello-c++', `hello-c++-qt',
9625 `hello-c++-kde', `hello-c++-gnome', `hello-objc', `hello-objc-gnustep',
9629 File: gettext.info, Node: sh, Next: bash, Prev: C, Up: List of Programming Languages
9631 13.5.2 sh - Shell Script
9632 ------------------------
9641 `"abc"', `'abc'', `abc'
9644 `"`gettext \"abc\"`"'
9646 gettext/ngettext functions
9647 `gettext', `ngettext' programs
9648 `eval_gettext', `eval_ngettext' shell functions
9651 environment variable `TEXTDOMAIN'
9654 environment variable `TEXTDOMAINDIR'
9662 Use or emulate GNU gettext
9668 Formatting with positions
9677 An example is available in the `examples' directory: `hello-sh'.
9681 * Preparing Shell Scripts:: Preparing Shell Scripts for Internationalization
9682 * gettext.sh:: Contents of `gettext.sh'
9683 * gettext Invocation:: Invoking the `gettext' program
9684 * ngettext Invocation:: Invoking the `ngettext' program
9685 * envsubst Invocation:: Invoking the `envsubst' program
9686 * eval_gettext Invocation:: Invoking the `eval_gettext' function
9687 * eval_ngettext Invocation:: Invoking the `eval_ngettext' function
9690 File: gettext.info, Node: Preparing Shell Scripts, Next: gettext.sh, Prev: sh, Up: sh
9692 13.5.2.1 Preparing Shell Scripts for Internationalization
9693 .........................................................
9695 Preparing a shell script for internationalization is conceptually
9696 similar to the steps described in *Note Sources::. The concrete steps
9697 for shell scripts are as follows.
9703 near the top of the script. `gettext.sh' is a shell function
9704 library that provides the functions `eval_gettext' (see *Note
9705 eval_gettext Invocation::) and `eval_ngettext' (see *Note
9706 eval_ngettext Invocation::). You have to ensure that `gettext.sh'
9707 can be found in the `PATH'.
9709 2. Set and export the `TEXTDOMAIN' and `TEXTDOMAINDIR' environment
9710 variables. Usually `TEXTDOMAIN' is the package or program name,
9711 and `TEXTDOMAINDIR' is the absolute pathname corresponding to
9712 `$prefix/share/locale', where `$prefix' is the installation
9715 TEXTDOMAIN=@PACKAGE@
9717 TEXTDOMAINDIR=@LOCALEDIR@
9718 export TEXTDOMAINDIR
9720 3. Prepare the strings for translation, as described in *Note
9721 Preparing Strings::.
9723 4. Simplify translatable strings so that they don't contain command
9724 substitution (`"`...`"' or `"$(...)"'), variable access with
9725 defaulting (like `${VARIABLE-DEFAULT}'), access to positional
9726 arguments (like `$0', `$1', ...) or highly volatile shell
9727 variables (like `$?'). This can always be done through simple
9728 local code restructuring. For example,
9730 echo "Usage: $0 [OPTION] FILE..."
9735 echo "Usage: $program_name [OPTION] FILE..."
9739 echo "Remaining files: `ls | wc -l`"
9743 filecount="`ls | wc -l`"
9744 echo "Remaining files: $filecount"
9746 5. For each translatable string, change the output command `echo' or
9747 `$echo' to `gettext' (if the string contains no references to
9748 shell variables) or to `eval_gettext' (if it refers to shell
9749 variables), followed by a no-argument `echo' command (to account
9750 for the terminating newline). Similarly, for cases with plural
9751 handling, replace a conditional `echo' command with an invocation
9752 of `ngettext' or `eval_ngettext', followed by a no-argument `echo'
9755 When doing this, you also need to add an extra backslash before
9756 the dollar sign in references to shell variables, so that the
9757 `eval_gettext' function receives the translatable string before
9758 the variable values are substituted into it. For example,
9760 echo "Remaining files: $filecount"
9764 eval_gettext "Remaining files: \$filecount"; echo
9766 If the output command is not `echo', you can make it use `echo'
9767 nevertheless, through the use of backquotes. However, note that
9768 inside backquotes, backslashes must be doubled to be effective
9769 (because the backquoting eats one level of backslashes). For
9770 example, assuming that `error' is a shell function that signals an
9773 error "file not found: $filename"
9775 is first transformed into
9777 error "`echo \"file not found: \$filename\"`"
9781 error "`eval_gettext \"file not found: \\\$filename\"`"
9784 File: gettext.info, Node: gettext.sh, Next: gettext Invocation, Prev: Preparing Shell Scripts, Up: sh
9786 13.5.2.2 Contents of `gettext.sh'
9787 .................................
9789 `gettext.sh', contained in the run-time package of GNU gettext, provides
9792 * $echo The variable `echo' is set to a command that outputs its
9793 first argument and a newline, without interpreting backslashes in
9794 the argument string.
9796 * eval_gettext See *Note eval_gettext Invocation::.
9798 * eval_ngettext See *Note eval_ngettext Invocation::.
9801 File: gettext.info, Node: gettext Invocation, Next: ngettext Invocation, Prev: gettext.sh, Up: sh
9803 13.5.2.3 Invoking the `gettext' program
9804 .......................................
9806 gettext [OPTION] [[TEXTDOMAIN] MSGID]
9807 gettext [OPTION] -s [MSGID]...
9809 The `gettext' program displays the native language translation of a
9815 `--domain=TEXTDOMAIN'
9816 Retrieve translated messages from TEXTDOMAIN. Usually a TEXTDOMAIN
9817 corresponds to a package, a program, or a module of a program.
9820 Enable expansion of some escape sequences. This option is for
9821 compatibility with the `echo' program or shell built-in. The
9822 escape sequences `\a', `\b', `\c', `\f', `\n', `\r', `\t', `\v',
9823 `\\', and `\' followed by one to three octal digits, are
9824 interpreted like the SystemV `echo' program does.
9827 This option is only for compatibility with the `echo' program or
9828 shell built-in. It has no effect.
9832 Display this help and exit.
9835 Suppress trailing newline. By default, `gettext' adds a newline to
9840 Output version information and exit.
9842 `[TEXTDOMAIN] MSGID'
9843 Retrieve translated message corresponding to MSGID from TEXTDOMAIN.
9846 If the TEXTDOMAIN parameter is not given, the domain is determined
9847 from the environment variable `TEXTDOMAIN'. If the message catalog is
9848 not found in the regular directory, another location can be specified
9849 with the environment variable `TEXTDOMAINDIR'.
9851 When used with the `-s' option the program behaves like the `echo'
9852 command. But it does not simply copy its arguments to stdout. Instead
9853 those messages found in the selected catalog are translated.
9856 File: gettext.info, Node: ngettext Invocation, Next: envsubst Invocation, Prev: gettext Invocation, Up: sh
9858 13.5.2.4 Invoking the `ngettext' program
9859 ........................................
9861 ngettext [OPTION] [TEXTDOMAIN] MSGID MSGID-PLURAL COUNT
9863 The `ngettext' program displays the native language translation of a
9864 textual message whose grammatical form depends on a number.
9869 `--domain=TEXTDOMAIN'
9870 Retrieve translated messages from TEXTDOMAIN. Usually a TEXTDOMAIN
9871 corresponds to a package, a program, or a module of a program.
9874 Enable expansion of some escape sequences. This option is for
9875 compatibility with the `gettext' program. The escape sequences
9876 `\a', `\b', `\c', `\f', `\n', `\r', `\t', `\v', `\\', and `\'
9877 followed by one to three octal digits, are interpreted like the
9878 SystemV `echo' program does.
9881 This option is only for compatibility with the `gettext' program.
9886 Display this help and exit.
9890 Output version information and exit.
9893 Retrieve translated message from TEXTDOMAIN.
9895 `MSGID MSGID-PLURAL'
9896 Translate MSGID (English singular) / MSGID-PLURAL (English plural).
9899 Choose singular/plural form based on this value.
9902 If the TEXTDOMAIN parameter is not given, the domain is determined
9903 from the environment variable `TEXTDOMAIN'. If the message catalog is
9904 not found in the regular directory, another location can be specified
9905 with the environment variable `TEXTDOMAINDIR'.
9908 File: gettext.info, Node: envsubst Invocation, Next: eval_gettext Invocation, Prev: ngettext Invocation, Up: sh
9910 13.5.2.5 Invoking the `envsubst' program
9911 ........................................
9913 envsubst [OPTION] [SHELL-FORMAT]
9915 The `envsubst' program substitutes the values of environment
9922 Output the variables occurring in SHELL-FORMAT.
9925 *Informative output*
9929 Display this help and exit.
9933 Output version information and exit.
9936 In normal operation mode, standard input is copied to standard
9937 output, with references to environment variables of the form
9938 `$VARIABLE' or `${VARIABLE}' being replaced with the corresponding
9939 values. If a SHELL-FORMAT is given, only those environment variables
9940 that are referenced in SHELL-FORMAT are substituted; otherwise all
9941 environment variables references occurring in standard input are
9944 These substitutions are a subset of the substitutions that a shell
9945 performs on unquoted and double-quoted strings. Other kinds of
9946 substitutions done by a shell, such as `${VARIABLE-DEFAULT}' or
9947 `$(COMMAND-LIST)' or ``COMMAND-LIST`', are not performed by the
9948 `envsubst' program, due to security reasons.
9950 When `--variables' is used, standard input is ignored, and the output
9951 consists of the environment variables that are referenced in
9952 SHELL-FORMAT, one per line.
9955 File: gettext.info, Node: eval_gettext Invocation, Next: eval_ngettext Invocation, Prev: envsubst Invocation, Up: sh
9957 13.5.2.6 Invoking the `eval_gettext' function
9958 .............................................
9962 This function outputs the native language translation of a textual
9963 message, performing dollar-substitution on the result. Note that only
9964 shell variables mentioned in MSGID will be dollar-substituted in the
9968 File: gettext.info, Node: eval_ngettext Invocation, Prev: eval_gettext Invocation, Up: sh
9970 13.5.2.7 Invoking the `eval_ngettext' function
9971 ..............................................
9973 eval_ngettext MSGID MSGID-PLURAL COUNT
9975 This function outputs the native language translation of a textual
9976 message whose grammatical form depends on a number, performing
9977 dollar-substitution on the result. Note that only shell variables
9978 mentioned in MSGID or MSGID-PLURAL will be dollar-substituted in the
9982 File: gettext.info, Node: bash, Next: Python, Prev: sh, Up: List of Programming Languages
9984 13.5.3 bash - Bourne-Again Shell Script
9985 ---------------------------------------
9987 GNU `bash' 2.0 or newer has a special shorthand for translating a
9988 string and substituting variable values in it: `$"msgid"'. But the use
9989 of this construct is *discouraged*, due to the security holes it opens
9990 and due to its portability problems.
9992 The security holes of `$"..."' come from the fact that after looking
9993 up the translation of the string, `bash' processes it like it processes
9994 any double-quoted string: dollar and backquote processing, like `eval'
9997 1. In a locale whose encoding is one of BIG5, BIG5-HKSCS, GBK,
9998 GB18030, SHIFT_JIS, JOHAB, some double-byte characters have a
9999 second byte whose value is `0x60'. For example, the byte sequence
10000 `\xe0\x60' is a single character in these locales. Many versions
10001 of `bash' (all versions up to bash-2.05, and newer versions on
10002 platforms without `mbsrtowcs()' function) don't know about
10003 character boundaries and see a backquote character where there is
10004 only a particular Chinese character. Thus it can start executing
10005 part of the translation as a command list. This situation can
10006 occur even without the translator being aware of it: if the
10007 translator provides translations in the UTF-8 encoding, it is the
10008 `gettext()' function which will, during its conversion from the
10009 translator's encoding to the user's locale's encoding, produce the
10010 dangerous `\x60' bytes.
10012 2. A translator could - voluntarily or inadvertantly - use backquotes
10013 `"`...`"' or dollar-parentheses `"$(...)"' in her translations.
10014 The enclosed strings would be executed as command lists by the
10017 The portability problem is that `bash' must be built with
10018 internationalization support; this is normally not the case on systems
10019 that don't have the `gettext()' function in libc.
10022 File: gettext.info, Node: Python, Next: Common Lisp, Prev: bash, Up: List of Programming Languages
10034 `'abc'', `u'abc'', `r'abc'', `ur'abc'',
10035 `"abc"', `u"abc"', `r"abc"', `ur"abc"',
10036 `'''abc'''', `u'''abc'''', `r'''abc'''', `ur'''abc'''',
10037 `"""abc"""', `u"""abc"""', `r"""abc"""', `ur"""abc"""'
10042 gettext/ngettext functions
10043 `gettext.gettext', `gettext.dgettext', `gettext.ngettext',
10044 `gettext.dngettext', also `ugettext', `ungettext'
10047 `gettext.textdomain' function, or `gettext.install(DOMAIN)'
10051 `gettext.bindtextdomain' function, or
10052 `gettext.install(DOMAIN,LOCALEDIR)' function
10055 not used by the gettext emulation
10060 Use or emulate GNU gettext
10066 Formatting with positions
10067 `'...%(ident)d...' % { 'ident': value }'
10075 An example is available in the `examples' directory: `hello-python'.
10078 File: gettext.info, Node: Common Lisp, Next: clisp C, Prev: Python, Up: List of Programming Languages
10080 13.5.5 GNU clisp - Common Lisp
10081 ------------------------------
10084 clisp 2.28 or newer
10093 `(_ "abc")', `(ENGLISH "abc")'
10095 gettext/ngettext functions
10096 `i18n:gettext', `i18n:ngettext'
10102 `i18n:textdomaindir'
10110 Use or emulate GNU gettext
10114 `xgettext -k_ -kENGLISH'
10116 Formatting with positions
10117 `format "~1@*~D ~0@*~D"'
10120 On platforms without gettext, no translation.
10125 An example is available in the `examples' directory: `hello-clisp'.
10128 File: gettext.info, Node: clisp C, Next: Emacs Lisp, Prev: Common Lisp, Up: List of Programming Languages
10130 13.5.6 GNU clisp C sources
10131 --------------------------
10143 `ENGLISH ? "abc" : ""'
10147 gettext/ngettext functions
10148 `clgettext', `clgettextl'
10160 `#include "lispbibl.c"'
10162 Use or emulate GNU gettext
10168 Formatting with positions
10169 `fprintf "%2$d %1$d"'
10172 On platforms without gettext, no translation.
10178 File: gettext.info, Node: Emacs Lisp, Next: librep, Prev: clisp C, Up: List of Programming Languages
10195 gettext/ngettext functions
10196 `gettext', `dgettext' (xemacs only)
10199 `domain' special form (xemacs only)
10202 `bind-text-domain' function (xemacs only)
10210 Use or emulate GNU gettext
10216 Formatting with positions
10217 `format "%2$d %1$d"'
10220 Only XEmacs. Without `I18N3' defined at build time, no
10227 File: gettext.info, Node: librep, Next: Scheme, Prev: Emacs Lisp, Up: List of Programming Languages
10233 librep 0.15.3 or newer
10244 gettext/ngettext functions
10248 `textdomain' function
10251 `bindtextdomain' function
10257 `(require 'rep.i18n.gettext)'
10259 Use or emulate GNU gettext
10265 Formatting with positions
10266 `format "%2$d %1$d"'
10269 On platforms without gettext, no translation.
10274 An example is available in the `examples' directory: `hello-librep'.
10277 File: gettext.info, Node: Scheme, Next: Smalltalk, Prev: librep, Up: List of Programming Languages
10279 13.5.9 GNU guile - Scheme
10280 -------------------------
10294 gettext/ngettext functions
10295 `gettext', `ngettext'
10304 `(catch #t (lambda () (setlocale LC_ALL "")) (lambda args #f))'
10307 `(use-modules (ice-9 format))'
10309 Use or emulate GNU gettext
10315 Formatting with positions
10319 On platforms without gettext, no translation.
10324 An example is available in the `examples' directory: `hello-guile'.
10327 File: gettext.info, Node: Smalltalk, Next: Java, Prev: Scheme, Up: List of Programming Languages
10329 13.5.10 GNU Smalltalk
10330 ---------------------
10344 gettext/ngettext functions
10345 `LcMessagesDomain>>#at:', `LcMessagesDomain>>#at:plural:with:'
10348 `LcMessages>>#domain:localeDirectory:' (returns a
10349 `LcMessagesDomain' object).
10350 Example: `I18N Locale default messages domain: 'gettext'
10351 localeDirectory: /usr/local/share/locale''
10354 `LcMessages>>#domain:localeDirectory:', see above.
10357 Automatic if you use `I18N Locale default'.
10360 `PackageLoader fileInPackage: 'I18N'!'
10362 Use or emulate GNU gettext
10368 Formatting with positions
10369 `'%1 %2' bindWith: 'Hello' with: 'world''
10377 An example is available in the `examples' directory:
10381 File: gettext.info, Node: Java, Next: C#, Prev: Smalltalk, Up: List of Programming Languages
10398 gettext/ngettext functions
10399 `GettextResource.gettext', `GettextResource.ngettext'
10402 --, use `ResourceBundle.getResource' instead
10405 --, use CLASSPATH instead
10413 Use or emulate GNU gettext
10414 --, uses a Java specific message catalog format
10419 Formatting with positions
10420 `MessageFormat.format "{1,number} {0,number}"'
10428 Before marking strings as internationalizable, uses of the string
10429 concatenation operator need to be converted to `MessageFormat'
10430 applications. For example, `"file "+filename+" not found"' becomes
10431 `MessageFormat.format("file {0} not found", new Object[] { filename })'.
10432 Only after this is done, can the strings be marked and extracted.
10434 GNU gettext uses the native Java internationalization mechanism,
10435 namely `ResourceBundle's. There are two formats of `ResourceBundle's:
10436 `.properties' files and `.class' files. The `.properties' format is a
10437 text file which the translators can directly edit, like PO files, but
10438 which doesn't support plural forms. Whereas the `.class' format is
10439 compiled from `.java' source code and can support plural forms
10440 (provided it is accessed through an appropriate API, see below).
10442 To convert a PO file to a `.properties' file, the `msgcat' program
10443 can be used with the option `--properties-output'. To convert a
10444 `.properties' file back to a PO file, the `msgcat' program can be used
10445 with the option `--properties-input'. All the tools that manipulate PO
10446 files can work with `.properties' files as well, if given the
10447 `--properties-input' and/or `--properties-output' option.
10449 To convert a PO file to a ResourceBundle class, the `msgfmt' program
10450 can be used with the option `--java' or `--java2'. To convert a
10451 ResourceBundle back to a PO file, the `msgunfmt' program can be used
10452 with the option `--java'.
10454 Two different programmatic APIs can be used to access
10455 ResourceBundles. Note that both APIs work with all kinds of
10456 ResourceBundles, whether GNU gettext generated classes, or other
10457 `.class' or `.properties' files.
10459 1. The `java.util.ResourceBundle' API.
10461 In particular, its `getString' function returns a string
10462 translation. Note that a missing translation yields a
10463 `MissingResourceException'.
10465 This has the advantage of being the standard API. And it does not
10466 require any additional libraries, only the `msgcat' generated
10467 `.properties' files or the `msgfmt' generated `.class' files. But
10468 it cannot do plural handling, even if the resource was generated
10469 by `msgfmt' from a PO file with plural handling.
10471 2. The `gnu.gettext.GettextResource' API.
10473 Reference documentation in Javadoc 1.1 style format is in the
10474 javadoc1 directory (javadoc1/tree.html) and in Javadoc 2 style
10475 format in the javadoc2 directory (javadoc2/index.html).
10477 Its `gettext' function returns a string translation. Note that
10478 when a translation is missing, the MSGID argument is returned
10481 This has the advantage of having the `ngettext' function for plural
10484 To use this API, one needs the `libintl.jar' file which is part of
10485 the GNU gettext package and distributed under the LGPL.
10487 Three examples, using the second API, are available in the `examples'
10488 directory: `hello-java', `hello-java-awt', `hello-java-swing'.
10490 Now, to make use of the API and define a shorthand for `getString',
10491 there are two idioms that you can choose from:
10493 * In a unique class of your project, say `Util', define a static
10494 variable holding the `ResourceBundle' instance:
10496 public static ResourceBundle myResources =
10497 ResourceBundle.getBundle("domain-name");
10499 All classes containing internationalized strings then contain
10501 private static ResourceBundle res = Util.myResources;
10502 private static String _(String s) { return res.getString(s); }
10504 and the shorthand is used like this:
10506 System.out.println(_("Operation completed."));
10508 * You add a class with a very short name, say `S', containing just
10509 the definition of the resource bundle and of the shorthand:
10512 public static ResourceBundle myResources =
10513 ResourceBundle.getBundle("domain-name");
10514 public static String _(String s) {
10515 return myResources.getString(s);
10519 and the shorthand is used like this:
10521 System.out.println(S._("Operation completed."));
10523 Which of the two idioms you choose, will depend on whether copying
10524 two lines of codes into every class is more acceptable in your project
10525 than a class with a single-letter name.
10528 File: gettext.info, Node: C#, Next: gawk, Prev: Java, Up: List of Programming Languages
10534 pnet, pnetlib 0.6.2 or newer, or mono 0.29 or newer
10545 gettext/ngettext functions
10546 `GettextResourceManager.GetString',
10547 `GettextResourceManager.GetPluralString'
10550 `new GettextResourceManager(domain)'
10553 --, compiled message catalogs are located in subdirectories of the
10554 directory containing the executable
10562 Use or emulate GNU gettext
10563 --, uses a C# specific message catalog format
10568 Formatting with positions
10569 `String.Format "{1} {0}"'
10577 Before marking strings as internationalizable, uses of the string
10578 concatenation operator need to be converted to `String.Format'
10579 invocations. For example, `"file "+filename+" not found"' becomes
10580 `String.Format("file {0} not found", filename)'. Only after this is
10581 done, can the strings be marked and extracted.
10583 GNU gettext uses the native C#/.NET internationalization mechanism,
10584 namely the classes `ResourceManager' and `ResourceSet'. Applications
10585 use the `ResourceManager' methods to retrieve the native language
10586 translation of strings. An instance of `ResourceSet' is the in-memory
10587 representation of a message catalog file. The `ResourceManager' loads
10588 and accesses `ResourceSet' instances as needed to look up the
10591 There are two formats of `ResourceSet's that can be directly loaded
10592 by the C# runtime: `.resources' files and `.dll' files.
10594 * The `.resources' format is a binary file usually generated through
10595 the `resgen' or `monoresgen' utility, but which doesn't support
10596 plural forms. `.resources' files can also be embedded in .NET
10597 `.exe' files. This only affects whether a file system access is
10598 performed to load the message catalog; it doesn't affect the
10599 contents of the message catalog.
10601 * On the other hand, the `.dll' format is a binary file that is
10602 compiled from `.cs' source code and can support plural forms
10603 (provided it is accessed through the GNU gettext API, see below).
10605 Note that these .NET `.dll' and `.exe' files are not tied to a
10606 particular platform; their file format and GNU gettext for C# can be
10607 used on any platform.
10609 To convert a PO file to a `.resources' file, the `msgfmt' program
10610 can be used with the option `--csharp-resources'. To convert a
10611 `.resources' file back to a PO file, the `msgunfmt' program can be used
10612 with the option `--csharp-resources'. You can also, in some cases, use
10613 the `resgen' program (from the `pnet' package) or the `monoresgen'
10614 program (from the `mono'/`mcs' package). These programs can also
10615 convert a `.resources' file back to a PO file. But beware: as of this
10616 writing (January 2004), the `monoresgen' converter is quite buggy and
10617 the `resgen' converter ignores the encoding of the PO files.
10619 To convert a PO file to a `.dll' file, the `msgfmt' program can be
10620 used with the option `--csharp'. The result will be a `.dll' file
10621 containing a subclass of `GettextResourceSet', which itself is a
10622 subclass of `ResourceSet'. To convert a `.dll' file containing a
10623 `GettextResourceSet' subclass back to a PO file, the `msgunfmt' program
10624 can be used with the option `--csharp'.
10626 The advantages of the `.dll' format over the `.resources' format are:
10628 1. Freedom to localize: Users can add their own translations to an
10629 application after it has been built and distributed. Whereas when
10630 the programmer uses a `ResourceManager' constructor provided by
10631 the system, the set of `.resources' files for an application must
10632 be specified when the application is built and cannot be extended
10635 2. Plural handling: A message catalog in `.dll' format supports the
10636 plural handling function `GetPluralString'. Whereas `.resources'
10637 files can only contain data and only support lookups that depend
10638 on a single string.
10640 3. The `GettextResourceManager' that loads the message catalogs in
10641 `.dll' format also provides for inheritance on a per-message basis.
10642 For example, in Austrian (`de_AT') locale, translations from the
10643 German (`de') message catalog will be used for messages not found
10644 in the Austrian message catalog. This has the consequence that
10645 the Austrian translators need only translate those few messages
10646 for which the translation into Austrian differs from the German
10647 one. Whereas when working with `.resources' files, each message
10648 catalog must provide the translations of all messages by itself.
10650 4. The `GettextResourceManager' that loads the message catalogs in
10651 `.dll' format also provides for a fallback: The English MSGID is
10652 returned when no translation can be found. Whereas when working
10653 with `.resources' files, a language-neutral `.resources' file must
10654 explicitly be provided as a fallback.
10656 On the side of the programmatic APIs, the programmer can use either
10657 the standard `ResourceManager' API and the GNU `GettextResourceManager'
10658 API. The latter is an extension of the former, because
10659 `GettextResourceManager' is a subclass of `ResourceManager'.
10661 1. The `System.Resources.ResourceManager' API.
10663 This API works with resources in `.resources' format.
10665 The creation of the `ResourceManager' is done through
10666 new ResourceManager(domainname, Assembly.GetExecutingAssembly())
10667 The `GetString' function returns a string's translation. Note
10668 that this function returns null when a translation is missing
10669 (i.e. not even found in the fallback resource file).
10671 2. The `GNU.Gettext.GettextResourceManager' API.
10673 This API works with resources in `.dll' format.
10675 Reference documentation is in the csharpdoc directory
10676 (csharpdoc/index.html).
10678 The creation of the `ResourceManager' is done through
10679 new GettextResourceManager(domainname)
10681 The `GetString' function returns a string's translation. Note
10682 that when a translation is missing, the MSGID argument is returned
10685 The `GetPluralString' function returns a string translation with
10686 plural handling, like the `ngettext' function in C.
10688 To use this API, one needs the `GNU.Gettext.dll' file which is
10689 part of the GNU gettext package and distributed under the LGPL.
10691 You can also mix both approaches: use the
10692 `GNU.Gettext.GettextResourceManager' constructor, but otherwise use
10693 only the `ResourceManager' type and only the `GetString' method. This
10694 is appropriate when you want to profit from the tools for PO files, but
10695 don't want to change an existing source code that uses
10696 `ResourceManager' and don't (yet) need the `GetPluralString' method.
10698 Two examples, using the second API, are available in the `examples'
10699 directory: `hello-csharp', `hello-csharp-forms'.
10701 Now, to make use of the API and define a shorthand for `GetString',
10702 there are two idioms that you can choose from:
10704 * In a unique class of your project, say `Util', define a static
10705 variable holding the `ResourceManager' instance:
10707 public static GettextResourceManager MyResourceManager =
10708 new GettextResourceManager("domain-name");
10710 All classes containing internationalized strings then contain
10712 private static GettextResourceManager Res = Util.MyResourceManager;
10713 private static String _(String s) { return Res.GetString(s); }
10715 and the shorthand is used like this:
10717 Console.WriteLine(_("Operation completed."));
10719 * You add a class with a very short name, say `S', containing just
10720 the definition of the resource manager and of the shorthand:
10723 public static GettextResourceManager MyResourceManager =
10724 new GettextResourceManager("domain-name");
10725 public static String _(String s) {
10726 return MyResourceManager.GetString(s);
10730 and the shorthand is used like this:
10732 Console.WriteLine(S._("Operation completed."));
10734 Which of the two idioms you choose, will depend on whether copying
10735 two lines of codes into every class is more acceptable in your project
10736 than a class with a single-letter name.
10739 File: gettext.info, Node: gawk, Next: Pascal, Prev: C#, Up: List of Programming Languages
10756 gettext/ngettext functions
10757 `dcgettext', missing `dcngettext' in gawk-3.1.0
10760 `TEXTDOMAIN' variable
10763 `bindtextdomain' function
10766 automatic, but missing `setlocale (LC_MESSAGES, "")' in gawk-3.1.0
10771 Use or emulate GNU gettext
10777 Formatting with positions
10778 `printf "%2$d %1$d"' (GNU awk only)
10781 On platforms without gettext, no translation. On non-GNU awks,
10782 you must define `dcgettext', `dcngettext' and `bindtextdomain'
10788 An example is available in the `examples' directory: `hello-gawk'.
10791 File: gettext.info, Node: Pascal, Next: wxWindows, Prev: gawk, Up: List of Programming Languages
10793 13.5.14 Pascal - Free Pascal Compiler
10794 -------------------------------------
10808 gettext/ngettext functions
10809 --, use `ResourceString' data type instead
10812 --, use `TranslateResourceStrings' function instead
10815 --, use `TranslateResourceStrings' function instead
10818 automatic, but uses only LANG, not LC_MESSAGES or LC_ALL
10821 `{$mode delphi}' or `{$mode objfpc}'
10824 Use or emulate GNU gettext
10828 `ppc386' followed by `xgettext' or `rstconv'
10830 Formatting with positions
10832 `format "%1:d %0:d"'
10840 The Pascal compiler has special support for the `ResourceString' data
10841 type. It generates a `.rst' file. This is then converted to a `.pot'
10842 file by use of `xgettext' or `rstconv'. At runtime, a `.mo' file
10843 corresponding to translations of this `.pot' file can be loaded using
10844 the `TranslateResourceStrings' function in the `gettext' unit.
10846 An example is available in the `examples' directory: `hello-pascal'.
10849 File: gettext.info, Node: wxWindows, Next: YCP, Prev: Pascal, Up: List of Programming Languages
10851 13.5.15 wxWindows library
10852 -------------------------
10866 gettext/ngettext functions
10867 `wxLocale::GetString', `wxGetTranslation'
10870 `wxLocale::AddCatalog'
10873 `wxLocale::AddCatalogLookupPathPrefix'
10876 `wxLocale::Init', `wxSetLocale'
10879 `#include <wx/intl.h>'
10881 Use or emulate GNU gettext
10882 emulate, see `include/wx/intl.h' and `src/common/intl.cpp'
10887 Formatting with positions
10897 File: gettext.info, Node: YCP, Next: Tcl, Prev: wxWindows, Up: List of Programming Languages
10899 13.5.16 YCP - YaST2 scripting language
10900 --------------------------------------
10903 libycp, libycp-devel, yast2-core, yast2-core-devel
10914 gettext/ngettext functions
10915 `_()' with 1 or 3 arguments
10918 `textdomain' statement
10929 Use or emulate GNU gettext
10935 Formatting with positions
10944 An example is available in the `examples' directory: `hello-ycp'.
10947 File: gettext.info, Node: Tcl, Next: Perl, Prev: YCP, Up: List of Programming Languages
10949 13.5.17 Tcl - Tk's scripting language
10950 -------------------------------------
10964 gettext/ngettext functions
10971 --, use `::msgcat::mcload' instead
10974 automatic, uses LANG, but ignores LC_MESSAGES and LC_ALL
10977 `package require msgcat'
10978 `proc _ {s} {return [::msgcat::mc $s]}'
10980 Use or emulate GNU gettext
10981 --, uses a Tcl specific message catalog format
10986 Formatting with positions
10987 `format "%2\$d %1\$d"'
10995 Two examples are available in the `examples' directory: `hello-tcl',
10998 Before marking strings as internationalizable, substitutions of
10999 variables into the string need to be converted to `format'
11000 applications. For example, `"file $filename not found"' becomes
11001 `[format "file %s not found" $filename]'. Only after this is done, can
11002 the strings be marked and extracted. After marking, this example
11003 becomes `[format [_ "file %s not found"] $filename]' or `[msgcat::mc
11004 "file %s not found" $filename]'. Note that the `msgcat::mc' function
11005 implicitly calls `format' when more than one argument is given.
11008 File: gettext.info, Node: Perl, Next: PHP, Prev: Tcl, Up: List of Programming Languages
11017 `pl', `PL', `pm', `cgi'
11032 * `/pattern match/'
11034 * `?pattern match?'
11036 * `s/substitution/operators/'
11038 * `$tied_hash{"message"}'
11040 * `$tied_hash_reference->{"message"}'
11042 * etc., issue the command `man perlsyn' for details
11046 `__' (double underscore)
11048 gettext/ngettext functions
11049 `gettext', `dgettext', `dcgettext', `ngettext', `dngettext',
11053 `textdomain' function
11056 `bindtextdomain' function
11058 bind_textdomain_codeset
11059 `bind_textdomain_codeset' function
11062 Use `setlocale (LC_ALL, "");'
11066 `use Locale::TextDomain;' (included in the package libintl-perl
11067 which is available on the Comprehensive Perl Archive Network CPAN,
11068 http://www.cpan.org/).
11070 Use or emulate GNU gettext
11071 platform dependent: gettext_pp emulates, gettext_xs uses GNU
11075 `xgettext -k__ -k\$__ -k%__ -k__x -k__n:1,2 -k__nx:1,2 -k__xn:1,2
11078 Formatting with positions
11079 Both kinds of format strings support formatting with positions.
11080 `printf "%2\$d %1\$d", ...' (requires Perl 5.8.0 or newer)
11081 `__expand("[new] replaces [old]", old => $oldvalue, new =>
11085 The `libintl-perl' package is platform independent but is not part
11086 of the Perl core. The programmer is responsible for providing a
11087 dummy implementation of the required functions if the package is
11088 not installed on the target system.
11094 Included in `libintl-perl', available on CPAN
11095 (http://www.cpan.org/).
11098 An example is available in the `examples' directory: `hello-perl'.
11100 The `xgettext' parser backend for Perl differs significantly from
11101 the parser backends for other programming languages, just as Perl
11102 itself differs significantly from other programming languages. The
11103 Perl parser backend offers many more string marking facilities than the
11104 other backends but it also has some Perl specific limitations, the
11105 worst probably being its imperfectness.
11109 * General Problems:: General Problems Parsing Perl Code
11110 * Default Keywords:: Which Keywords Will xgettext Look For?
11111 * Special Keywords:: How to Extract Hash Keys
11112 * Quote-like Expressions:: What are Strings And Quote-like Expressions?
11113 * Interpolation I:: Invalid String Interpolation
11114 * Interpolation II:: Valid String Interpolation
11115 * Parentheses:: When To Use Parentheses
11116 * Long Lines:: How To Grok with Long Lines
11117 * Perl Pitfalls:: Bugs, Pitfalls, and Things That Do Not Work
11120 File: gettext.info, Node: General Problems, Next: Default Keywords, Up: Perl
11122 13.5.18.1 General Problems Parsing Perl Code
11123 ............................................
11125 It is often heard that only Perl can parse Perl. This is not true.
11126 Perl cannot be _parsed_ at all, it can only be _executed_. Perl has
11127 various built-in ambiguities that can only be resolved at runtime.
11129 The following example may illustrate one common problem:
11131 print gettext "Hello World!";
11133 Although this example looks like a bullet-proof case of a function
11134 invocation, it is not:
11136 open gettext, ">testfile" or die;
11137 print gettext "Hello world!"
11139 In this context, the string `gettext' looks more like a file handle.
11140 But not necessarily:
11142 use Locale::Messages qw (:libintl_h);
11143 open gettext ">testfile" or die;
11144 print gettext "Hello world!";
11146 Now, the file is probably syntactically incorrect, provided that the
11147 module `Locale::Messages' found first in the Perl include path exports a
11148 function `gettext'. But what if the module `Locale::Messages' really
11151 use vars qw (*gettext);
11155 In this case, the string `gettext' will be interpreted as a file
11156 handle again, and the above example will create a file `testfile' and
11157 write the string "Hello world!" into it. Even advanced control flow
11158 analysis will not really help:
11165 print gettext "Hello world!";
11167 If the module `Sane' exports a function `gettext' that does what we
11168 expect, and the module `InSane' opens a file for writing and associates
11169 the _handle_ `gettext' with this output stream, we are clueless again
11170 about what will happen at runtime. It is completely unpredictable.
11171 The truth is that Perl has so many ways to fill its symbol table at
11172 runtime that it is impossible to interpret a particular piece of code
11173 without executing it.
11175 Of course, `xgettext' will not execute your Perl sources while
11176 scanning for translatable strings, but rather use heuristics in order
11177 to guess what you meant.
11179 Another problem is the ambiguity of the slash and the question mark.
11180 Their interpretation depends on the context:
11183 print "OK\n" if /foobar/;
11188 # Another pattern match.
11189 print "OK\n" if ?foobar?;
11192 print $x ? "foo" : "bar";
11194 The slash may either act as the division operator or introduce a
11195 pattern match, whereas the question mark may act as the ternary
11196 conditional operator or as a pattern match, too. Other programming
11197 languages like `awk' present similar problems, but the consequences of a
11198 misinterpretation are particularly nasty with Perl sources. In `awk'
11199 for instance, a statement can never exceed one line and the parser can
11200 recover from a parsing error at the next newline and interpret the rest
11201 of the input stream correctly. Perl is different, as a pattern match
11202 is terminated by the next appearance of the delimiter (the slash or the
11203 question mark) in the input stream, regardless of the semantic context.
11204 If a slash is really a division sign but mis-interpreted as a pattern
11205 match, the rest of the input file is most probably parsed incorrectly.
11207 If you find that `xgettext' fails to extract strings from portions
11208 of your sources, you should therefore look out for slashes and/or
11209 question marks preceding these sections. You may have come across a
11210 bug in `xgettext''s Perl parser (and of course you should report that
11211 bug). In the meantime you should consider to reformulate your code in
11212 a manner less challenging to `xgettext'.
11215 File: gettext.info, Node: Default Keywords, Next: Special Keywords, Prev: General Problems, Up: Perl
11217 13.5.18.2 Which keywords will xgettext look for?
11218 ................................................
11220 Unless you instruct `xgettext' otherwise by invoking it with one of the
11221 options `--keyword' or `-k', it will recognize the following keywords
11222 in your Perl sources:
11232 The first (singular) and the second (plural) argument will be
11237 The first (singular) and the second (plural) argument will be
11242 The first (singular) and the second (plural) argument will be
11249 The keys of lookups into the hash `%gettext' will be extracted.
11253 The keys of lookups into the hash reference `$gettext' will be
11258 File: gettext.info, Node: Special Keywords, Next: Quote-like Expressions, Prev: Default Keywords, Up: Perl
11260 13.5.18.3 How to Extract Hash Keys
11261 ..................................
11263 Translating messages at runtime is normally performed by looking up the
11264 original string in the translation database and returning the
11265 translated version. The "natural" Perl implementation is a hash
11266 lookup, and, of course, `xgettext' supports such practice.
11268 print __"Hello world!";
11269 print $__{"Hello world!"};
11270 print $__->{"Hello world!"};
11271 print $$__{"Hello world!"};
11273 The above four lines all do the same thing. The Perl module
11274 `Locale::TextDomain' exports by default a hash `%__' that is tied to
11275 the function `__()'. It also exports a reference `$__' to `%__'.
11277 If an argument to the `xgettext' option `--keyword', resp. `-k'
11278 starts with a percent sign, the rest of the keyword is interpreted as
11279 the name of a hash. If it starts with a dollar sign, the rest of the
11280 keyword is interpreted as a reference to a hash.
11282 Note that you can omit the quotation marks (single or double) around
11283 the hash key (almost) whenever Perl itself allows it:
11285 print $gettext{Error};
11287 The exact rule is: You can omit the surrounding quotes, when the hash
11288 key is a valid C (!) identifier, i. e. when it starts with an
11289 underscore or an ASCII letter and is followed by an arbitrary number of
11290 underscores, ASCII letters or digits. Other Unicode characters are
11291 _not_ allowed, regardless of the `use utf8' pragma.
11294 File: gettext.info, Node: Quote-like Expressions, Next: Interpolation I, Prev: Special Keywords, Up: Perl
11296 13.5.18.4 What are Strings And Quote-like Expressions?
11297 ......................................................
11299 Perl offers a plethora of different string constructs. Those that can
11300 be used either as arguments to functions or inside braces for hash
11301 lookups are generally supported by `xgettext'.
11303 * *double-quoted strings*
11304 print gettext "Hello World!";
11306 * *single-quoted strings*
11307 print gettext 'Hello World!';
11309 * *the operator qq*
11310 print gettext qq |Hello World!|;
11311 print gettext qq <E-mail: <guido\@imperia.net>>;
11313 The operator `qq' is fully supported. You can use arbitrary
11314 delimiters, including the four bracketing delimiters (round, angle,
11315 square, curly) that nest.
11318 print gettext q |Hello World!|;
11319 print gettext q <E-mail: <guido@imperia.net>>;
11321 The operator `q' is fully supported. You can use arbitrary
11322 delimiters, including the four bracketing delimiters (round, angle,
11323 square, curly) that nest.
11325 * *the operator qx*
11326 print gettext qx ;LANGUAGE=C /bin/date;
11327 print gettext qx [/usr/bin/ls | grep '^[A-Z]*'];
11329 The operator `qx' is fully supported. You can use arbitrary
11330 delimiters, including the four bracketing delimiters (round, angle,
11331 square, curly) that nest.
11333 The example is actually a useless use of `gettext'. It will
11334 invoke the `gettext' function on the output of the command
11335 specified with the `qx' operator. The feature was included in
11336 order to make the interface consistent (the parser will extract
11337 all strings and quote-like expressions).
11340 print gettext <<'EOF';
11341 program not found in $PATH
11344 print ngettext <<EOF, <<"EOF";
11347 several files deleted
11350 Here-documents are recognized. If the delimiter is enclosed in
11351 single quotes, the string is not interpolated. If it is enclosed
11352 in double quotes or has no quotes at all, the string is
11355 Delimiters that start with a digit are not supported!
11359 File: gettext.info, Node: Interpolation I, Next: Interpolation II, Prev: Quote-like Expressions, Up: Perl
11361 13.5.18.5 Invalid Uses Of String Interpolation
11362 ..............................................
11364 Perl is capable of interpolating variables into strings. This offers
11365 some nice features in localized programs but can also lead to problems.
11367 A common error is a construct like the following:
11369 print gettext "This is the program $0!\n";
11371 Perl will interpolate at runtime the value of the variable `$0' into
11372 the argument of the `gettext()' function. Hence, this argument is not
11373 a string constant but a variable argument (`$0' is a global variable
11374 that holds the name of the Perl script being executed). The
11375 interpolation is performed by Perl before the string argument is passed
11376 to `gettext()' and will therefore depend on the name of the script
11377 which can only be determined at runtime. Consequently, it is almost
11378 impossible that a translation can be looked up at runtime (except if,
11379 by accident, the interpolated string is found in the message catalog).
11381 The `xgettext' program will therefore terminate parsing with a fatal
11382 error if it encounters a variable inside of an extracted string. In
11383 general, this will happen for all kinds of string interpolations that
11384 cannot be safely performed at compile time. If you absolutely know
11385 what you are doing, you can always circumvent this behavior:
11387 my $know_what_i_am_doing = "This is program $0!\n";
11388 print gettext $know_what_i_am_doing;
11390 Since the parser only recognizes strings and quote-like expressions,
11391 but not variables or other terms, the above construct will be accepted.
11392 You will have to find another way, however, to let your original
11393 string make it into your message catalog.
11395 If invoked with the option `--extract-all', resp. `-a', variable
11396 interpolation will be accepted. Rationale: You will generally use this
11397 option in order to prepare your sources for internationalization.
11399 Please see the manual page `man perlop' for details of strings and
11400 quote-like expressions that are subject to interpolation and those that
11401 are not. Safe interpolations (that will not lead to a fatal error) are:
11403 * the escape sequences `\t' (tab, HT, TAB), `\n' (newline, NL), `\r'
11404 (return, CR), `\f' (form feed, FF), `\b' (backspace, BS), `\a'
11405 (alarm, bell, BEL), and `\e' (escape, ESC).
11407 * octal chars, like `\033'
11408 Note that octal escapes in the range of 400-777 are translated
11409 into a UTF-8 representation, regardless of the presence of the
11412 * hex chars, like `\x1b'
11414 * wide hex chars, like `\x{263a}'
11415 Note that this escape is translated into a UTF-8 representation,
11416 regardless of the presence of the `use utf8' pragma.
11418 * control chars, like `\c[' (CTRL-[)
11420 * named Unicode chars, like `\N{LATIN CAPITAL LETTER C WITH CEDILLA}'
11421 Note that this escape is translated into a UTF-8 representation,
11422 regardless of the presence of the `use utf8' pragma.
11424 The following escapes are considered partially safe:
11426 * `\l' lowercase next char
11428 * `\u' uppercase next char
11430 * `\L' lowercase till \E
11432 * `\U' uppercase till \E
11434 * `\E' end case modification
11436 * `\Q' quote non-word characters till \E
11439 These escapes are only considered safe if the string consists of
11440 ASCII characters only. Translation of characters outside the range
11441 defined by ASCII is locale-dependent and can actually only be performed
11442 at runtime; `xgettext' doesn't do these locale-dependent translations
11443 at extraction time.
11445 Except for the modifier `\Q', these translations, albeit valid, are
11446 generally useless and only obfuscate your sources. If a translation
11447 can be safely performed at compile time you can just as well write what
11451 File: gettext.info, Node: Interpolation II, Next: Parentheses, Prev: Interpolation I, Up: Perl
11453 13.5.18.6 Valid Uses Of String Interpolation
11454 ............................................
11456 Perl is often used to generate sources for other programming languages
11457 or arbitrary file formats. Web applications that output HTML code make
11458 a prominent example for such usage.
11460 You will often come across situations where you want to intersperse
11461 code written in the target (programming) language with translatable
11462 messages, like in the following HTML example:
11464 print gettext <<EOF;
11465 <h1>My Homepage</h1>
11466 <script language="JavaScript"><!--
11467 for (i = 0; i < 100; ++i) {
11468 alert ("Thank you so much for visiting my homepage!");
11473 The parser will extract the entire here document, and it will appear
11474 entirely in the resulting PO file, including the JavaScript snippet
11475 embedded in the HTML code. If you exaggerate with constructs like the
11476 above, you will run the risk that the translators of your package will
11477 look out for a less challenging project. You should consider an
11478 alternative expression here:
11481 <h1>$gettext{"My Homepage"}</h1>
11482 <script language="JavaScript"><!--
11483 for (i = 0; i < 100; ++i) {
11484 alert ("$gettext{'Thank you so much for visiting my homepage!'}");
11489 Only the translatable portions of the code will be extracted here,
11490 and the resulting PO file will begrudgingly improve in terms of
11493 You can interpolate hash lookups in all strings or quote-like
11494 expressions that are subject to interpolation (see the manual page `man
11495 perlop' for details). Double interpolation is invalid, however:
11497 # TRANSLATORS: Replace "the earth" with the name of your planet.
11498 print gettext qq{Welcome to $gettext->{"the earth"}};
11500 The `qq'-quoted string is recognized as an argument to `xgettext' in
11501 the first place, and checked for invalid variable interpolation. The
11502 dollar sign of hash-dereferencing will therefore terminate the parser
11503 with an "invalid interpolation" error.
11505 It is valid to interpolate hash lookups in regular expressions:
11507 if ($var =~ /$gettext{"the earth"}/) {
11508 print gettext "Match!\n";
11510 s/$gettext{"U. S. A."}/$gettext{"U. S. A."} $gettext{"(dial +0)"}/g;
11513 File: gettext.info, Node: Parentheses, Next: Long Lines, Prev: Interpolation II, Up: Perl
11515 13.5.18.7 When To Use Parentheses
11516 .................................
11518 In Perl, parentheses around function arguments are mostly optional.
11519 `xgettext' will always assume that all recognized keywords (except for
11520 hashs and hash references) are names of properly prototyped functions,
11521 and will (hopefully) only require parentheses where Perl itself
11522 requires them. All constructs in the following example are therefore
11525 print gettext ("Hello World!\n");
11526 print gettext "Hello World!\n";
11527 print dgettext ($package => "Hello World!\n");
11528 print dgettext $package, "Hello World!\n";
11530 # The "fat comma" => turns the left-hand side argument into a
11531 # single-quoted string!
11532 print dgettext smellovision => "Hello World!\n";
11534 # The following assignment only works with prototyped functions.
11535 # Otherwise, the functions will act as "greedy" list operators and
11536 # eat up all following arguments.
11537 my $anonymous_hash = {
11538 planet => gettext "earth",
11539 cakes => ngettext "one cake", "several cakes", $n,
11542 # The same without fat comma:
11544 'planet', gettext "earth",
11545 'cakes', ngettext "one cake", "several cakes", $n,
11549 # Parentheses are only significant for the first argument.
11550 print dngettext 'package', ("one cake", "several cakes", $n), $discarded;
11553 File: gettext.info, Node: Long Lines, Next: Perl Pitfalls, Prev: Parentheses, Up: Perl
11555 13.5.18.8 How To Grok with Long Lines
11556 .....................................
11558 The necessity of long messages can often lead to a cumbersome or
11559 unreadable coding style. Perl has several options that may prevent you
11560 from writing unreadable code, and `xgettext' does its best to do
11561 likewise. This is where the dot operator (the string concatenation
11562 operator) may come in handy:
11564 print gettext ("This is a very long"
11565 . " message that is still"
11566 . " readable, because"
11567 . " it is split into"
11568 . " multiple lines.\n");
11570 Perl is smart enough to concatenate these constant string fragments
11571 into one long string at compile time, and so is `xgettext'. You will
11572 only find one long message in the resulting POT file.
11574 Note that the future Perl 6 will probably use the underscore (`_')
11575 as the string concatenation operator, and the dot (`.') for
11576 dereferencing. This new syntax is not yet supported by `xgettext'.
11578 If embedded newline characters are not an issue, or even desired, you
11579 may also insert newline characters inside quoted strings wherever you
11582 print gettext ("<em>In HTML output
11583 embedded newlines are generally no
11584 problem, since adjacent whitespace
11585 is always rendered into a single
11586 space character.</em>");
11588 You may also consider to use here documents:
11590 print gettext <<EOF;
11592 embedded newlines are generally no
11593 problem, since adjacent whitespace
11594 is always rendered into a single
11595 space character.</em>
11598 Please do not forget, that the line breaks are real, i. e. they
11599 translate into newline characters that will consequently show up in the
11600 resulting POT file.
11603 File: gettext.info, Node: Perl Pitfalls, Prev: Long Lines, Up: Perl
11605 13.5.18.9 Bugs, Pitfalls, And Things That Do Not Work
11606 .....................................................
11608 The foregoing sections should have proven that `xgettext' is quite
11609 smart in extracting translatable strings from Perl sources. Yet, some
11610 more or less exotic constructs that could be expected to work, actually
11613 One of the more relevant limitations can be found in the
11614 implementation of variable interpolation inside quoted strings. Only
11615 simple hash lookups can be used there:
11618 $gettext{"The dot operator"
11621 Likewise, you cannot @{[ gettext ("interpolate function calls") ]}
11622 inside quoted strings or quote-like expressions.
11625 This is valid Perl code and will actually trigger invocations of the
11626 `gettext' function at runtime. Yet, the Perl parser in `xgettext' will
11627 fail to recognize the strings. A less obvious example can be found in
11628 the interpolation of regular expressions:
11630 s/<!--START_OF_WEEK-->/gettext ("Sunday")/e;
11632 The modifier `e' will cause the substitution to be interpreted as an
11633 evaluable statement. Consequently, at runtime the function `gettext()'
11634 is called, but again, the parser fails to extract the string "Sunday".
11635 Use a temporary variable as a simple workaround if you really happen to
11638 my $sunday = gettext "Sunday";
11639 s/<!--START_OF_WEEK-->/$sunday/;
11641 Hash slices would also be handy but are not recognized:
11643 my @weekdays = @gettext{'Sunday', 'Monday', 'Tuesday', 'Wednesday',
11644 'Thursday', 'Friday', 'Saturday'};
11646 @weekdays = @gettext{qw (Sunday Monday Tuesday Wednesday Thursday
11647 Friday Saturday) };
11649 This is perfectly valid usage of the tied hash `%gettext' but the
11650 strings are not recognized and therefore will not be extracted.
11652 Another caveat of the current version is its rudimentary support for
11653 non-ASCII characters in identifiers. You may encounter serious
11654 problems if you use identifiers with characters outside the range of
11655 'A'-'Z', 'a'-'z', '0'-'9' and the underscore '_'.
11657 Maybe some of these missing features will be implemented in future
11658 versions, but since you can always make do without them at minimal
11659 effort, these todos have very low priority.
11661 A nasty problem are brace format strings that already contain braces
11662 as part of the normal text, for example the usage strings typically
11663 encountered in programs:
11665 die "usage: $0 {OPTIONS} FILENAME...\n";
11667 If you want to internationalize this code with Perl brace format
11668 strings, you will run into a problem:
11670 die __x ("usage: {program} {OPTIONS} FILENAME...\n", program => $0);
11672 Whereas `{program}' is a placeholder, `{OPTIONS}' is not and should
11673 probably be translated. Yet, there is no way to teach the Perl parser
11674 in `xgettext' to recognize the first one, and leave the other one alone.
11676 There are two possible work-arounds for this problem. If you are
11677 sure that your program will run under Perl 5.8.0 or newer (these Perl
11678 versions handle positional parameters in `printf()') or if you are sure
11679 that the translator will not have to reorder the arguments in her
11680 translation - for example if you have only one brace placeholder in
11681 your string, or if it describes a syntax, like in this one -, you can
11682 mark the string as `no-perl-brace-format' and use `printf()':
11684 # xgettext: no-perl-brace-format
11685 die sprintf ("usage: %s {OPTIONS} FILENAME...\n", $0);
11687 If you want to use the more portable Perl brace format, you will
11688 have to do put placeholders in place of the literal braces:
11690 die __x ("usage: {program} {[}OPTIONS{]} FILENAME...\n",
11691 program => $0, '[' => '{', ']' => '}');
11693 Perl brace format strings know no escaping mechanism. No matter how
11694 this escaping mechanism looked like, it would either give the
11695 programmer a hard time, make translating Perl brace format strings
11696 heavy-going, or result in a performance penalty at runtime, when the
11697 format directives get executed. Most of the time you will happily get
11698 along with `printf()' for this special case.
11701 File: gettext.info, Node: PHP, Next: Pike, Prev: Perl, Up: List of Programming Languages
11703 13.5.19 PHP Hypertext Preprocessor
11704 ----------------------------------
11707 mod_php4, mod_php4-core, phpdoc
11710 `php', `php3', `php4'
11718 gettext/ngettext functions
11719 `gettext', `dgettext', `dcgettext'; starting with PHP 4.2.0 also
11720 `ngettext', `dngettext', `dcngettext'
11723 `textdomain' function
11726 `bindtextdomain' function
11729 Programmer must call `setlocale (LC_ALL, "")'
11734 Use or emulate GNU gettext
11740 Formatting with positions
11741 `printf "%2\$d %1\$d"'
11744 On platforms without gettext, the functions are not available.
11749 An example is available in the `examples' directory: `hello-php'.
11752 File: gettext.info, Node: Pike, Next: GCC-source, Prev: PHP, Up: List of Programming Languages
11769 gettext/ngettext functions
11770 `gettext', `dgettext', `dcgettext'
11773 `textdomain' function
11776 `bindtextdomain' function
11779 `setlocale' function
11782 `import Locale.Gettext;'
11784 Use or emulate GNU gettext
11790 Formatting with positions
11794 On platforms without gettext, the functions are not available.
11800 File: gettext.info, Node: GCC-source, Prev: Pike, Up: List of Programming Languages
11802 13.5.21 GNU Compiler Collection sources
11803 ---------------------------------------
11817 gettext/ngettext functions
11818 `gettext', `dgettext', `dcgettext', `ngettext', `dngettext',
11822 `textdomain' function
11825 `bindtextdomain' function
11828 Programmer must call `setlocale (LC_ALL, "")'
11831 `#include "intl.h"'
11833 Use or emulate GNU gettext
11839 Formatting with positions
11843 Uses autoconf macros
11849 File: gettext.info, Node: List of Data Formats, Prev: List of Programming Languages, Up: Programming Languages
11851 13.6 Internationalizable Data
11852 =============================
11854 Here is a list of other data formats which can be internationalized
11859 * POT:: POT - Portable Object Template
11860 * RST:: Resource String Table
11861 * Glade:: Glade - GNOME user interface description
11864 File: gettext.info, Node: POT, Next: RST, Prev: List of Data Formats, Up: List of Data Formats
11866 13.6.1 POT - Portable Object Template
11867 -------------------------------------
11879 File: gettext.info, Node: RST, Next: Glade, Prev: POT, Up: List of Data Formats
11881 13.6.2 Resource String Table
11882 ----------------------------
11891 `xgettext', `rstconv'
11894 File: gettext.info, Node: Glade, Prev: RST, Up: List of Data Formats
11896 13.6.3 Glade - GNOME user interface description
11897 -----------------------------------------------
11900 glade, libglade, glade2, libglade2, intltool
11906 `xgettext', `libglade-xgettext', `xml-i18n-extract',
11910 File: gettext.info, Node: Conclusion, Next: Language Codes, Prev: Programming Languages, Up: Top
11912 14 Concluding Remarks
11913 *********************
11915 We would like to conclude this GNU `gettext' manual by presenting an
11916 history of the Translation Project so far. We finally give a few
11917 pointers for those who want to do further research or readings about
11918 Native Language Support matters.
11922 * History:: History of GNU `gettext'
11923 * References:: Related Readings
11926 File: gettext.info, Node: History, Next: References, Prev: Conclusion, Up: Conclusion
11928 14.1 History of GNU `gettext'
11929 =============================
11931 Internationalization concerns and algorithms have been informally and
11932 casually discussed for years in GNU, sometimes around GNU `libc', maybe
11933 around the incoming `Hurd', or otherwise (nobody clearly remembers).
11934 And even then, when the work started for real, this was somewhat
11935 independently of these previous discussions.
11937 This all began in July 1994, when Patrick D'Cruze had the idea and
11938 initiative of internationalizing version 3.9.2 of GNU `fileutils'. He
11939 then asked Jim Meyering, the maintainer, how to get those changes
11940 folded into an official release. That first draft was full of
11941 `#ifdef's and somewhat disconcerting, and Jim wanted to find nicer
11942 ways. Patrick and Jim shared some tries and experimentations in this
11943 area. Then, feeling that this might eventually have a deeper impact on
11944 GNU, Jim wanted to know what standards were, and contacted Richard
11945 Stallman, who very quickly and verbally described an overall design for
11946 what was meant to become `glocale', at that time.
11948 Jim implemented `glocale' and got a lot of exhausting feedback from
11949 Patrick and Richard, of course, but also from Mitchum DSouza (who wrote
11950 a `catgets'-like package), Roland McGrath, maybe David MacKenzie,
11951 Franc,ois Pinard, and Paul Eggert, all pushing and pulling in various
11952 directions, not always compatible, to the extent that after a couple of
11953 test releases, `glocale' was torn apart. In particular, Paul Eggert -
11954 always keeping an eye on developments in Solaris - advocated the use of
11955 the `gettext' API over `glocale''s `catgets'-based API.
11957 While Jim took some distance and time and became dad for a second
11958 time, Roland wanted to get GNU `libc' internationalized, and got Ulrich
11959 Drepper involved in that project. Instead of starting from `glocale',
11960 Ulrich rewrote something from scratch, but more conformant to the set
11961 of guidelines who emerged out of the `glocale' effort. Then, Ulrich
11962 got people from the previous forum to involve themselves into this new
11963 project, and the switch from `glocale' to what was first named
11964 `msgutils', renamed `nlsutils', and later `gettext', became officially
11965 accepted by Richard in May 1995 or so.
11967 Let's summarize by saying that Ulrich Drepper wrote GNU `gettext' in
11968 April 1995. The first official release of the package, including PO
11969 mode, occurred in July 1995, and was numbered 0.7. Other people
11970 contributed to the effort by providing a discussion forum around
11971 Ulrich, writing little pieces of code, or testing. These are quoted in
11972 the `THANKS' file which comes with the GNU `gettext' distribution.
11974 While this was being done, Franc,ois adapted half a dozen of GNU
11975 packages to `glocale' first, then later to `gettext', putting them in
11976 pretest, so providing along the way an effective user environment for
11977 fine tuning the evolving tools. He also took the responsibility of
11978 organizing and coordinating the Translation Project. After nearly a
11979 year of informal exchanges between people from many countries,
11980 translator teams started to exist in May 1995, through the creation and
11981 support by Patrick D'Cruze of twenty unmoderated mailing lists for that
11982 many native languages, and two moderated lists: one for reaching all
11983 teams at once, the other for reaching all willing maintainers of
11984 internationalized free software packages.
11986 Franc,ois also wrote PO mode in June 1995 with the collaboration of
11987 Greg McGary, as a kind of contribution to Ulrich's package. He also
11988 gave a hand with the GNU `gettext' Texinfo manual.
11990 In 1997, Ulrich Drepper released the GNU libc 2.0, which included the
11991 `gettext', `textdomain' and `bindtextdomain' functions.
11993 In 2000, Ulrich Drepper added plural form handling (the `ngettext'
11994 function) to GNU libc. Later, in 2001, he released GNU libc 2.2.x,
11995 which is the first free C library with full internationalization
11998 Ulrich being quite busy in his role of General Maintainer of GNU
11999 libc, he handed over the GNU `gettext' maintenance to Bruno Haible in
12000 2000. Bruno added the plural form handling to the tools as well, added
12001 support for UTF-8 and CJK locales, and wrote a few new tools for
12002 manipulating PO files.
12005 File: gettext.info, Node: References, Prev: History, Up: Conclusion
12007 14.2 Related Readings
12008 =====================
12010 Eugene H. Dorr (`dorre@well.com') maintains an interesting bibliography
12011 on internationalization matters, called `Internationalization Reference
12012 List', which is available as:
12013 ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/i18n-books.txt
12015 Michael Gschwind (`mike@vlsivie.tuwien.ac.at') maintains a
12016 Frequently Asked Questions (FAQ) list, entitled `Programming for
12017 Internationalisation'. This FAQ discusses writing programs which can
12018 handle different language conventions, character sets, etc.; and is
12019 applicable to all character set encodings, with particular emphasis on
12020 ISO 8859-1. It is regularly published in Usenet groups
12021 `comp.unix.questions', `comp.std.internat',
12022 `comp.software.international', `comp.lang.c', `comp.windows.x',
12023 `comp.std.c', `comp.answers' and `news.answers'. The home location of
12025 ftp://ftp.vlsivie.tuwien.ac.at/pub/8bit/ISO-programming
12027 Patrick D'Cruze (`pdcruze@li.org') wrote a tutorial about NLS
12028 matters, and Jochen Hein (`Hein@student.tu-clausthal.de') took over the
12029 responsibility of maintaining it. It may be found as:
12030 ftp://sunsite.unc.edu/pub/Linux/utils/nls/catalogs/Incoming/...
12031 ...locale-tutorial-0.8.txt.gz
12032 This site is mirrored in:
12033 ftp://ftp.ibp.fr/pub/linux/sunsite/
12035 A French version of the same tutorial should be findable at:
12036 ftp://ftp.ibp.fr/pub/linux/french/docs/
12037 together with French translations of many Linux-related documents.
12040 File: gettext.info, Node: Language Codes, Next: Country Codes, Prev: Conclusion, Up: Top
12042 Appendix A Language Codes
12043 *************************
12045 The ISO 639 standard defines two character codes for many languages.
12046 All abbreviations for languages used in the Translation Project should
12047 come from this standard.
12089 Byelorussian; Belarusian.
12203 Gallegan; Galician.
12218 Hebrew (formerly iw).
12230 Haitian; Haitian Creole.
12245 Indonesian (formerly in).
12293 Kalaallisut; Greenlandic.
12332 Limburgish; Limburger; Limburgan.
12416 Occitan; Provenc,al.
12506 Sesotho; Sotho, Southern.
12590 Yiddish (formerly ji).
12605 File: gettext.info, Node: Country Codes, Next: Program Index, Prev: Language Codes, Up: Top
12607 Appendix B Country Codes
12608 ************************
12610 The ISO 3166 standard defines two character codes for many countries
12611 and territories. All abbreviations for countries used in the
12612 Translation Project should come from this standard.
12618 United Arab Emirates.
12624 Antigua and Barbuda.
12636 Netherlands Antilles.
12663 Bosnia and Herzegovina.
12723 Cocos (Keeling) Islands.
12729 Central African Rep..
12759 Serbia and Montenegro.
12789 Dominican Republic.
12873 South Georgia and the South Sandwich Islands.
12891 Heard Island and McDonald Islands.
12918 British Indian Ocean Territory.
12957 St Kitts and Nevis.
13038 Northern Mariana Islands.
13131 St Pierre and Miquelon.
13191 Svalbard and Jan Mayen.
13212 Sao Tome and Principe.
13224 Turks and Caicos Islands.
13230 French Southern and Antarctic Lands.
13260 Trinidad and Tobago.
13278 US minor outlying islands.
13299 Virgin Islands (UK).
13302 Virgin Islands (US).
13332 File: gettext.info, Node: Program Index, Next: Option Index, Prev: Country Codes, Up: Top
13340 * autopoint: autopoint Invocation. (line 6)
13341 * envsubst: envsubst Invocation. (line 6)
13342 * gettext <1>: gettext Invocation. (line 6)
13343 * gettext: sh. (line 19)
13344 * gettextize: gettextize Invocation.
13346 * msgattrib: msgattrib Invocation. (line 6)
13347 * msgcat: msgcat Invocation. (line 6)
13348 * msgcmp: msgcmp Invocation. (line 6)
13349 * msgcomm: msgcomm Invocation. (line 6)
13350 * msgconv: msgconv Invocation. (line 6)
13351 * msgen: msgen Invocation. (line 6)
13352 * msgexec: msgexec Invocation. (line 6)
13353 * msgfilter: msgfilter Invocation. (line 6)
13354 * msgfmt: msgfmt Invocation. (line 6)
13355 * msggrep: msggrep Invocation. (line 6)
13356 * msginit: msginit Invocation. (line 6)
13357 * msgmerge: msgmerge Invocation. (line 6)
13358 * msgunfmt: msgunfmt Invocation. (line 6)
13359 * msguniq: msguniq Invocation. (line 6)
13360 * ngettext <1>: ngettext Invocation. (line 6)
13361 * ngettext: sh. (line 19)
13362 * xgettext: xgettext Invocation. (line 6)
13365 File: gettext.info, Node: Option Index, Next: Variable Index, Prev: Program Index, Up: Top
13373 * --add-comments, xgettext option: xgettext Invocation. (line 97)
13374 * --add-location, msgattrib option: msgattrib Invocation.
13376 * --add-location, msgcat option: msgcat Invocation. (line 105)
13377 * --add-location, msgcomm option: msgcomm Invocation. (line 95)
13378 * --add-location, msgconv option: msgconv Invocation. (line 74)
13379 * --add-location, msgen option: msgen Invocation. (line 70)
13380 * --add-location, msgfilter option: msgfilter Invocation.
13382 * --add-location, msggrep option: msggrep Invocation. (line 134)
13383 * --add-location, msgmerge option: msgmerge Invocation. (line 135)
13384 * --add-location, msguniq option: msguniq Invocation. (line 92)
13385 * --add-location, xgettext option: xgettext Invocation. (line 211)
13386 * --alignment, msgfmt option: msgfmt Invocation. (line 209)
13387 * --backup, msgmerge option: msgmerge Invocation. (line 65)
13388 * --c++, xgettext option: xgettext Invocation. (line 64)
13389 * --check, msgfmt option: msgfmt Invocation. (line 146)
13390 * --check-accelerators, msgfmt option: msgfmt Invocation. (line 187)
13391 * --check-compatibility, msgfmt option: msgfmt Invocation. (line 183)
13392 * --check-domain, msgfmt option: msgfmt Invocation. (line 178)
13393 * --check-format, msgfmt option: msgfmt Invocation. (line 150)
13394 * --check-header, msgfmt option: msgfmt Invocation. (line 173)
13395 * --clear-fuzzy, msgattrib option: msgattrib Invocation.
13397 * --clear-obsolete, msgattrib option: msgattrib Invocation.
13399 * --comment, msggrep option: msggrep Invocation. (line 85)
13400 * --compendium, msgmerge option: msgmerge Invocation. (line 36)
13401 * --copy, gettextize option: gettextize Invocation.
13403 * --copyright-holder, xgettext option: xgettext Invocation. (line 258)
13404 * --csharp, msgfmt option: msgfmt Invocation. (line 36)
13405 * --csharp, msgunfmt option: msgunfmt Invocation. (line 19)
13406 * --csharp-resources, msgfmt option: msgfmt Invocation. (line 40)
13407 * --csharp-resources, msgunfmt option: msgunfmt Invocation. (line 23)
13408 * --debug, xgettext option: xgettext Invocation. (line 183)
13409 * --default-domain, xgettext option: xgettext Invocation. (line 36)
13410 * --directory, msgattrib option: msgattrib Invocation.
13412 * --directory, msgcat option: msgcat Invocation. (line 32)
13413 * --directory, msgcmp option: msgcmp Invocation. (line 27)
13414 * --directory, msgcomm option: msgcomm Invocation. (line 30)
13415 * --directory, msgconv option: msgconv Invocation. (line 19)
13416 * --directory, msgen option: msgen Invocation. (line 25)
13417 * --directory, msgexec option: msgexec Invocation. (line 42)
13418 * --directory, msgfilter option: msgfilter Invocation.
13420 * --directory, msgfmt option: msgfmt Invocation. (line 18)
13421 * --directory, msggrep option: msggrep Invocation. (line 19)
13422 * --directory, msgmerge option: msgmerge Invocation. (line 30)
13423 * --directory, msguniq option: msguniq Invocation. (line 26)
13424 * --directory, xgettext option: xgettext Invocation. (line 24)
13425 * --domain, gettext option: gettext Invocation. (line 16)
13426 * --domain, msggrep option: msggrep Invocation. (line 73)
13427 * --domain, ngettext option: ngettext Invocation. (line 15)
13428 * --dry-run, autopoint option: autopoint Invocation.
13430 * --dry-run, gettextize option: gettextize Invocation.
13432 * --exclude-file, xgettext option: xgettext Invocation. (line 92)
13433 * --expression, msgfilter option: msgfilter Invocation.
13435 * --extended-regexp, msggrep option: msggrep Invocation. (line 89)
13436 * --extract-all, xgettext option: xgettext Invocation. (line 106)
13437 * --file, msgfilter option: msgfilter Invocation.
13439 * --file, msggrep option: msggrep Invocation. (line 101)
13440 * --files-from, msgcat option: msgcat Invocation. (line 27)
13441 * --files-from, msgcomm option: msgcomm Invocation. (line 25)
13442 * --files-from, xgettext option: xgettext Invocation. (line 19)
13443 * --fixed-strings, msggrep option: msggrep Invocation. (line 93)
13444 * --flag, xgettext option: xgettext Invocation. (line 134)
13445 * --force, autopoint option: autopoint Invocation.
13447 * --force, gettextize option: gettextize Invocation.
13449 * --force-po, msgattrib option: msgattrib Invocation.
13451 * --force-po, msgcat option: msgcat Invocation. (line 94)
13452 * --force-po, msgcomm option: msgcomm Invocation. (line 84)
13453 * --force-po, msgconv option: msgconv Invocation. (line 64)
13454 * --force-po, msgen option: msgen Invocation. (line 60)
13455 * --force-po, msgfilter option: msgfilter Invocation.
13457 * --force-po, msggrep option: msggrep Invocation. (line 125)
13458 * --force-po, msgmerge option: msgmerge Invocation. (line 125)
13459 * --force-po, msgunfmt option: msgunfmt Invocation. (line 108)
13460 * --force-po, msguniq option: msguniq Invocation. (line 81)
13461 * --force-po, xgettext option: xgettext Invocation. (line 200)
13462 * --foreign-user, xgettext option: xgettext Invocation. (line 273)
13463 * --from-code, xgettext option: xgettext Invocation. (line 74)
13464 * --fuzzy, msgattrib option: msgattrib Invocation.
13466 * --help, autopoint option: autopoint Invocation.
13468 * --help, envsubst option: envsubst Invocation. (line 22)
13469 * --help, gettext option: gettext Invocation. (line 32)
13470 * --help, gettextize option: gettextize Invocation.
13472 * --help, msgattrib option: msgattrib Invocation.
13474 * --help, msgcat option: msgcat Invocation. (line 150)
13475 * --help, msgcmp option: msgcmp Invocation. (line 57)
13476 * --help, msgcomm option: msgcomm Invocation. (line 143)
13477 * --help, msgconv option: msgconv Invocation. (line 119)
13478 * --help, msgen option: msgen Invocation. (line 115)
13479 * --help, msgexec option: msgexec Invocation. (line 67)
13480 * --help, msgfilter option: msgfilter Invocation.
13482 * --help, msgfmt option: msgfmt Invocation. (line 222)
13483 * --help, msggrep option: msggrep Invocation. (line 177)
13484 * --help, msginit option: msginit Invocation. (line 90)
13485 * --help, msgmerge option: msgmerge Invocation. (line 180)
13486 * --help, msgunfmt option: msgunfmt Invocation. (line 153)
13487 * --help, msguniq option: msguniq Invocation. (line 137)
13488 * --help, ngettext option: ngettext Invocation. (line 31)
13489 * --help, xgettext option: xgettext Invocation. (line 319)
13490 * --ignore-case, msggrep option: msggrep Invocation. (line 105)
13491 * --ignore-file, msgattrib option: msgattrib Invocation.
13493 * --indent, msgattrib option: msgattrib Invocation.
13495 * --indent, msgcat option: msgcat Invocation. (line 98)
13496 * --indent, msgcomm option: msgcomm Invocation. (line 88)
13497 * --indent, msgconv option: msgconv Invocation. (line 68)
13498 * --indent, msgen option: msgen Invocation. (line 64)
13499 * --indent, msgfilter option: msgfilter Invocation.
13501 * --indent, msggrep option: msggrep Invocation. (line 128)
13502 * --indent, msgmerge option: msgmerge Invocation. (line 129)
13503 * --indent, msgunfmt option: msgunfmt Invocation. (line 112)
13504 * --indent, msguniq option: msguniq Invocation. (line 85)
13505 * --indent, xgettext option: xgettext Invocation. (line 204)
13506 * --input, msgexec option: msgexec Invocation. (line 38)
13507 * --input, msgfilter option: msgfilter Invocation.
13509 * --input, msginit option: msginit Invocation. (line 16)
13510 * --intl, gettextize option: gettextize Invocation.
13512 * --java, msgfmt option: msgfmt Invocation. (line 30)
13513 * --java, msgunfmt option: msgunfmt Invocation. (line 16)
13514 * --java2, msgfmt option: msgfmt Invocation. (line 33)
13515 * --join-existing, xgettext option: xgettext Invocation. (line 88)
13516 * --keep-header, msgfilter option: msgfilter Invocation.
13518 * --keyword, xgettext option: xgettext Invocation. (line 114)
13519 * --language, xgettext option: xgettext Invocation. (line 56)
13520 * --less-than, msgcat option: msgcat Invocation. (line 55)
13521 * --less-than, msgcomm option: msgcomm Invocation. (line 53)
13522 * --locale, msgfmt option: msgfmt Invocation. (line 79)
13523 * --locale, msginit option: msginit Invocation. (line 52)
13524 * --locale, msgunfmt option: msgunfmt Invocation. (line 47)
13525 * --location, msggrep option: msggrep Invocation. (line 68)
13526 * --more-than, msgcat option: msgcat Invocation. (line 60)
13527 * --more-than, msgcomm option: msgcomm Invocation. (line 58)
13528 * --msgid, msggrep option: msggrep Invocation. (line 77)
13529 * --msgid-bugs-address, xgettext option: xgettext Invocation. (line 279)
13530 * --msgstr, msggrep option: msggrep Invocation. (line 81)
13531 * --msgstr-prefix, xgettext option: xgettext Invocation. (line 307)
13532 * --msgstr-suffix, xgettext option: xgettext Invocation. (line 311)
13533 * --multi-domain, msgcmp option: msgcmp Invocation. (line 36)
13534 * --multi-domain, msgmerge option: msgmerge Invocation. (line 101)
13535 * --no-changelog, gettextize option: gettextize Invocation.
13537 * --no-fuzzy, msgattrib option: msgattrib Invocation.
13539 * --no-fuzzy-matching, msgmerge option: msgmerge Invocation. (line 105)
13540 * --no-hash, msgfmt option: msgfmt Invocation. (line 212)
13541 * --no-location, msgattrib option: msgattrib Invocation.
13543 * --no-location, msgcat option: msgcat Invocation. (line 101)
13544 * --no-location, msgcomm option: msgcomm Invocation. (line 91)
13545 * --no-location, msgconv option: msgconv Invocation. (line 71)
13546 * --no-location, msgen option: msgen Invocation. (line 67)
13547 * --no-location, msgfilter option: msgfilter Invocation.
13549 * --no-location, msggrep option: msggrep Invocation. (line 131)
13550 * --no-location, msgmerge option: msgmerge Invocation. (line 132)
13551 * --no-location, msguniq option: msguniq Invocation. (line 88)
13552 * --no-location, xgettext option: xgettext Invocation. (line 207)
13553 * --no-obsolete, msgattrib option: msgattrib Invocation.
13555 * --no-translator, msginit option: msginit Invocation. (line 58)
13556 * --no-wrap, msgattrib option: msgattrib Invocation.
13558 * --no-wrap, msgcat option: msgcat Invocation. (line 130)
13559 * --no-wrap, msgcomm option: msgcomm Invocation. (line 120)
13560 * --no-wrap, msgconv option: msgconv Invocation. (line 99)
13561 * --no-wrap, msgen option: msgen Invocation. (line 95)
13562 * --no-wrap, msgfilter option: msgfilter Invocation.
13564 * --no-wrap, msggrep option: msggrep Invocation. (line 159)
13565 * --no-wrap, msginit option: msginit Invocation. (line 79)
13566 * --no-wrap, msgmerge option: msgmerge Invocation. (line 160)
13567 * --no-wrap, msgunfmt option: msgunfmt Invocation. (line 137)
13568 * --no-wrap, msguniq option: msguniq Invocation. (line 117)
13569 * --no-wrap, xgettext option: xgettext Invocation. (line 235)
13570 * --obsolete, msgattrib option: msgattrib Invocation.
13572 * --omit-header, msgcomm option: msgcomm Invocation. (line 135)
13573 * --omit-header, xgettext option: xgettext Invocation. (line 250)
13574 * --only-file, msgattrib option: msgattrib Invocation.
13576 * --only-fuzzy, msgattrib option: msgattrib Invocation.
13578 * --only-obsolete, msgattrib option: msgattrib Invocation.
13580 * --output, xgettext option: xgettext Invocation. (line 40)
13581 * --output-dir, xgettext option: xgettext Invocation. (line 45)
13582 * --output-file, msgattrib option: msgattrib Invocation.
13584 * --output-file, msgcat option: msgcat Invocation. (line 44)
13585 * --output-file, msgcomm option: msgcomm Invocation. (line 42)
13586 * --output-file, msgconv option: msgconv Invocation. (line 31)
13587 * --output-file, msgen option: msgen Invocation. (line 37)
13588 * --output-file, msgfilter option: msgfilter Invocation.
13590 * --output-file, msgfmt option: msgfmt Invocation. (line 54)
13591 * --output-file, msggrep option: msggrep Invocation. (line 31)
13592 * --output-file, msginit option: msginit Invocation. (line 27)
13593 * --output-file, msgmerge option: msgmerge Invocation. (line 53)
13594 * --output-file, msgunfmt option: msgunfmt Invocation. (line 98)
13595 * --output-file, msguniq option: msguniq Invocation. (line 38)
13596 * --properties-input, msgattrib option: msgattrib Invocation.
13598 * --properties-input, msgcat option: msgcat Invocation. (line 74)
13599 * --properties-input, msgcmp option: msgcmp Invocation. (line 44)
13600 * --properties-input, msgcomm option: msgcomm Invocation. (line 72)
13601 * --properties-input, msgconv option: msgconv Invocation. (line 52)
13602 * --properties-input, msgen option: msgen Invocation. (line 48)
13603 * --properties-input, msgexec option: msgexec Invocation. (line 54)
13604 * --properties-input, msgfilter option: msgfilter Invocation.
13606 * --properties-input, msgfmt option: msgfmt Invocation. (line 133)
13607 * --properties-input, msggrep option: msggrep Invocation. (line 113)
13608 * --properties-input, msginit option: msginit Invocation. (line 39)
13609 * --properties-input, msgmerge option: msgmerge Invocation. (line 113)
13610 * --properties-input, msguniq option: msguniq Invocation. (line 61)
13611 * --properties-output, msgattrib option: msgattrib Invocation.
13613 * --properties-output, msgcat option: msgcat Invocation. (line 114)
13614 * --properties-output, msgcomm option: msgcomm Invocation. (line 104)
13615 * --properties-output, msgconv option: msgconv Invocation. (line 83)
13616 * --properties-output, msgen option: msgen Invocation. (line 79)
13617 * --properties-output, msgfilter option: msgfilter Invocation.
13619 * --properties-output, msggrep option: msggrep Invocation. (line 143)
13620 * --properties-output, msginit option: msginit Invocation. (line 63)
13621 * --properties-output, msgmerge option: msgmerge Invocation. (line 144)
13622 * --properties-output, msgunfmt option: msgunfmt Invocation. (line 121)
13623 * --properties-output, msguniq option: msguniq Invocation. (line 101)
13624 * --properties-output, xgettext option: xgettext Invocation. (line 219)
13625 * --qt, msgfmt option: msgfmt Invocation. (line 46)
13626 * --qt, xgettext option: xgettext Invocation. (line 179)
13627 * --quiet, msgfilter option: msgfilter Invocation.
13629 * --quiet, msgmerge option: msgmerge Invocation. (line 193)
13630 * --regexp=, msggrep option: msggrep Invocation. (line 97)
13631 * --repeated, msguniq option: msguniq Invocation. (line 49)
13632 * --resource, msgfmt option: msgfmt Invocation. (line 75)
13633 * --resource, msgunfmt option: msgunfmt Invocation. (line 43)
13634 * --set-fuzzy, msgattrib option: msgattrib Invocation.
13636 * --set-obsolete, msgattrib option: msgattrib Invocation.
13638 * --silent, msgfilter option: msgfilter Invocation.
13640 * --silent, msgmerge option: msgmerge Invocation. (line 193)
13641 * --sort-by-file, msgattrib option: msgattrib Invocation.
13643 * --sort-by-file, msgcat option: msgcat Invocation. (line 142)
13644 * --sort-by-file, msgcomm option: msgcomm Invocation. (line 132)
13645 * --sort-by-file, msgconv option: msgconv Invocation. (line 111)
13646 * --sort-by-file, msgen option: msgen Invocation. (line 107)
13647 * --sort-by-file, msgfilter option: msgfilter Invocation.
13649 * --sort-by-file, msggrep option: msggrep Invocation. (line 169)
13650 * --sort-by-file, msgmerge option: msgmerge Invocation. (line 172)
13651 * --sort-by-file, msguniq option: msguniq Invocation. (line 129)
13652 * --sort-by-file, xgettext option: xgettext Invocation. (line 247)
13653 * --sort-output, msgattrib option: msgattrib Invocation.
13655 * --sort-output, msgcat option: msgcat Invocation. (line 137)
13656 * --sort-output, msgcomm option: msgcomm Invocation. (line 127)
13657 * --sort-output, msgconv option: msgconv Invocation. (line 106)
13658 * --sort-output, msgen option: msgen Invocation. (line 102)
13659 * --sort-output, msgfilter option: msgfilter Invocation.
13661 * --sort-output, msggrep option: msggrep Invocation. (line 165)
13662 * --sort-output, msgmerge option: msgmerge Invocation. (line 167)
13663 * --sort-output, msgunfmt option: msgunfmt Invocation. (line 144)
13664 * --sort-output, msguniq option: msguniq Invocation. (line 124)
13665 * --sort-output, xgettext option: xgettext Invocation. (line 242)
13666 * --statistics, msgfmt option: msgfmt Invocation. (line 229)
13667 * --strict, msgattrib option: msgattrib Invocation.
13669 * --strict, msgcat option: msgcat Invocation. (line 108)
13670 * --strict, msgcomm option: msgcomm Invocation. (line 98)
13671 * --strict, msgconv option: msgconv Invocation. (line 77)
13672 * --strict, msgen option: msgen Invocation. (line 73)
13673 * --strict, msgfilter option: msgfilter Invocation.
13675 * --strict, msgfmt option: msgfmt Invocation. (line 57)
13676 * --strict, msggrep option: msggrep Invocation. (line 137)
13677 * --strict, msgmerge option: msgmerge Invocation. (line 138)
13678 * --strict, msgunfmt option: msgunfmt Invocation. (line 115)
13679 * --strict, msguniq option: msguniq Invocation. (line 95)
13680 * --strict, xgettext option: xgettext Invocation. (line 214)
13681 * --stringtable-input, msgattrib option: msgattrib Invocation.
13683 * --stringtable-input, msgcat option: msgcat Invocation. (line 78)
13684 * --stringtable-input, msgcmp option: msgcmp Invocation. (line 48)
13685 * --stringtable-input, msgcomm option: msgcomm Invocation. (line 76)
13686 * --stringtable-input, msgen option: msgen Invocation. (line 52)
13687 * --stringtable-input, msgexec option: msgexec Invocation. (line 58)
13688 * --stringtable-input, msgfilter option: msgfilter Invocation.
13690 * --stringtable-input, msgfmt option: msgfmt Invocation. (line 137)
13691 * --stringtable-input, msggrep option: msggrep Invocation. (line 117)
13692 * --stringtable-input, msginit option: msginit Invocation. (line 43)
13693 * --stringtable-input, msgmerge option: msgmerge Invocation. (line 117)
13694 * --stringtable-input, msgonv option: msgconv Invocation. (line 56)
13695 * --stringtable-input, msguniq option: msguniq Invocation. (line 65)
13696 * --stringtable-output, msgattrib option: msgattrib Invocation.
13698 * --stringtable-output, msgcat option: msgcat Invocation. (line 119)
13699 * --stringtable-output, msgcomm option: msgcomm Invocation. (line 109)
13700 * --stringtable-output, msgconv option: msgconv Invocation. (line 88)
13701 * --stringtable-output, msgen option: msgen Invocation. (line 84)
13702 * --stringtable-output, msgfilter option: msgfilter Invocation.
13704 * --stringtable-output, msggrep option: msggrep Invocation. (line 148)
13705 * --stringtable-output, msginit option: msginit Invocation. (line 68)
13706 * --stringtable-output, msgmerge option: msgmerge Invocation. (line 149)
13707 * --stringtable-output, msgunfmt option: msgunfmt Invocation. (line 126)
13708 * --stringtable-output, msguniq option: msguniq Invocation. (line 106)
13709 * --stringtable-output, xgettext option: xgettext Invocation. (line 224)
13710 * --suffix, msgmerge option: msgmerge Invocation. (line 68)
13711 * --tcl, msgfmt option: msgfmt Invocation. (line 43)
13712 * --tcl, msgunfmt option: msgunfmt Invocation. (line 26)
13713 * --to-code, msgcat option: msgcat Invocation. (line 87)
13714 * --to-code, msgconv option: msgconv Invocation. (line 42)
13715 * --to-code, msguniq option: msguniq Invocation. (line 74)
13716 * --translated, msgattrib option: msgattrib Invocation.
13718 * --trigraphs, xgettext option: xgettext Invocation. (line 174)
13719 * --unique, msgcat option: msgcat Invocation. (line 65)
13720 * --unique, msgcomm option: msgcomm Invocation. (line 63)
13721 * --unique, msguniq option: msguniq Invocation. (line 53)
13722 * --untranslated, msgattrib option: msgattrib Invocation.
13724 * --update, msgmerge option: msgmerge Invocation. (line 45)
13725 * --use-first, msgcat option: msgcat Invocation. (line 90)
13726 * --use-first, msguniq option: msguniq Invocation. (line 77)
13727 * --use-fuzzy, msgfmt option: msgfmt Invocation. (line 199)
13728 * --variables, envsubst option: envsubst Invocation. (line 15)
13729 * --verbose, msgfmt option: msgfmt Invocation. (line 233)
13730 * --verbose, msgmerge option: msgmerge Invocation. (line 188)
13731 * --verbose, msgunfmt option: msgunfmt Invocation. (line 161)
13732 * --version, autopoint option: autopoint Invocation.
13734 * --version, envsubst option: envsubst Invocation. (line 26)
13735 * --version, gettext option: gettext Invocation. (line 40)
13736 * --version, gettextize option: gettextize Invocation.
13738 * --version, msgattrib option: msgattrib Invocation.
13740 * --version, msgcat option: msgcat Invocation. (line 154)
13741 * --version, msgcmp option: msgcmp Invocation. (line 61)
13742 * --version, msgcomm option: msgcomm Invocation. (line 147)
13743 * --version, msgconv option: msgconv Invocation. (line 123)
13744 * --version, msgen option: msgen Invocation. (line 119)
13745 * --version, msgexec option: msgexec Invocation. (line 71)
13746 * --version, msgfilter option: msgfilter Invocation.
13748 * --version, msgfmt option: msgfmt Invocation. (line 226)
13749 * --version, msggrep option: msggrep Invocation. (line 181)
13750 * --version, msginit option: msginit Invocation. (line 94)
13751 * --version, msgmerge option: msgmerge Invocation. (line 184)
13752 * --version, msgunfmt option: msgunfmt Invocation. (line 157)
13753 * --version, msguniq option: msguniq Invocation. (line 141)
13754 * --version, ngettext option: ngettext Invocation. (line 35)
13755 * --version, xgettext option: xgettext Invocation. (line 323)
13756 * --width, msgattrib option: msgattrib Invocation.
13758 * --width, msgcat option: msgcat Invocation. (line 124)
13759 * --width, msgcomm option: msgcomm Invocation. (line 114)
13760 * --width, msgconv option: msgconv Invocation. (line 93)
13761 * --width, msgen option: msgen Invocation. (line 89)
13762 * --width, msgfilter option: msgfilter Invocation.
13764 * --width, msggrep option: msggrep Invocation. (line 153)
13765 * --width, msginit option: msginit Invocation. (line 73)
13766 * --width, msgmerge option: msgmerge Invocation. (line 154)
13767 * --width, msgunfmt option: msgunfmt Invocation. (line 131)
13768 * --width, msguniq option: msguniq Invocation. (line 111)
13769 * --width, xgettext option: xgettext Invocation. (line 229)
13770 * -<, msgcat option: msgcat Invocation. (line 55)
13771 * -<, msgcomm option: msgcomm Invocation. (line 53)
13772 * ->, msgcat option: msgcat Invocation. (line 60)
13773 * ->, msgcomm option: msgcomm Invocation. (line 58)
13774 * -a, msgfmt option: msgfmt Invocation. (line 209)
13775 * -a, xgettext option: xgettext Invocation. (line 106)
13776 * -c, gettextize option: gettextize Invocation.
13778 * -C, msgfmt option: msgfmt Invocation. (line 183)
13779 * -c, msgfmt option: msgfmt Invocation. (line 146)
13780 * -C, msggrep option: msggrep Invocation. (line 85)
13781 * -C, msgmerge option: msgmerge Invocation. (line 36)
13782 * -c, xgettext option: xgettext Invocation. (line 97)
13783 * -C, xgettext option: xgettext Invocation. (line 64)
13784 * -d, autopoint option: autopoint Invocation.
13786 * -d, gettext option: gettext Invocation. (line 16)
13787 * -d, gettextize option: gettextize Invocation.
13789 * -D, msgattrib option: msgattrib Invocation.
13791 * -D, msgcat option: msgcat Invocation. (line 32)
13792 * -D, msgcmp option: msgcmp Invocation. (line 27)
13793 * -D, msgcomm option: msgcomm Invocation. (line 30)
13794 * -D, msgconv option: msgconv Invocation. (line 19)
13795 * -D, msgen option: msgen Invocation. (line 25)
13796 * -D, msgexec option: msgexec Invocation. (line 42)
13797 * -D, msgfilter option: msgfilter Invocation.
13799 * -d, msgfmt option: msgfmt Invocation. (line 84)
13800 * -D, msgfmt option: msgfmt Invocation. (line 18)
13801 * -D, msggrep option: msggrep Invocation. (line 19)
13802 * -D, msgmerge option: msgmerge Invocation. (line 30)
13803 * -d, msgunfmt option: msgunfmt Invocation. (line 70)
13804 * -d, msguniq option: msguniq Invocation. (line 49)
13805 * -D, msguniq option: msguniq Invocation. (line 26)
13806 * -d, ngettext option: ngettext Invocation. (line 15)
13807 * -d, xgettext option: xgettext Invocation. (line 36)
13808 * -D, xgettext option: xgettext Invocation. (line 24)
13809 * -E, gettext option: gettext Invocation. (line 27)
13810 * -e, gettext option: gettext Invocation. (line 20)
13811 * -e, msgfilter option: msgfilter Invocation.
13813 * -e, msggrep option: msggrep Invocation. (line 97)
13814 * -E, msggrep option: msggrep Invocation. (line 89)
13815 * -E, ngettext option: ngettext Invocation. (line 26)
13816 * -e, ngettext option: ngettext Invocation. (line 19)
13817 * -f, autopoint option: autopoint Invocation.
13819 * -f, gettextize option: gettextize Invocation.
13821 * -F, msgattrib option: msgattrib Invocation.
13823 * -F, msgcat option: msgcat Invocation. (line 142)
13824 * -f, msgcat option: msgcat Invocation. (line 27)
13825 * -F, msgcomm option: msgcomm Invocation. (line 132)
13826 * -f, msgcomm option: msgcomm Invocation. (line 25)
13827 * -F, msgconv option: msgconv Invocation. (line 111)
13828 * -F, msgen option: msgen Invocation. (line 107)
13829 * -F, msgfilter option: msgfilter Invocation.
13831 * -f, msgfilter option: msgfilter Invocation.
13833 * -f, msgfmt option: msgfmt Invocation. (line 199)
13834 * -f, msggrep option: msggrep Invocation. (line 101)
13835 * -F, msggrep option: msggrep Invocation. (line 93)
13836 * -F, msgmerge option: msgmerge Invocation. (line 172)
13837 * -F, msguniq option: msguniq Invocation. (line 129)
13838 * -F, xgettext option: xgettext Invocation. (line 247)
13839 * -f, xgettext option: xgettext Invocation. (line 19)
13840 * -h, envsubst option: envsubst Invocation. (line 22)
13841 * -h, gettext option: gettext Invocation. (line 32)
13842 * -h, msgattrib option: msgattrib Invocation.
13844 * -h, msgcat option: msgcat Invocation. (line 150)
13845 * -h, msgcmp option: msgcmp Invocation. (line 57)
13846 * -h, msgcomm option: msgcomm Invocation. (line 143)
13847 * -h, msgconv option: msgconv Invocation. (line 119)
13848 * -h, msgen option: msgen Invocation. (line 115)
13849 * -h, msgexec option: msgexec Invocation. (line 67)
13850 * -h, msgfilter option: msgfilter Invocation.
13852 * -h, msgfmt option: msgfmt Invocation. (line 222)
13853 * -h, msggrep option: msggrep Invocation. (line 177)
13854 * -h, msginit option: msginit Invocation. (line 90)
13855 * -h, msgmerge option: msgmerge Invocation. (line 180)
13856 * -h, msgunfmt option: msgunfmt Invocation. (line 153)
13857 * -h, msguniq option: msguniq Invocation. (line 137)
13858 * -h, ngettext option: ngettext Invocation. (line 31)
13859 * -h, xgettext option: xgettext Invocation. (line 319)
13860 * -i, msgattrib option: msgattrib Invocation.
13862 * -i, msgcat option: msgcat Invocation. (line 98)
13863 * -i, msgcomm option: msgcomm Invocation. (line 88)
13864 * -i, msgconv option: msgconv Invocation. (line 68)
13865 * -i, msgen option: msgen Invocation. (line 64)
13866 * -i, msgexec option: msgexec Invocation. (line 38)
13867 * -i, msgfilter option: msgfilter Invocation.
13869 * -i, msggrep option: msggrep Invocation. (line 105)
13870 * -i, msginit option: msginit Invocation. (line 16)
13871 * -i, msgmerge option: msgmerge Invocation. (line 129)
13872 * -i, msgunfmt option: msgunfmt Invocation. (line 112)
13873 * -i, msguniq option: msguniq Invocation. (line 85)
13874 * -i, xgettext option: xgettext Invocation. (line 204)
13875 * -j, msgfmt option: msgfmt Invocation. (line 30)
13876 * -j, msgunfmt option: msgunfmt Invocation. (line 16)
13877 * -j, xgettext option: xgettext Invocation. (line 88)
13878 * -K, msggrep option: msggrep Invocation. (line 77)
13879 * -k, xgettext option: xgettext Invocation. (line 114)
13880 * -l, msgfmt option: msgfmt Invocation. (line 79)
13881 * -l, msginit option: msginit Invocation. (line 52)
13882 * -l, msgunfmt option: msgunfmt Invocation. (line 47)
13883 * -L, xgettext option: xgettext Invocation. (line 56)
13884 * -m, msgcmp option: msgcmp Invocation. (line 36)
13885 * -M, msggrep option: msggrep Invocation. (line 73)
13886 * -m, msgmerge option: msgmerge Invocation. (line 101)
13887 * -M, xgettext option: xgettext Invocation. (line 311)
13888 * -m, xgettext option: xgettext Invocation. (line 307)
13889 * -n, gettext option: gettext Invocation. (line 35)
13890 * -n, msgattrib option: msgattrib Invocation.
13892 * -n, msgcat option: msgcat Invocation. (line 105)
13893 * -n, msgcomm option: msgcomm Invocation. (line 95)
13894 * -n, msgfilter option: msgfilter Invocation.
13896 * -N, msggrep option: msggrep Invocation. (line 68)
13897 * -N, msgmerge option: msgmerge Invocation. (line 105)
13898 * -n, msguniq option: msguniq Invocation. (line 92)
13899 * -n, xgettext option: xgettext Invocation. (line 211)
13900 * -o, msgattrib option: msgattrib Invocation.
13902 * -o, msgcat option: msgcat Invocation. (line 44)
13903 * -o, msgcomm option: msgcomm Invocation. (line 42)
13904 * -o, msgconv option: msgconv Invocation. (line 31)
13905 * -o, msgen option: msgen Invocation. (line 37)
13906 * -o, msgfilter option: msgfilter Invocation.
13908 * -o, msgfmt option: msgfmt Invocation. (line 54)
13909 * -o, msggrep option: msggrep Invocation. (line 31)
13910 * -o, msginit option: msginit Invocation. (line 27)
13911 * -o, msgmerge option: msgmerge Invocation. (line 53)
13912 * -o, msgunfmt option: msgunfmt Invocation. (line 98)
13913 * -o, msguniq option: msguniq Invocation. (line 38)
13914 * -o, xgettext option: xgettext Invocation. (line 40)
13915 * -p, msgattrib option: msgattrib Invocation.
13917 * -P, msgattrib option: msgattrib Invocation.
13919 * -p, msgcat option: msgcat Invocation. (line 114)
13920 * -P, msgcat option: msgcat Invocation. (line 74)
13921 * -P, msgcmp option: msgcmp Invocation. (line 44)
13922 * -p, msgcomm option: msgcomm Invocation. (line 104)
13923 * -P, msgcomm option: msgcomm Invocation. (line 72)
13924 * -p, msgconv option: msgconv Invocation. (line 83)
13925 * -P, msgconv option: msgconv Invocation. (line 52)
13926 * -p, msgen option: msgen Invocation. (line 79)
13927 * -P, msgen option: msgen Invocation. (line 48)
13928 * -P, msgexec option: msgexec Invocation. (line 54)
13929 * -p, msgfilter option: msgfilter Invocation.
13931 * -P, msgfilter option: msgfilter Invocation.
13933 * -P, msgfmt option: msgfmt Invocation. (line 133)
13934 * -p, msggrep option: msggrep Invocation. (line 143)
13935 * -P, msggrep option: msggrep Invocation. (line 113)
13936 * -p, msginit option: msginit Invocation. (line 63)
13937 * -P, msginit option: msginit Invocation. (line 39)
13938 * -p, msgmerge option: msgmerge Invocation. (line 144)
13939 * -P, msgmerge option: msgmerge Invocation. (line 113)
13940 * -p, msgunfmt option: msgunfmt Invocation. (line 121)
13941 * -p, msguniq option: msguniq Invocation. (line 101)
13942 * -P, msguniq option: msguniq Invocation. (line 61)
13943 * -p, xgettext option: xgettext Invocation. (line 45)
13944 * -q, msgmerge option: msgmerge Invocation. (line 193)
13945 * -r, msgfmt option: msgfmt Invocation. (line 75)
13946 * -r, msgunfmt option: msgunfmt Invocation. (line 43)
13947 * -s, msgattrib option: msgattrib Invocation.
13949 * -s, msgcat option: msgcat Invocation. (line 137)
13950 * -s, msgcomm option: msgcomm Invocation. (line 127)
13951 * -s, msgconv option: msgconv Invocation. (line 106)
13952 * -s, msgen option: msgen Invocation. (line 102)
13953 * -s, msgfilter option: msgfilter Invocation.
13955 * -s, msgmerge option: msgmerge Invocation. (line 167)
13956 * -s, msgunfmt option: msgunfmt Invocation. (line 144)
13957 * -s, msguniq option: msguniq Invocation. (line 124)
13958 * -s, xgettext option: xgettext Invocation. (line 242)
13959 * -t, msgcat option: msgcat Invocation. (line 87)
13960 * -t, msgconv option: msgconv Invocation. (line 42)
13961 * -T, msggrep option: msggrep Invocation. (line 81)
13962 * -t, msguniq option: msguniq Invocation. (line 74)
13963 * -T, xgettext option: xgettext Invocation. (line 174)
13964 * -u, msgcat option: msgcat Invocation. (line 65)
13965 * -u, msgcomm option: msgcomm Invocation. (line 63)
13966 * -U, msgmerge option: msgmerge Invocation. (line 45)
13967 * -u, msguniq option: msguniq Invocation. (line 53)
13968 * -V, envsubst option: envsubst Invocation. (line 26)
13969 * -v, envsubst option: envsubst Invocation. (line 15)
13970 * -V, gettext option: gettext Invocation. (line 40)
13971 * -V, msgattrib option: msgattrib Invocation.
13973 * -V, msgcat option: msgcat Invocation. (line 154)
13974 * -V, msgcmp option: msgcmp Invocation. (line 61)
13975 * -V, msgcomm option: msgcomm Invocation. (line 147)
13976 * -V, msgconv option: msgconv Invocation. (line 123)
13977 * -V, msgen option: msgen Invocation. (line 119)
13978 * -V, msgexec option: msgexec Invocation. (line 71)
13979 * -V, msgfilter option: msgfilter Invocation.
13981 * -v, msgfmt option: msgfmt Invocation. (line 233)
13982 * -V, msgfmt option: msgfmt Invocation. (line 226)
13983 * -V, msggrep option: msggrep Invocation. (line 181)
13984 * -V, msginit option: msginit Invocation. (line 94)
13985 * -v, msgmerge option: msgmerge Invocation. (line 188)
13986 * -V, msgmerge option: msgmerge Invocation. (line 184)
13987 * -v, msgunfmt option: msgunfmt Invocation. (line 161)
13988 * -V, msgunfmt option: msgunfmt Invocation. (line 157)
13989 * -V, msguniq option: msguniq Invocation. (line 141)
13990 * -V, ngettext option: ngettext Invocation. (line 35)
13991 * -V, xgettext option: xgettext Invocation. (line 323)
13992 * -w, msgattrib option: msgattrib Invocation.
13994 * -w, msgcat option: msgcat Invocation. (line 124)
13995 * -w, msgcomm option: msgcomm Invocation. (line 114)
13996 * -w, msgconv option: msgconv Invocation. (line 93)
13997 * -w, msgen option: msgen Invocation. (line 89)
13998 * -w, msgfilter option: msgfilter Invocation.
14000 * -w, msggrep option: msggrep Invocation. (line 153)
14001 * -w, msginit option: msginit Invocation. (line 73)
14002 * -w, msgmerge option: msgmerge Invocation. (line 154)
14003 * -w, msgunfmt option: msgunfmt Invocation. (line 131)
14004 * -w, msguniq option: msguniq Invocation. (line 111)
14005 * -w, xgettext option: xgettext Invocation. (line 229)
14006 * -x, xgettext option: xgettext Invocation. (line 92)
14009 File: gettext.info, Node: Variable Index, Next: PO Mode Index, Prev: Option Index, Up: Top
14017 * GETTEXT_LOG_UNTRANSLATED, environment variable: Prioritizing messages.
14019 * LANG, environment variable <1>: gettext grok. (line 29)
14020 * LANG, environment variable: End Users. (line 6)
14021 * LANGUAGE, environment variable <1>: po/Makevars. (line 18)
14022 * LANGUAGE, environment variable: gettext grok. (line 25)
14023 * LC_ALL, environment variable: gettext grok. (line 25)
14024 * LC_COLLATE, environment variable: gettext grok. (line 27)
14025 * LC_CTYPE, environment variable: gettext grok. (line 27)
14026 * LC_MESSAGES, environment variable: gettext grok. (line 27)
14027 * LC_MONETARY, environment variable: gettext grok. (line 27)
14028 * LC_NUMERIC, environment variable: gettext grok. (line 27)
14029 * LC_TIME, environment variable: gettext grok. (line 27)
14030 * LINGUAS, environment variable: Installers. (line 17)
14031 * MSGEXEC_LOCATION, environment variable: msgexec Invocation. (line 18)
14032 * MSGEXEC_MSGID, environment variable: msgexec Invocation. (line 18)
14033 * TEXTDOMAIN, environment variable: sh. (line 23)
14034 * TEXTDOMAINDIR, environment variable: sh. (line 26)
14037 File: gettext.info, Node: PO Mode Index, Next: Autoconf Macro Index, Prev: Variable Index, Up: Top
14045 * #, PO Mode command: Modifying Comments. (line 24)
14046 * ,, PO Mode command: Marking. (line 44)
14047 * ., PO Mode command: Entry Positioning. (line 20)
14048 * .emacs customizations: Installation. (line 13)
14049 * 0, PO Mode command: Main PO Commands. (line 40)
14050 * <, PO Mode command: Entry Positioning. (line 29)
14051 * =, PO Mode command: Main PO Commands. (line 47)
14052 * >, PO Mode command: Entry Positioning. (line 32)
14053 * ?, PO Mode command: Main PO Commands. (line 44)
14054 * _, PO Mode command: Main PO Commands. (line 30)
14055 * a, PO Mode command: Auxiliary. (line 40)
14056 * A, PO Mode command: Auxiliary. (line 28)
14057 * a, PO Mode command: Auxiliary. (line 21)
14058 * auxiliary PO file: Auxiliary. (line 13)
14059 * C-c C-a, PO Mode command <1>: Auxiliary. (line 25)
14060 * C-c C-a, PO Mode command: Subedit. (line 17)
14061 * C-c C-c, PO Mode command: Subedit. (line 11)
14062 * C-c C-k, PO Mode command: Subedit. (line 14)
14063 * C-j, PO Mode command: Modifying Translations.
14065 * commands: Main PO Commands. (line 6)
14066 * comment out PO file entry: Obsolete Entries. (line 47)
14067 * consulting program sources: C Sources Context. (line 6)
14068 * consulting translations to other languages: Auxiliary. (line 6)
14069 * current entry of a PO file: Entry Positioning. (line 6)
14070 * cut and paste for translated strings: Modifying Translations.
14072 * DEL, PO Mode command <1>: Obsolete Entries. (line 32)
14073 * DEL, PO Mode command: Fuzzy Entries. (line 60)
14074 * editing comments: Modifying Comments. (line 6)
14075 * editing multiple entries: Subedit. (line 62)
14076 * editing translations: Modifying Translations.
14078 * etags, using for marking strings: Marking. (line 17)
14079 * exiting PO subedit: Subedit. (line 20)
14080 * find source fragment for a PO file entry: C Sources Context.
14082 * h, PO Mode command: Main PO Commands. (line 44)
14083 * installing PO mode: Installation. (line 13)
14084 * K, PO Mode command: Modifying Comments. (line 27)
14085 * k, PO Mode command <1>: Modifying Translations.
14087 * k, PO Mode command: Untranslated Entries.
14089 * LFD, PO Mode command: Modifying Translations.
14091 * looking at the source to aid translation: C Sources Context.
14093 * m, PO Mode command: Entry Positioning. (line 35)
14094 * M-,, PO Mode command: Marking. (line 48)
14095 * M-., PO Mode command: Marking. (line 51)
14096 * M-A, PO Mode command: Auxiliary. (line 32)
14097 * M-S, PO Mode command: C Sources Context. (line 89)
14098 * M-s, PO Mode command: C Sources Context. (line 53)
14099 * M-S, PO Mode command: C Sources Context. (line 49)
14100 * M-s, PO Mode command: C Sources Context. (line 41)
14101 * marking strings for translation: Marking. (line 6)
14102 * moving by fuzzy entries: Fuzzy Entries. (line 24)
14103 * moving by obsolete entries: Obsolete Entries. (line 22)
14104 * moving by translated entries: Translated Entries. (line 12)
14105 * moving by untranslated entries: Untranslated Entries.
14107 * moving through a PO file: Entry Positioning. (line 14)
14108 * n, PO Mode command: Entry Positioning. (line 23)
14109 * next-error, stepping through PO file validation results: Main PO Commands.
14111 * normalize, PO Mode command: Auxiliary. (line 64)
14112 * O, PO Mode command: Obsolete Entries. (line 36)
14113 * o, PO Mode command: Obsolete Entries. (line 36)
14114 * O, PO Mode command: Obsolete Entries. (line 29)
14115 * o, PO Mode command: Obsolete Entries. (line 26)
14116 * obsolete active entry: Obsolete Entries. (line 47)
14117 * p, PO Mode command: Entry Positioning. (line 26)
14118 * pending subedits: Subedit. (line 73)
14119 * po-auto-edit-with-msgid, PO Mode variable: Modifying Translations.
14121 * po-auto-fuzzy-on-edit, PO Mode variable: Translated Entries.
14123 * po-auto-select-on-unfuzzy, PO Mode variable: Fuzzy Entries. (line 44)
14124 * po-confirm-and-quit, PO Mode command: Main PO Commands. (line 62)
14125 * po-consider-as-auxiliary, PO Mode command: Auxiliary. (line 36)
14126 * po-consider-source-path, PO Mode command: C Sources Context.
14128 * po-current-entry, PO Mode command: Entry Positioning. (line 46)
14129 * po-cycle-auxiliary, PO Mode command: Auxiliary. (line 40)
14130 * po-cycle-source-reference, PO Mode command: C Sources Context.
14132 * po-edit-comment, PO Mode command: Modifying Comments. (line 46)
14133 * po-edit-msgstr, PO Mode command: Modifying Translations.
14135 * po-exchange-location, PO Mode command: Entry Positioning. (line 106)
14136 * po-fade-out-entry, PO Mode command <1>: Obsolete Entries. (line 47)
14137 * po-fade-out-entry, PO Mode command: Fuzzy Entries. (line 60)
14138 * po-first-entry, PO Mode command: Entry Positioning. (line 74)
14139 * po-help, PO Mode command: Main PO Commands. (line 83)
14140 * po-ignore-as-auxiliary, PO Mode command: Auxiliary. (line 36)
14141 * po-ignore-source-path, PO Mode command: C Sources Context. (line 89)
14142 * po-kill-comment, PO Mode command: Modifying Comments. (line 60)
14143 * po-kill-msgstr, PO Mode command <1>: Modifying Translations.
14145 * po-kill-msgstr, PO Mode command: Untranslated Entries.
14147 * po-kill-ring-save-comment, PO Mode command: Modifying Comments.
14149 * po-kill-ring-save-msgstr, PO Mode command: Modifying Translations.
14151 * po-last-entry, PO Mode command: Entry Positioning. (line 74)
14152 * po-mark-translatable, PO Mode command: Marking. (line 98)
14153 * po-msgid-to-msgstr, PO Mode command: Modifying Translations.
14155 * po-next-entry, PO Mode command: Entry Positioning. (line 69)
14156 * po-next-fuzzy-entry, PO Mode command: Fuzzy Entries. (line 39)
14157 * po-next-obsolete-entry, PO Mode command: Obsolete Entries. (line 36)
14158 * po-next-translated-entry, PO Mode command: Translated Entries.
14160 * po-next-untranslated-entry, PO Mode command: Untranslated Entries.
14162 * po-normalize, PO Mode command <1>: Normalizing. (line 31)
14163 * po-normalize, PO Mode command: PO Files. (line 192)
14164 * po-other-window, PO Mode command: Main PO Commands. (line 72)
14165 * po-pop-location, PO Mode command: Entry Positioning. (line 92)
14166 * po-previous-entry, PO Mode command: Entry Positioning. (line 69)
14167 * po-previous-fuzzy-entry, PO Mode command: Fuzzy Entries. (line 39)
14168 * po-previous-obsolete-entry, PO Mode command: Obsolete Entries.
14170 * po-previous-translated-entry, PO Mode command: Translated Entries.
14172 * po-previous-untransted-entry, PO Mode command: Untranslated Entries.
14174 * po-push-location, PO Mode command: Entry Positioning. (line 92)
14175 * po-quit, PO Mode command: Main PO Commands. (line 62)
14176 * po-select-auxiliary, PO Mode command: Auxiliary. (line 49)
14177 * po-select-mark-and-mark, PO Mode command: Marking. (line 98)
14178 * po-select-source-reference, PO Mode command: C Sources Context.
14180 * po-statistics, PO Mode command: Main PO Commands. (line 87)
14181 * po-subedit-abort, PO Mode command: Subedit. (line 27)
14182 * po-subedit-cycle-auxiliary, PO Mode command: Subedit. (line 35)
14183 * po-subedit-exit, PO Mode command: Subedit. (line 20)
14184 * po-subedit-mode-hook, PO Mode variable: Modifying Comments. (line 57)
14185 * po-tags-search, PO Mode command: Marking. (line 56)
14186 * po-undo, PO Mode command: Main PO Commands. (line 53)
14187 * po-unfuzzy, PO Mode command: Fuzzy Entries. (line 44)
14188 * po-validate, PO Mode command: Main PO Commands. (line 92)
14189 * po-yank-comment, PO Mode command: Modifying Comments. (line 60)
14190 * po-yank-msgstr, PO Mode command: Modifying Translations.
14192 * q, PO Mode command: Main PO Commands. (line 62)
14193 * Q, PO Mode command: Main PO Commands. (line 62)
14194 * q, PO Mode command: Main PO Commands. (line 36)
14195 * Q, PO Mode command: Main PO Commands. (line 33)
14196 * r, PO Mode command: Entry Positioning. (line 39)
14197 * RET, PO Mode command: Modifying Translations.
14199 * S, PO Mode command: C Sources Context. (line 89)
14200 * s, PO Mode command: C Sources Context. (line 53)
14201 * S, PO Mode command: C Sources Context. (line 45)
14202 * s, PO Mode command: C Sources Context. (line 37)
14203 * starting a string translation: Modifying Translations.
14205 * string normalization in entries: Normalizing. (line 30)
14206 * subedit minor mode: Subedit. (line 6)
14207 * T, PO Mode command: Translated Entries. (line 23)
14208 * t, PO Mode command: Translated Entries. (line 23)
14209 * T, PO Mode command: Translated Entries. (line 19)
14210 * t, PO Mode command: Translated Entries. (line 16)
14211 * TAB, PO Mode command: Fuzzy Entries. (line 36)
14212 * TAGS, and marking translatable strings: Marking. (line 31)
14213 * U, PO Mode command: Untranslated Entries.
14215 * u, PO Mode command: Untranslated Entries.
14217 * U, PO Mode command: Untranslated Entries.
14219 * u, PO Mode command: Untranslated Entries.
14221 * use the source, Luke: C Sources Context. (line 6)
14222 * using obsolete translations to make new entries: Modifying Translations.
14224 * using translation compendia: Compendium. (line 6)
14225 * V, PO Mode command: Main PO Commands. (line 50)
14226 * W, PO Mode command: Modifying Comments. (line 31)
14227 * w, PO Mode command: Modifying Translations.
14229 * x, PO Mode command: Entry Positioning. (line 42)
14230 * Y, PO Mode command: Modifying Comments. (line 35)
14231 * y, PO Mode command: Modifying Translations.
14233 * Z, PO Mode command: Fuzzy Entries. (line 39)
14234 * z, PO Mode command: Fuzzy Entries. (line 39)
14235 * Z, PO Mode command: Fuzzy Entries. (line 33)
14236 * z, PO Mode command: Fuzzy Entries. (line 30)
14239 File: gettext.info, Node: Autoconf Macro Index, Next: Index, Prev: PO Mode Index, Up: Top
14241 Autoconf Macro Index
14242 ********************
14247 * AM_GNU_GETTEXT: AM_GNU_GETTEXT. (line 6)
14248 * AM_GNU_GETTEXT_VERSION: AM_GNU_GETTEXT_VERSION.
14250 * AM_ICONV: AM_ICONV. (line 6)
14251 * AM_PO_SUBDIRS: AM_PO_SUBDIRS. (line 6)
14254 File: gettext.info, Node: Index, Prev: Autoconf Macro Index, Up: Top
14262 * _, a macro to mark strings for translation: Mark Keywords. (line 45)
14263 * _nl_msg_cat_cntr: gettext grok. (line 59)
14264 * ABOUT-NLS file: Matrix. (line 6)
14265 * acconfig.h file: acconfig. (line 6)
14266 * accumulating translations: Creating Compendia. (line 14)
14267 * aclocal.m4 file: aclocal. (line 6)
14268 * adding keywords, xgettext: xgettext Invocation. (line 117)
14269 * ambiguities: Preparing Strings. (line 39)
14270 * apply a filter to translations: msgfilter Invocation.
14272 * apply command to all translations in a catalog: msgexec Invocation.
14274 * Arabic digits: c-format. (line 28)
14275 * attribute manipulation: msgattrib Invocation.
14277 * attribute, fuzzy: Fuzzy Entries. (line 6)
14278 * attributes of a PO file entry: Fuzzy Entries. (line 6)
14279 * attributes, manipulating: Manipulating. (line 56)
14280 * autoconf macros for gettext: autoconf macros. (line 6)
14281 * autopoint program, usage: autopoint Invocation.
14283 * auxiliary PO file: Auxiliary. (line 13)
14284 * available translations: Matrix. (line 6)
14285 * awk: gawk. (line 6)
14286 * awk-format flag: PO Files. (line 133)
14287 * backup old file, and msgmerge program: msgmerge Invocation. (line 65)
14288 * bash: bash. (line 6)
14289 * bibliography: References. (line 6)
14290 * big picture: Overview. (line 6)
14291 * bind_textdomain_codeset: Charset conversion. (line 28)
14292 * bug report address: Introduction. (line 29)
14293 * C and C-like languages: C. (line 6)
14294 * C trigraphs: xgettext Invocation. (line 174)
14296 * C# mode, and msgfmt program: msgfmt Invocation. (line 36)
14297 * C# mode, and msgunfmt program: msgunfmt Invocation. (line 19)
14298 * C# resources mode, and msgfmt program: msgfmt Invocation. (line 40)
14299 * C# resources mode, and msgunfmt program: msgunfmt Invocation.
14301 * C#, string concatenation: Preparing Strings. (line 166)
14302 * c-format flag: PO Files. (line 74)
14303 * c-format, and xgettext: c-format Flag. (line 48)
14304 * catalog encoding and msgexec output: msgexec Invocation. (line 23)
14305 * catclose, a catgets function: Interface to catgets.
14307 * catgets, a catgets function: Interface to catgets.
14309 * catgets, X/Open specification: catgets. (line 6)
14310 * catopen, a catgets function: Interface to catgets.
14312 * character encoding: Aspects. (line 67)
14313 * charset conversion at runtime: Charset conversion. (line 6)
14314 * charset of PO files: Header Entry. (line 65)
14315 * check format strings: msgfmt Invocation. (line 150)
14316 * checking of translations: Manipulating. (line 41)
14317 * clisp: Common Lisp. (line 6)
14318 * clisp C sources: clisp C. (line 6)
14319 * codeset: Aspects. (line 67)
14320 * comments in PO files: PO Files. (line 235)
14321 * Common Lisp: Common Lisp. (line 6)
14322 * compare PO files: msgcmp Invocation. (line 8)
14323 * comparison of interfaces: Comparison. (line 6)
14324 * compatibility with X/Open msgfmt: msgfmt Invocation. (line 183)
14325 * compendium: Compendium. (line 6)
14326 * compendium, creating: Creating Compendia. (line 6)
14327 * concatenate PO files: msgcat Invocation. (line 8)
14328 * concatenating PO files into a compendium: Creating Compendia.
14330 * concatenation of strings: Preparing Strings. (line 115)
14331 * config.h.in file: config.h.in. (line 6)
14332 * convert binary message catalog into PO file: msgunfmt Invocation.
14334 * convert translations to a different encoding: msgconv Invocation.
14336 * converting a package to use gettext: Prerequisites. (line 6)
14337 * country codes: Country Codes. (line 6)
14338 * create new PO file: msginit Invocation. (line 8)
14339 * creating a new PO file: Creating. (line 6)
14340 * creating compendia: Creating Compendia. (line 6)
14341 * csharp-format flag: PO Files. (line 129)
14342 * currency symbols: Aspects. (line 79)
14343 * date format: Aspects. (line 84)
14344 * dcngettext: Plural forms. (line 111)
14345 * debugging messages marked as format strings: xgettext Invocation.
14347 * dialect: Manipulating. (line 28)
14348 * disabling NLS: lib/gettext.h. (line 6)
14349 * distribution tarball: Release Management. (line 6)
14350 * dngettext: Plural forms. (line 103)
14351 * dollar substitution: envsubst Invocation. (line 8)
14352 * domain ambiguities: Ambiguities. (line 6)
14353 * duplicate elimination: Manipulating. (line 45)
14354 * duplicate removal: msguniq Invocation. (line 8)
14355 * editing comments in PO files: Modifying Comments. (line 6)
14356 * editing translations: Modifying Translations.
14358 * elisp-format flag: PO Files. (line 109)
14359 * Emacs Lisp: Emacs Lisp. (line 6)
14360 * encoding: Aspects. (line 67)
14361 * encoding conversion: Manipulating. (line 17)
14362 * encoding conversion at runtime: Charset conversion. (line 6)
14363 * encoding for your language: Header Entry. (line 94)
14364 * encoding list: Header Entry. (line 78)
14365 * encoding of PO files: Header Entry. (line 65)
14366 * environment variables: envsubst Invocation. (line 8)
14367 * envsubst program, usage: envsubst Invocation. (line 6)
14368 * eval_gettext function, usage: eval_gettext Invocation.
14370 * eval_ngettext function, usage: eval_ngettext Invocation.
14372 * evolution of packages: Overview. (line 142)
14373 * extracting parts of a PO file into a compendium: Creating Compendia.
14375 * file format, .mo: MO Files. (line 6)
14376 * file format, .po: PO Files. (line 6)
14377 * files, .po and .mo: Files. (line 6)
14378 * files, .pot: Overview. (line 79)
14379 * filter messages according to attributes: msgattrib Invocation.
14381 * find common messages: msgcomm Invocation. (line 8)
14382 * force use of fuzzy entries: msgfmt Invocation. (line 199)
14383 * format strings: c-format Flag. (line 6)
14384 * Free Pascal: Pascal. (line 6)
14385 * function attribute, __format__: xgettext Invocation. (line 138)
14386 * function attribute, __format_arg__: xgettext Invocation. (line 152)
14387 * fuzzy entries: Fuzzy Entries. (line 6)
14388 * fuzzy flag: PO Files. (line 64)
14389 * gawk: gawk. (line 6)
14390 * gcc-internal-format flag: PO Files. (line 161)
14391 * GCC-source: GCC-source. (line 6)
14392 * generate binary message catalog from PO file: msgfmt Invocation.
14394 * generate translation catalog in English: msgen Invocation. (line 8)
14395 * gettext files: Adjusting Files. (line 6)
14396 * gettext installation: Installation. (line 6)
14397 * gettext interface: Interface to gettext.
14399 * gettext program, usage: gettext Invocation. (line 6)
14400 * gettext vs catgets: Comparison. (line 6)
14401 * gettext, a programmer's view: gettext. (line 6)
14402 * gettext.h file: lib/gettext.h. (line 6)
14403 * gettextize program, usage: gettextize Invocation.
14405 * GUI programs: GUI program problems.
14407 * guile: Scheme. (line 6)
14408 * hash table, inside MO files: MO Files. (line 47)
14409 * he, she, and they: Introduction. (line 11)
14410 * header entry of a PO file: Header Entry. (line 6)
14411 * help option: Preparing Strings. (line 107)
14412 * history of GNU gettext: History. (line 6)
14413 * i18n: Concepts. (line 6)
14414 * importing PO files: Normalizing. (line 55)
14415 * include file libintl.h <1>: lib/gettext.h. (line 29)
14416 * include file libintl.h <2>: Comparison. (line 33)
14417 * include file libintl.h <3>: Sources. (line 19)
14418 * include file libintl.h: Overview. (line 69)
14419 * initialization: Triggering. (line 6)
14420 * initialize new PO file: msginit Invocation. (line 8)
14421 * initialize translations from a compendium: Using Compendia. (line 12)
14422 * installing gettext: Installation. (line 6)
14423 * interface to catgets: Interface to catgets.
14425 * internationalization: Concepts. (line 16)
14426 * inttypes.h: Preparing Strings. (line 131)
14427 * ISO 3166: Country Codes. (line 6)
14428 * ISO 639: Language Codes. (line 6)
14429 * Java: Java. (line 6)
14430 * Java mode, and msgfmt program: msgfmt Invocation. (line 30)
14431 * Java mode, and msgunfmt program: msgunfmt Invocation. (line 16)
14432 * Java, string concatenation: Preparing Strings. (line 166)
14433 * java-format flag: PO Files. (line 125)
14434 * keyboard accelerator checking: msgfmt Invocation. (line 187)
14435 * l10n: Concepts. (line 6)
14436 * language codes: Language Codes. (line 6)
14437 * language selection: End Users. (line 6)
14438 * language selection at runtime: gettext grok. (line 11)
14439 * large package: Ambiguities. (line 6)
14440 * libiconv library: AM_ICONV. (line 21)
14441 * libintl for C#: C#. (line 161)
14442 * libintl for Java: Java. (line 104)
14443 * libintl library: AM_GNU_GETTEXT. (line 48)
14444 * librep Lisp: librep. (line 6)
14445 * librep-format flag: PO Files. (line 113)
14446 * LINGUAS file: po/LINGUAS. (line 6)
14447 * link with libintl: Overview. (line 74)
14448 * Linux <1>: Header Entry. (line 91)
14449 * Linux <2>: Overview. (line 74)
14450 * Linux: Aspects. (line 114)
14451 * Lisp: Common Lisp. (line 6)
14452 * lisp-format flag: PO Files. (line 105)
14453 * list of translation teams, where to find: Header Entry. (line 58)
14454 * locale facet, LC_ALL: Triggering. (line 23)
14455 * locale facet, LC_COLLATE: Triggering. (line 52)
14456 * locale facet, LC_CTYPE <1>: Triggering. (line 23)
14457 * locale facet, LC_CTYPE: Aspects. (line 67)
14458 * locale facet, LC_MESSAGES <1>: Triggering. (line 52)
14459 * locale facet, LC_MESSAGES: Aspects. (line 108)
14460 * locale facet, LC_MONETARY <1>: Triggering. (line 52)
14461 * locale facet, LC_MONETARY: Aspects. (line 79)
14462 * locale facet, LC_NUMERIC <1>: Triggering. (line 52)
14463 * locale facet, LC_NUMERIC: Aspects. (line 94)
14464 * locale facet, LC_RESPONSES: Triggering. (line 52)
14465 * locale facet, LC_TIME <1>: Triggering. (line 52)
14466 * locale facet, LC_TIME: Aspects. (line 84)
14467 * locale facets: Aspects. (line 61)
14468 * locale program: Header Entry. (line 71)
14469 * localization: Concepts. (line 26)
14470 * lookup message translation <1>: eval_gettext Invocation.
14472 * lookup message translation: gettext Invocation. (line 9)
14473 * lookup plural message translation <1>: eval_ngettext Invocation.
14475 * lookup plural message translation: ngettext Invocation. (line 8)
14476 * magic signature of MO files: MO Files. (line 9)
14477 * Makevars file: po/Makevars. (line 6)
14478 * manipulating PO files: Manipulating. (line 6)
14479 * marking Perl sources: Perl. (line 93)
14480 * marking string initializers: Special cases. (line 6)
14481 * marking strings that require translation: Mark Keywords. (line 6)
14482 * marking strings, preparations: Preparing Strings. (line 6)
14483 * marking translatable strings: Overview. (line 46)
14484 * menu entries: GUI program problems.
14486 * menu, keyboard accelerator support: msgfmt Invocation. (line 187)
14487 * merge PO files: msgcat Invocation. (line 8)
14488 * merging two PO files: Manipulating. (line 10)
14489 * message catalog files location: Locating Catalogs. (line 6)
14490 * messages: Aspects. (line 108)
14491 * migration from earlier versions of gettext: Prerequisites. (line 6)
14492 * mkinstalldirs file: mkinstalldirs. (line 6)
14493 * mnemonics of menu entries: msgfmt Invocation. (line 187)
14494 * MO file's format: MO Files. (line 6)
14495 * modify message attrributes: msgattrib Invocation.
14497 * msgattrib program, usage: msgattrib Invocation.
14499 * msgcat program, usage: msgcat Invocation. (line 6)
14500 * msgcmp program, usage: msgcmp Invocation. (line 6)
14501 * msgcomm program, usage: msgcomm Invocation. (line 6)
14502 * msgconv program, usage: msgconv Invocation. (line 6)
14503 * msgen program, usage: msgen Invocation. (line 6)
14504 * msgexec program, usage: msgexec Invocation. (line 6)
14505 * msgfilter filter and catalog encoding: msgfilter Invocation.
14507 * msgfilter program, usage: msgfilter Invocation.
14509 * msgfmt program, usage: msgfmt Invocation. (line 6)
14510 * msggrep program, usage: msggrep Invocation. (line 6)
14511 * msgid: PO Files. (line 40)
14512 * msgid_plural: PO Files. (line 169)
14513 * msginit program, usage: msginit Invocation. (line 6)
14514 * msgmerge program, usage: msgmerge Invocation. (line 6)
14515 * msgstr: PO Files. (line 40)
14516 * msgunfmt program, usage: msgunfmt Invocation. (line 6)
14517 * msguniq program, usage: msguniq Invocation. (line 6)
14518 * multi-line strings: Normalizing. (line 65)
14519 * N_, a convenience macro: Comparison. (line 41)
14520 * Native Language Support: Concepts. (line 51)
14521 * Natural Language Support: Concepts. (line 51)
14522 * newlines in PO files: PO Files. (line 230)
14523 * ngettext: Plural forms. (line 84)
14524 * ngettext program, usage: ngettext Invocation. (line 6)
14525 * NLS: Concepts. (line 51)
14526 * no-awk-format flag: PO Files. (line 134)
14527 * no-c-format flag: PO Files. (line 75)
14528 * no-c-format, and xgettext: c-format Flag. (line 48)
14529 * no-csharp-format flag: PO Files. (line 130)
14530 * no-elisp-format flag: PO Files. (line 110)
14531 * no-gcc-internal-format flag: PO Files. (line 162)
14532 * no-java-format flag: PO Files. (line 126)
14533 * no-librep-format flag: PO Files. (line 114)
14534 * no-lisp-format flag: PO Files. (line 106)
14535 * no-objc-format flag: PO Files. (line 94)
14536 * no-object-pascal-format flag: PO Files. (line 138)
14537 * no-perl-brace-format flag: PO Files. (line 154)
14538 * no-perl-format flag: PO Files. (line 150)
14539 * no-php-format flag: PO Files. (line 158)
14540 * no-python-format flag: PO Files. (line 102)
14541 * no-qt-format flag: PO Files. (line 166)
14542 * no-scheme-format flag: PO Files. (line 118)
14543 * no-sh-format flag: PO Files. (line 98)
14544 * no-smalltalk-format flag: PO Files. (line 122)
14545 * no-tcl-format flag: PO Files. (line 146)
14546 * no-ycp-format flag: PO Files. (line 142)
14547 * nplurals, in a PO file header: Plural forms. (line 128)
14548 * number format: Aspects. (line 94)
14549 * objc-format flag: PO Files. (line 93)
14550 * Object Pascal: Pascal. (line 6)
14551 * object-pascal-format flag: PO Files. (line 137)
14552 * obsolete entries: Obsolete Entries. (line 6)
14553 * optimization of gettext functions: Optimized gettext. (line 6)
14554 * orthography: Manipulating. (line 28)
14555 * outdigits: c-format. (line 28)
14556 * output to stdout, xgettext: xgettext Invocation. (line 48)
14557 * overview of gettext: Overview. (line 6)
14558 * package and version declaration in configure.in: configure.in.
14560 * package build and installation options: Installers. (line 6)
14561 * package maintainer's view of gettext: Maintainers. (line 6)
14562 * paragraphs: Preparing Strings. (line 99)
14563 * Pascal: Pascal. (line 6)
14564 * Perl: Perl. (line 6)
14565 * Perl default keywords: Default Keywords. (line 6)
14566 * Perl invalid string interpolation: Interpolation I. (line 6)
14567 * Perl long lines: Long Lines. (line 6)
14568 * Perl parentheses: Parentheses. (line 6)
14569 * Perl pitfalls: Perl Pitfalls. (line 6)
14570 * Perl quote-like expressions: Quote-like Expressions.
14572 * Perl special keywords for hash-lookups: Special Keywords. (line 6)
14573 * Perl valid string interpolation: Interpolation II. (line 6)
14574 * perl-brace-format flag: PO Files. (line 153)
14575 * perl-format flag: PO Files. (line 149)
14576 * PHP: PHP. (line 6)
14577 * php-format flag: PO Files. (line 157)
14578 * Pike: Pike. (line 6)
14579 * plural form formulas: Plural forms. (line 145)
14580 * plural forms: Plural forms. (line 6)
14581 * plural forms, in MO files: MO Files. (line 63)
14582 * plural forms, in PO files: PO Files. (line 169)
14583 * plural, in a PO file header: Plural forms. (line 128)
14584 * PO files' format: PO Files. (line 6)
14585 * PO mode (Emacs) commands: Main PO Commands. (line 6)
14586 * PO template file: Template. (line 6)
14587 * po_file_domains: libgettextpo. (line 41)
14588 * po_file_free: libgettextpo. (line 36)
14589 * po_file_read: libgettextpo. (line 30)
14590 * po_message_iterator: libgettextpo. (line 50)
14591 * po_message_iterator_free: libgettextpo. (line 57)
14592 * po_message_msgid: libgettextpo. (line 70)
14593 * po_message_msgid_plural: libgettextpo. (line 75)
14594 * po_message_msgstr: libgettextpo. (line 80)
14595 * po_message_msgstr_plural: libgettextpo. (line 86)
14596 * po_next_message: libgettextpo. (line 62)
14597 * portability problems with sed: msgfilter Invocation.
14599 * POTFILES.in file: po/POTFILES.in. (line 6)
14600 * preparing programs for translation: Sources. (line 6)
14601 * preparing shell scripts for translation: Preparing Shell Scripts.
14603 * problems with catgets interface: Problems with catgets.
14605 * programming languages: Language Implementors.
14607 * Python: Python. (line 6)
14608 * python-format flag: PO Files. (line 101)
14609 * Qt format strings: xgettext Invocation. (line 179)
14610 * Qt mode, and msgfmt program: msgfmt Invocation. (line 46)
14611 * qt-format flag: PO Files. (line 165)
14612 * quotation marks <1>: po/Makevars. (line 18)
14613 * quotation marks: Header Entry. (line 145)
14614 * quote characters, use in PO files: Header Entry. (line 145)
14615 * related reading: References. (line 6)
14616 * release: Release Management. (line 6)
14617 * RST: RST. (line 6)
14618 * Scheme: Scheme. (line 6)
14619 * scheme-format flag: PO Files. (line 117)
14620 * scripting languages: Language Implementors.
14622 * search messages in a catalog: msggrep Invocation. (line 8)
14623 * selecting message language: End Users. (line 6)
14624 * sentences: Preparing Strings. (line 42)
14625 * setting up gettext at build time: Installers. (line 6)
14626 * setting up gettext at run time: End Users. (line 6)
14627 * several domains: Ambiguities. (line 6)
14628 * sex: Introduction. (line 11)
14629 * sgettext: GUI program problems.
14631 * sh-format flag: PO Files. (line 97)
14632 * she, he, and they: Introduction. (line 11)
14633 * shell format string: envsubst Invocation. (line 8)
14634 * shell scripts: sh. (line 6)
14635 * Smalltalk: Smalltalk. (line 6)
14636 * smalltalk-format flag: PO Files. (line 121)
14637 * sorting msgcat output: msgcat Invocation. (line 137)
14638 * sorting msgmerge output: msgmerge Invocation. (line 167)
14639 * sorting msgunfmt output: msgunfmt Invocation. (line 144)
14640 * sorting output of xgettext: xgettext Invocation. (line 242)
14641 * specifying plural form in a PO file: Plural forms. (line 128)
14642 * standard output, and msgcat: msgcat Invocation. (line 47)
14643 * standard output, and msgmerge program: msgmerge Invocation. (line 56)
14644 * string concatenation: Preparing Strings. (line 115)
14645 * string normalization in entries: Normalizing. (line 6)
14646 * style: Preparing Strings. (line 22)
14647 * supported languages, xgettext: xgettext Invocation. (line 56)
14648 * Tcl: Tcl. (line 6)
14649 * Tcl mode, and msgfmt program: msgfmt Invocation. (line 43)
14650 * Tcl mode, and msgunfmt program: msgunfmt Invocation. (line 26)
14651 * tcl-format flag: PO Files. (line 145)
14652 * template PO file: Overview. (line 79)
14653 * testing .po files for equivalence: xgettext Invocation. (line 252)
14654 * Tk's scripting language: Tcl. (line 6)
14655 * translated entries: Translated Entries. (line 6)
14656 * translating menu entries: GUI program problems.
14658 * translation aspects: Aspects. (line 6)
14659 * Translation Matrix: Matrix. (line 6)
14660 * Translation Project: Why. (line 17)
14661 * turning off NLS support: lib/gettext.h. (line 6)
14662 * tutorial of gettext usage: Overview. (line 6)
14663 * unify duplicate translations: msguniq Invocation. (line 8)
14664 * untranslated entries: Untranslated Entries.
14666 * update translations from a compendium: Using Compendia. (line 20)
14667 * upgrading to new versions of gettext: Prerequisites. (line 6)
14668 * version control for backup files, msgmerge: msgmerge Invocation.
14670 * wxWindows library: wxWindows. (line 6)
14671 * xargs, and output from msgexec: msgexec Invocation. (line 14)
14672 * xgettext program, usage: xgettext Invocation. (line 6)
14673 * xmodmap program, and typing quotation marks: Header Entry. (line 157)
14674 * YaST2 scripting language: YCP. (line 6)
14675 * YCP: YCP. (line 6)
14676 * ycp-format flag: PO Files. (line 141)
14682 Node: Introduction
\x7f15060
14684 Ref: Why-Footnote-1
\x7f20034
14685 Node: Concepts
\x7f20190
14686 Node: Aspects
\x7f23608
14687 Node: Files
\x7f29466
14688 Node: Overview
\x7f31372
14689 Node: Basics
\x7f42169
14690 Node: Installation
\x7f43000
14691 Node: PO Files
\x7f44947
14692 Ref: PO Files-Footnote-1
\x7f54373
14693 Node: Main PO Commands
\x7f54500
14694 Node: Entry Positioning
\x7f59576
14695 Node: Normalizing
\x7f65037
14696 Node: Sources
\x7f69496
14697 Node: Triggering
\x7f71194
14698 Node: Preparing Strings
\x7f74229
14699 Node: Mark Keywords
\x7f81934
14700 Node: Marking
\x7f85494
14701 Node: c-format Flag
\x7f93221
14702 Node: Special cases
\x7f97137
14703 Node: Names
\x7f99863
14704 Node: Libraries
\x7f103464
14705 Node: Template
\x7f106495
14706 Node: xgettext Invocation
\x7f107216
14707 Node: Creating
\x7f118812
14708 Node: msginit Invocation
\x7f119694
14709 Node: Header Entry
\x7f122320
14710 Node: Updating
\x7f129325
14711 Node: msgmerge Invocation
\x7f130084
14712 Node: Translated Entries
\x7f135125
14713 Node: Fuzzy Entries
\x7f136485
14714 Node: Untranslated Entries
\x7f139659
14715 Node: Obsolete Entries
\x7f141585
14716 Node: Modifying Translations
\x7f144804
14717 Node: Modifying Comments
\x7f152767
14718 Node: Subedit
\x7f157186
14719 Node: C Sources Context
\x7f161074
14720 Node: Auxiliary
\x7f166190
14721 Node: Compendium
\x7f169423
14722 Node: Creating Compendia
\x7f170040
14723 Node: Using Compendia
\x7f172520
14724 Node: Manipulating
\x7f173449
14725 Node: msgcat Invocation
\x7f177212
14726 Node: msgconv Invocation
\x7f181462
14727 Node: msggrep Invocation
\x7f184641
14728 Node: msgfilter Invocation
\x7f189412
14729 Node: msguniq Invocation
\x7f194291
14730 Node: msgcomm Invocation
\x7f198180
14731 Node: msgcmp Invocation
\x7f202225
14732 Node: msgattrib Invocation
\x7f203837
14733 Node: msgen Invocation
\x7f208432
14734 Node: msgexec Invocation
\x7f211767
14735 Node: libgettextpo
\x7f214214
14736 Node: Binaries
\x7f219336
14737 Node: msgfmt Invocation
\x7f219672
14738 Node: msgunfmt Invocation
\x7f226655
14739 Node: MO Files
\x7f230799
14740 Node: Users
\x7f238895
14741 Node: Matrix
\x7f240379
14742 Node: Installers
\x7f241588
14743 Node: End Users
\x7f242763
14744 Node: Programmers
\x7f243416
14745 Node: catgets
\x7f244592
14746 Node: Interface to catgets
\x7f246002
14747 Node: Problems with catgets
\x7f248008
14748 Node: gettext
\x7f248920
14749 Node: Interface to gettext
\x7f250426
14750 Node: Ambiguities
\x7f252783
14751 Node: Locating Catalogs
\x7f255487
14752 Ref: Locating Catalogs-Footnote-1
\x7f256645
14753 Ref: Locating Catalogs-Footnote-2
\x7f256870
14754 Node: Charset conversion
\x7f257019
14755 Node: Plural forms
\x7f259474
14756 Ref: Plural forms-Footnote-1
\x7f270380
14757 Node: GUI program problems
\x7f270472
14758 Node: Optimized gettext
\x7f275587
14759 Node: Comparison
\x7f276931
14760 Node: Using libintl.a
\x7f281198
14761 Node: gettext grok
\x7f281638
14762 Node: Temp Programmers
\x7f284189
14763 Node: Temp Implementations
\x7f284639
14764 Node: Temp catgets
\x7f286016
14765 Node: Temp WSI
\x7f287714
14766 Node: Temp Notes
\x7f289713
14767 Node: Translators
\x7f290213
14768 Node: Trans Intro 0
\x7f290676
14769 Node: Trans Intro 1
\x7f293332
14770 Node: Discussions
\x7f295203
14771 Node: Organization
\x7f298780
14772 Node: Central Coordination
\x7f300768
14773 Node: National Teams
\x7f301907
14774 Node: Sub-Cultures
\x7f304431
14775 Node: Organizational Ideas
\x7f305365
14776 Node: Mailing Lists
\x7f306383
14777 Node: Information Flow
\x7f308197
14778 Node: Prioritizing messages
\x7f310367
14779 Node: Maintainers
\x7f314638
14780 Node: Flat and Non-Flat
\x7f316602
14781 Node: Prerequisites
\x7f318092
14782 Node: gettextize Invocation
\x7f322239
14783 Node: Adjusting Files
\x7f328953
14784 Node: po/POTFILES.in
\x7f330677
14785 Node: po/LINGUAS
\x7f331923
14786 Node: po/Makevars
\x7f333612
14787 Node: configure.in
\x7f335203
14788 Node: config.guess
\x7f337306
14789 Node: mkinstalldirs
\x7f338675
14790 Node: aclocal
\x7f339447
14791 Node: acconfig
\x7f341240
14792 Node: config.h.in
\x7f341737
14793 Node: Makefile
\x7f343200
14794 Node: src/Makefile
\x7f345794
14795 Node: lib/gettext.h
\x7f350181
14796 Node: autoconf macros
\x7f352427
14797 Node: AM_GNU_GETTEXT
\x7f353061
14798 Node: AM_GNU_GETTEXT_VERSION
\x7f356655
14799 Node: AM_PO_SUBDIRS
\x7f357101
14800 Node: AM_ICONV
\x7f357879
14801 Node: CVS Issues
\x7f360086
14802 Node: Distributed CVS
\x7f360674
14803 Node: Files under CVS
\x7f362599
14804 Node: autopoint Invocation
\x7f365872
14805 Node: Release Management
\x7f367716
14806 Node: Programming Languages
\x7f368226
14807 Node: Language Implementors
\x7f369050
14808 Node: Programmers for other Languages
\x7f373839
14809 Node: Translators for other Languages
\x7f374412
14810 Node: c-format
\x7f375885
14811 Node: objc-format
\x7f377599
14812 Node: sh-format
\x7f377951
14813 Node: python-format
\x7f378753
14814 Node: lisp-format
\x7f379191
14815 Node: elisp-format
\x7f379517
14816 Node: librep-format
\x7f380007
14817 Node: scheme-format
\x7f380407
14818 Node: smalltalk-format
\x7f380683
14819 Node: java-format
\x7f381183
14820 Node: csharp-format
\x7f381631
14821 Node: awk-format
\x7f382006
14822 Node: object-pascal-format
\x7f382331
14823 Node: ycp-format
\x7f382560
14824 Node: tcl-format
\x7f382959
14825 Node: perl-format
\x7f383254
14826 Node: php-format
\x7f383999
14827 Node: gcc-internal-format
\x7f384364
14828 Node: qt-format
\x7f385406
14829 Node: Maintainers for other Languages
\x7f385819
14830 Node: List of Programming Languages
\x7f387054
14833 Node: Preparing Shell Scripts
\x7f390888
14834 Node: gettext.sh
\x7f394277
14835 Node: gettext Invocation
\x7f394824
14836 Node: ngettext Invocation
\x7f396579
14837 Node: envsubst Invocation
\x7f398167
14838 Node: eval_gettext Invocation
\x7f399588
14839 Node: eval_ngettext Invocation
\x7f400049
14840 Node: bash
\x7f400563
14841 Node: Python
\x7f402539
14842 Node: Common Lisp
\x7f403689
14843 Node: clisp C
\x7f404489
14844 Node: Emacs Lisp
\x7f405204
14845 Node: librep
\x7f405930
14846 Node: Scheme
\x7f406665
14847 Node: Smalltalk
\x7f407449
14848 Node: Java
\x7f408483
14850 Node: gawk
\x7f421919
14851 Node: Pascal
\x7f422831
14852 Node: wxWindows
\x7f424139
14853 Node: YCP
\x7f424889
14854 Node: Tcl
\x7f425628
14855 Node: Perl
\x7f427038
14856 Node: General Problems
\x7f430046
14857 Node: Default Keywords
\x7f433704
14858 Node: Special Keywords
\x7f434656
14859 Node: Quote-like Expressions
\x7f436170
14860 Node: Interpolation I
\x7f438445
14861 Node: Interpolation II
\x7f442235
14862 Node: Parentheses
\x7f444600
14863 Node: Long Lines
\x7f446117
14864 Node: Perl Pitfalls
\x7f447964
14865 Node: PHP
\x7f452206
14866 Node: Pike
\x7f453137
14867 Node: GCC-source
\x7f453798
14868 Node: List of Data Formats
\x7f454545
14869 Node: POT
\x7f455011
14870 Node: RST
\x7f455269
14871 Node: Glade
\x7f455495
14872 Node: Conclusion
\x7f455855
14873 Node: History
\x7f456358
14874 Node: References
\x7f460624
14875 Node: Language Codes
\x7f462190
14876 Node: Country Codes
\x7f466536
14877 Node: Program Index
\x7f472293
14878 Node: Option Index
\x7f474111
14879 Node: Variable Index
\x7f519612
14880 Node: PO Mode Index
\x7f521077
14881 Node: Autoconf Macro Index
\x7f534986
14882 Node: Index
\x7f535505