diff options
Diffstat (limited to 'doc/gettext.info-7')
-rw-r--r-- | doc/gettext.info-7 | 1064 |
1 files changed, 358 insertions, 706 deletions
diff --git a/doc/gettext.info-7 b/doc/gettext.info-7 index 38e7987..60103d8 100644 --- a/doc/gettext.info-7 +++ b/doc/gettext.info-7 @@ -36,10 +36,33 @@ File: gettext.info, Node: gettextize Invocation, Next: Adjusting Files, Prev: Invoking the `gettextize' Program ================================= - Some files are consistently and identically needed in every package -internationalized through GNU `gettext'. As a matter of convenience, -the `gettextize' program puts all these files right in your package. -This program has the following synopsis: + The `gettextize' program is an interactive tool that helps the +maintainer of a package internationalized through GNU `gettext'. It is +used for two purposes: + + * As a wizard, when a package is modified to use GNU `gettext' for + the first time. + + * As a migration tool, for upgrading the GNU `gettext' support in a + package from a previous to a newer version of GNU `gettext'. + + This program performs the following tasks: + + * It copies into the package some files that are consistently and + identically needed in every package internationalized through GNU + `gettext'. + + * It performs as many of the tasks mentioned in the next section + *Note Adjusting Files:: as can be performed automatically. + + * It removes obsolete files and idioms used for previous GNU + `gettext' versions to the form recommended for the current GNU + `gettext' version. + + * It prints a summary of the tasks that ought to be done manually + and could not be done automatically by `gettextize'. + + It can be invoked as follows: gettextize [ OPTION... ] [ DIRECTORY ] @@ -67,9 +90,15 @@ and accepts the following options: `--no-changelog' Don't update or create ChangeLog files. By default, `gettextize' - logs all changes (file additions, modifications ans removals) in a + logs all changes (file additions, modifications and removals) in a file called `ChangeLog' in each affected directory. +`-n' +`--dry-run' + Print modifications but don't perform them. All actions that + `gettextize' would normally execute are inhibited and instead only + listed on standard output. + `--help' Display this help and exit. @@ -95,7 +124,7 @@ specified. 2. A `po/' directory is created for eventually holding all translation files, but initially only containing the file - `po/Makefile.in.in' from the GNU `gettext' distribution. (beware + `po/Makefile.in.in' from the GNU `gettext' distribution (beware the double `.in' in the file name) and a few auxiliary files. If the `po/' directory already exists, it will be preserved along with the files it contains, and only `Makefile.in.in' and the @@ -107,10 +136,13 @@ specified. option `--force' (`-f') is given, the `intl/' directory is emptied first. - 4. The `config.rpath' file is copied into the directory containing - configuration support files. It is needed by the `AM_GNU_GETTEXT' - autoconf macro. + 4. The files `config.rpath' and `mkinstalldirs' are copied into the + directory containing configuration support files. It is needed by + the `AM_GNU_GETTEXT' autoconf macro. + 5. Only if the project is using GNU `automake': A set of `autoconf' + macro files is copied into the package's `autoconf' macro + repository, usually in a directory called `m4/'. If your site support symbolic links, `gettextize' will not actually copy the files into your package, but establish symbolic links instead. @@ -120,14 +152,35 @@ distribution will resolve each link by an actual copy in the distribution archive. So, to insist, you really should use `-h' option with `tar' within your `dist' goal of your main `Makefile.in'. + Furthermore, `gettextize' will update all `Makefile.am' files in +each affected directory, as well as the top level `configure.in' or +`configure.ac' file. + It is interesting to understand that most new files for supporting -GNU `gettext' facilities in one package go in `intl/' and `po/' -subdirectories. One distinction between these two directories is that -`intl/' is meant to be completely identical in all packages using GNU -`gettext', while all newly created files, which have to be different, -go into `po/'. There is a common `Makefile.in.in' in `po/', because -the `po/' directory needs its own `Makefile', and it has been designed -so it can be identical in all packages. +GNU `gettext' facilities in one package go in `intl/', `po/' and `m4/' +subdirectories. One distinction between `intl/' and the two other +directories is that `intl/' is meant to be completely identical in all +packages using GNU `gettext', while the other directories will mostly +contain package dependent files. + + The `gettextize' program makes backup files for all files it +replaces or changes, and also write ChangeLog entries about these +changes. This way, the careful maintainer can check after running +`gettextize' whether its changes are acceptable to him, and possibly +adjust them. An exception to this rule is the `intl/' directory, which +is added or replaced or removed as a whole. + + It is important to understand that `gettextize' can not do the +entire job of adapting a package for using GNU `gettext'. The amount +of remaining work depends on whether the package uses GNU `automake' or +not. But in any case, the maintainer should still read the section +*Note Adjusting Files:: after invoking `gettextize'. + + It is also important to understand that `gettextize' is not part of +the GNU build system, in the sense that it should not be invoked +automatically, and not be invoked by someone who doesn't assume the +responsibilities of a package maintainer. For the latter purpose, a +separate tool is provided, see *Note autopoint Invocation::. File: gettext.info, Node: Adjusting Files, Next: autoconf macros, Prev: gettextize Invocation, Up: Maintainers @@ -144,7 +197,7 @@ each. So, here comes a list of files, each one followed by a description of all alterations it needs. Many examples are taken out from the GNU -`gettext' 0.11.2 distribution itself, or from the GNU `hello' +`gettext' 0.11.3 distribution itself, or from the GNU `hello' distribution (`http://www.franken.de/users/gnu/ke/hello' or `http://www.gnu.franken.de/ke/hello/') You may indeed refer to the source code of the GNU `gettext' and GNU `hello' packages, as they are @@ -157,8 +210,10 @@ intended to be good examples for using GNU gettext functionality. * po/Makevars:: `Makefile' pieces in `po/' * configure.in:: `configure.in' at top level * config.guess:: `config.guess', `config.sub' at top level +* mkinstalldirs:: `mkinstalldirs' at top level * aclocal:: `aclocal.m4' at top level * acconfig:: `acconfig.h' at top level +* config.h.in:: `config.h.in' at top level * Makefile:: `Makefile.in' at top level * src/Makefile:: `Makefile.in' in `src/' * lib/gettext.h:: `gettext.h' in `lib/' @@ -262,7 +317,7 @@ File: gettext.info, Node: configure.in, Next: config.guess, Prev: po/Makevars This is done by a set of lines like these: PACKAGE=gettext - VERSION=0.11.2 + VERSION=0.11.3 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") AC_DEFINE_UNQUOTED(VERSION, "$VERSION") AC_SUBST(PACKAGE) @@ -270,12 +325,12 @@ File: gettext.info, Node: configure.in, Next: config.guess, Prev: po/Makevars or, if you are using GNU `automake', by a line like this: - AM_INIT_AUTOMAKE(gettext, 0.11.2) + AM_INIT_AUTOMAKE(gettext, 0.11.3) Of course, you replace `gettext' with the name of your package, - and `0.11.2' by its version numbers, exactly as they should appear + and `0.11.3' by its version numbers, exactly as they should appear in the packaged `tar' file name of your distribution - (`gettext-0.11.2.tar.gz', here). + (`gettext-0.11.3.tar.gz', here). 2. Check for internationalization support. @@ -311,7 +366,7 @@ File: gettext.info, Node: configure.in, Next: config.guess, Prev: po/Makevars -File: gettext.info, Node: config.guess, Next: aclocal, Prev: configure.in, Up: Adjusting Files +File: gettext.info, Node: config.guess, Next: mkinstalldirs, Prev: configure.in, Up: Adjusting Files `config.guess', `config.sub' at top level ----------------------------------------- @@ -336,7 +391,26 @@ following line to your `configure.in'. AC_CONFIG_AUX_DIR([SUBDIR]) -File: gettext.info, Node: aclocal, Next: acconfig, Prev: config.guess, Up: Adjusting Files +File: gettext.info, Node: mkinstalldirs, Next: aclocal, Prev: config.guess, Up: Adjusting Files + +`mkinstalldirs' at top level +---------------------------- + + If `gettextize' has not already done it, you need to add the GNU +`mkinstalldirs' script to your distribution. It is needed because +`mkdir -p' is not portable enough. You find this script in the GNU +`automake' distribution. + + Normally, `mkinstalldirs' is put at the top level of a distribution. +But it is also possible to put it in a subdirectory, altogether with +other configuration support files like `install-sh', `ltconfig', +`ltmain.sh' or `missing'. All you need to do, other than moving the +files, is to add the following line to your `configure.in'. + + AC_CONFIG_AUX_DIR([SUBDIR]) + + +File: gettext.info, Node: aclocal, Next: acconfig, Prev: mkinstalldirs, Up: Adjusting Files `aclocal.m4' at top level ------------------------- @@ -370,7 +444,7 @@ might be integrated in the standard Autoconf set, because this piece of `m4' code will be the same for all projects using GNU `gettext'. -File: gettext.info, Node: acconfig, Next: Makefile, Prev: aclocal, Up: Adjusting Files +File: gettext.info, Node: acconfig, Next: config.h.in, Prev: aclocal, Up: Adjusting Files `acconfig.h' at top level ------------------------- @@ -382,7 +456,36 @@ any more; you can remove them from your `acconfig.h' file unless your package uses them independently from the `intl/' directory. -File: gettext.info, Node: Makefile, Next: src/Makefile, Prev: acconfig, Up: Adjusting Files +File: gettext.info, Node: config.h.in, Next: Makefile, Prev: acconfig, Up: Adjusting Files + +`config.h.in' at top level +-------------------------- + + The include file template that holds the C macros to be defined by +`configure' is usually called `config.h.in' and may be maintained +either manually or automatically. + + If it is maintained automatically, by use of the `autoheader' +program, you need to do nothing about it. This is the case in +particular if you are using GNU `automake'. + + If it is maintained manually, and if `gettextize' has created an +`intl/' directory, you should switch to using `autoheader'. The list +of C macros to be added for the sake of the `intl/' directory is just +too long to be maintained manually; it also changes between different +versions of GNU `gettext'. + + If it is maintained manually, and if on the other hand you have +suppressed the `intl/' directory by calling `gettextize' without +`--intl' option, then you can get away by adding the following lines to +`config.h.in': + + /* Define to 1 if translation of program messages to the user's + native language is requested. */ + #undef ENABLE_NLS + + +File: gettext.info, Node: Makefile, Next: src/Makefile, Prev: config.h.in, Up: Adjusting Files `Makefile.in' at top level -------------------------- @@ -400,7 +503,7 @@ File: gettext.info, Node: Makefile, Next: src/Makefile, Prev: acconfig, Up: gets distributed. 3. Wherever you process subdirectories in your `Makefile.in', be sure - you also process dir subdirectories `intl' and `po'. Special + you also process the subdirectories `intl' and `po'. Special rules in the `Makefiles' take care for the case where no internationalization is wanted. @@ -480,6 +583,7 @@ modifications needed in `src/Makefile.in': `bindtextdomain' (see *note Triggering::), like this: bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); To make LOCALEDIR known to the program, add the following lines to Makefile.in: @@ -577,7 +681,7 @@ packages, it can go into the `src' directory. package that needs it should contain a copy of it on its own. -File: gettext.info, Node: autoconf macros, Prev: Adjusting Files, Up: Maintainers +File: gettext.info, Node: autoconf macros, Next: CVS Issues, Prev: Adjusting Files, Up: Maintainers Autoconf macros for use in `configure.in' ========================================= @@ -589,10 +693,11 @@ macro is, of course, `AM_GNU_GETTEXT'. * Menu: * AM_GNU_GETTEXT:: AM_GNU_GETTEXT in `gettext.m4' +* AM_GNU_GETTEXT_VERSION:: AM_GNU_GETTEXT_VERSION in `gettext.m4' * AM_ICONV:: AM_ICONV in `iconv.m4' -File: gettext.info, Node: AM_GNU_GETTEXT, Next: AM_ICONV, Prev: autoconf macros, Up: autoconf macros +File: gettext.info, Node: AM_GNU_GETTEXT, Next: AM_GNU_GETTEXT_VERSION, Prev: autoconf macros, Up: autoconf macros AM_GNU_GETTEXT in `gettext.m4' ------------------------------ @@ -661,7 +766,19 @@ empty and doesn't change `CPPFLAGS'. `LTLIBINTL' variables. -File: gettext.info, Node: AM_ICONV, Prev: AM_GNU_GETTEXT, Up: autoconf macros +File: gettext.info, Node: AM_GNU_GETTEXT_VERSION, Next: AM_ICONV, Prev: AM_GNU_GETTEXT, Up: autoconf macros + +AM_GNU_GETTEXT_VERSION in `gettext.m4' +-------------------------------------- + + The `AM_GNU_GETTEXT_VERSION' macro declares the version number of +the GNU gettext infrastructure that is used by the package. + + The use of this macro is optional; only the `autopoint' program makes +use of it (*note CVS Issues::). + + +File: gettext.info, Node: AM_ICONV, Prev: AM_GNU_GETTEXT_VERSION, Up: autoconf macros AM_ICONV in `iconv.m4' ---------------------- @@ -706,6 +823,170 @@ for use without libtool, `LTLIBICONV' for use with libtool); it adds an `gettext.m4' relies on it. +File: gettext.info, Node: CVS Issues, Prev: autoconf macros, Up: Maintainers + +Integrating with CVS +==================== + + Many projects use CVS for distributed development, version control +and source backup. This section gives some advice how to manage the +uses of `cvs', `gettextize', `autopoint' and `autoconf'. + +* Menu: + +* Distributed CVS:: Avoiding version mismatch in distributed development +* Files under CVS:: Files to put under CVS version control +* autopoint Invocation:: Invoking the `autopoint' Program + + +File: gettext.info, Node: Distributed CVS, Next: Files under CVS, Prev: CVS Issues, Up: CVS Issues + +Avoiding version mismatch in distributed development +---------------------------------------------------- + + In a project development with multiple developers, using CVS, there +should be a single developer who occasionally - when there is desire to +upgrade to a new `gettext' version - runs `gettextize' and performs the +changes listed in *Note Adjusting Files::, and then commits his changes +to the CVS. + + It is highly recommended that all developers on a project use the +same version of GNU `gettext' in the package. In other words, if a +developer runs `gettextize', he should go the whole way, make the +necessary remaining changes and commit his changes to the CVS. +Otherwise the following damages will likely occur: + + * Apparent version mismatch between developers. Since some `gettext' + specific portions in `configure.in', `configure.ac' and + `Makefile.am', `Makefile.in' files depend on the `gettext' + version, the use of infrastructure files belonging to different + `gettext' versions can easily lead to build errors. + + * Hidden version mismatch. Such version mismatch can also lead to + malfunctioning of the package, that may be undiscovered by the + developers. The worst case of hidden version mismatch is that + internationalization of the package doesn't work at all. + + * Release risks. All developers implicitly perform constant testing + on a package. This is important in the days and weeks before a + release. If the guy who makes the release tar files uses a + different version of GNU `gettext' than the other developers, the + distribution will be less well tested than if all had been using + the same `gettext' version. For example, it is possible that a + platform specific bug goes undiscovered due to this constellation. + + +File: gettext.info, Node: Files under CVS, Next: autopoint Invocation, Prev: Distributed CVS, Up: CVS Issues + +Files to put under CVS version control +-------------------------------------- + + There are basically three ways to deal with generated files in the +context of a CVS repository, such as `configure' generated from +`configure.in', `PARSER.c' generated from `PARSER.y', or +`po/Makefile.in.in' autoinstalled by `gettextize' or `autopoint'. + + 1. All generated files are always committed into the repository. + + 2. All generated files are committed into the repository occasionally, + for example each time a release is made. + + 3. Generated files are never committed into the repository. + + Each of these three approaches has different advantages and +drawbacks. + + 1. The advantage is that anyone can check out the CVS at any moment + and gets a working build. The drawbacks are: 1a. It requires + some frequent "cvs commit" actions by the maintainers. 1b. The + reposity grows in size quite fast. + + 2. The advantage is that anyone can check out the CVS, and the usual + "./configure; make" will work. The drawbacks are: 2a. The one who + checks out the repository needs tools like GNU `automake', GNU + `autoconf', GNU `m4' installed in his PATH; sometimes he even + needs particular versions of them. 2b. When a release is made and + a commit is made on the generated files, the other developers get + conflicts on the generated files after doing "cvs update". + Although these conflicts are easy to resolve, they are annoying. + + 3. The advantage is less work for the maintainers. The drawback is + that anyone who checks out the CVS not only needs tools like GNU + `automake', GNU `autoconf', GNU `m4' installed in his PATH, but + also that he needs to perform a package specific pre-build step + before being able to "./configure; make". + + For the first and second approach, all files modified or brought in +by the occasional `gettextize' invocation and update should be +committed into the CVS. + + For the third approach, the maintainer can omit from the CVS +repository all the files that `gettextize' mentions as "copy". +Instead, he adds to the `configure.in' or `configure.ac' a line of the +form + + GETTEXT_VERSION=0.11.3 + +and adds to the package's pre-build script an invocation of +`autopoint'. For everyone who checks out the CVS, this `autopoint' +invocation will copy into the right place the `gettext' infrastructure +files that have been omitted from the CVS. + + +File: gettext.info, Node: autopoint Invocation, Prev: Files under CVS, Up: CVS Issues + +Invoking the `autopoint' Program +-------------------------------- + + autopoint [OPTION]... + + The `autopoint' program copies standard gettext infrastructure files +into a source package. It extracts from a macro call of the form +`AM_GNU_GETTEXT_VERSION(VERSION)', found in the package's +`configure.in' or `configure.ac' file, the gettext version used by the +package, and copies the infrastructure files belonging to this version +into the package. + +Options +....... + +`-f' +`--force' + Force overwriting of files that already exist. + +`-n' +`--dry-run' + Print modifications but don't perform them. All file copying + actions that `autopoint' would normally execute are inhibited and + instead only listed on standard output. + +Informative output +.................. + +`--help' + Display this help and exit. + +`--version' + Output version information and exit. + + `autopoint' supports the GNU `gettext' versions from 0.10.35 to the +current one, 0.11.3. In order to apply `autopoint' to a package using +a `gettext' version newer than 0.11.3, you need to install this same +version of GNU `gettext' at least. + + In packages using GNU `automake', an invocation of `autopoint' +should be followed by invocations of `aclocal' and then `autoconf' and +`autoheader'. The reason is that `autopoint' installs some autoconf +macro files, which are used by `aclocal' to create `aclocal.m4', and +the latter is used by `autoconf' to create the package's `configure' +script and by `autoheader' to create the package's `config.h.in' +include file template. + + The name `autopoint' is an abbreviation of `auto-po-intl-m4'; the +tool copies or updates mostly files in the `po', `intl', `m4' +directories. + + File: gettext.info, Node: Programming Languages, Next: Conclusion, Prev: Maintainers, Up: Top Other Programming Languages @@ -782,7 +1063,7 @@ means the following: number or a name. This is needed because for some languages and some messages with more than one substitutable argument, the translation will need to output the substituted arguments in - different order. *Note c-format::. + different order. *Note c-format Flag::. 8. If the language has more than one implementation, and not all of the implementations use `gettext', but the programs should be @@ -842,703 +1123,74 @@ difference is that when translating format strings, she has to be aware of the language's particular syntax for positional arguments in format strings. - -File: gettext.info, Node: Maintainers for other Languages, Next: List of Programming Languages, Prev: Translators for other Languages, Up: Programming Languages - -The Maintainer's View -===================== - - For the maintainer, the general procedure differs from the C language -case in two ways. - - * For those languages that don't use GNU gettext, the `intl/' - directory is not needed and can be omitted. This means that the - maintainer calls the `gettextize' program without the `--intl' - option, and that he invokes the `AM_GNU_GETTEXT' autoconf macro via - `AM_GNU_GETTEXT([external])'. - - * If only a single programming language is used, the - `XGETTEXT_OPTIONS' variable in `po/Makevars' (*note po/Makevars::) - should be adjusted to match the `xgettext' options for that - particular programming language. If the package uses more than - one programming language with `gettext' support, it becomes - necessary to change the POT file construction rule in - `po/Makefile.in.in'. It is recommended to make one `xgettext' - invocation per programming language, each with the options - appropriate for that language, and to combine the resulting files - using `msgcat'. - - -File: gettext.info, Node: List of Programming Languages, Next: List of Data Formats, Prev: Maintainers for other Languages, Up: Programming Languages - -Individual Programming Languages -================================ - * Menu: -* C:: C, C++, Objective C -* sh:: sh - Shell Script -* bash:: bash - Bourne-Again Shell Script -* Python:: Python -* Common Lisp:: GNU clisp - Common Lisp -* clisp C:: GNU clisp C sources -* Emacs Lisp:: Emacs Lisp -* librep:: librep -* Smalltalk:: GNU Smalltalk -* Java:: Java -* gawk:: GNU awk -* Pascal:: Pascal - Free Pascal Compiler -* wxWindows:: wxWindows library -* YCP:: YCP - YaST2 scripting language -* Tcl:: Tcl - Tk's scripting language -* Perl:: Perl -* PHP:: PHP Hypertext Preprocessor -* Pike:: Pike - - -File: gettext.info, Node: C, Next: sh, Prev: List of Programming Languages, Up: List of Programming Languages - -C, C++, Objective C -------------------- - -RPMs - gcc, gpp, gobjc, glibc, gettext - -File extension - For C: `c', `h'. - For C++: `C', `c++', `cc', `cxx', `cpp', `hpp'. - For Objective C: `m'. - -String syntax - `"abc"' - -gettext shorthand - `_("abc")' - -gettext/ngettext functions - `gettext', `dgettext', `dcgettext', `ngettext', `dngettext', - `dcngettext' - -textdomain - `textdomain' function - -bindtextdomain - `bindtextdomain' function - -setlocale - Programmer must call `setlocale (LC_ALL, "")' - -Prerequisite - `#include <libintl.h>' - `#include <locale.h>' - `#define _(string) gettext (string)' - -Use or emulate GNU gettext - Use - -Extractor - `xgettext -k_' - -Formatting with positions - `fprintf "%2$d %1$d"' (POSIX but not C 99) - -Portability - autoconf (gettext.m4) and #if ENABLE_NLS - -po-mode marking - yes +* c-format:: C Format Strings +* python-format:: Python Format Strings +* lisp-format:: Lisp Format Strings +* elisp-format:: Emacs Lisp Format Strings +* librep-format:: librep Format Strings +* smalltalk-format:: Smalltalk Format Strings +* java-format:: Java Format Strings +* awk-format:: awk Format Strings +* object-pascal-format:: Object Pascal Format Strings +* ycp-format:: YCP Format Strings +* tcl-format:: Tcl Format Strings -File: gettext.info, Node: sh, Next: bash, Prev: C, Up: List of Programming Languages - -sh - Shell Script ------------------ - -RPMs - bash, gettext - -File extension - `sh' - -String syntax - `"abc"', `'abc'', `abc' - -gettext shorthand - `"`gettext "abc"`"' - -gettext/ngettext functions - `gettext', `ngettext' programs - -textdomain - environment variable `TEXTDOMAIN' - -bindtextdomain - environment variable `TEXTDOMAINDIR' - -setlocale - automatic - -Prerequisite - -- - -Use or emulate GNU gettext - use - -Extractor - -- - -Formatting with positions - -- - -Portability - -- - -po-mode marking - -- - - -File: gettext.info, Node: bash, Next: Python, Prev: sh, Up: List of Programming Languages - -bash - Bourne-Again Shell Script --------------------------------- - -RPMs - bash 2.0 or newer, gettext - -File extension - `sh' - -String syntax - `"abc"', `'abc'', `abc' - -gettext shorthand - `$"abc"' - -gettext/ngettext functions - `gettext', `ngettext' programs - -textdomain - environment variable `TEXTDOMAIN' - -bindtextdomain - environment variable `TEXTDOMAINDIR' - -setlocale - automatic - -Prerequisite - -- - -Use or emulate GNU gettext - use - -Extractor - `bash --dump-po-strings' - -Formatting with positions - -- - -Portability - -- - -po-mode marking - -- - - -File: gettext.info, Node: Python, Next: Common Lisp, Prev: bash, Up: List of Programming Languages - -Python ------- - -RPMs - python - -File extension - `py' - -String syntax - `'abc'', `u'abc'', `r'abc'', `ur'abc'', - `"abc"', `u"abc"', `r"abc"', `ur"abc"', - `'''abc'''', `u'''abc'''', `r'''abc'''', `ur'''abc'''', - `"""abc"""', `u"""abc"""', `r"""abc"""', `ur"""abc"""' - -gettext shorthand - `_('abc')' etc. - -gettext/ngettext functions - `gettext.gettext', `gettext.dgettext', also `ugettext' +File: gettext.info, Node: c-format, Next: python-format, Prev: Translators for other Languages, Up: Translators for other Languages -textdomain - `gettext.textdomain' function, or `gettext.install(DOMAIN)' - function +C Format Strings +---------------- -bindtextdomain - `gettext.bindtextdomain' function, or - `gettext.install(DOMAIN,LOCALEDIR)' function - -setlocale - not used by the gettext emulation - -Prerequisite - `import gettext' - -Use or emulate GNU gettext - emulate. Bug: uses only the first found .mo file, not all of them - -Extractor - `xgettext' - -Formatting with positions - `'...%(ident)d...' % { 'ident': value }' - -Portability - fully portable - -po-mode marking - -- + C format strings are described in POSIX (IEEE P1003.1 2001), section +XSH 3 fprintf(), +`http://www.opengroup.org/onlinepubs/007904975/functions/fprintf.html'. +See also the fprintf(3) manual page, +`http://www.linuxvalley.it/encyclopedia/ldp/manpage/man3/printf.3.php', +`http://informatik.fh-wuerzburg.de/student/i510/man/printf.html'. -File: gettext.info, Node: Common Lisp, Next: clisp C, Prev: Python, Up: List of Programming Languages - -GNU clisp - Common Lisp ------------------------ - -RPMs - clisp 2.28 or newer - -File extension - `lisp' - -String syntax - `"abc"' - -gettext shorthand - `(_ "abc")', `(ENGLISH "abc")' - -gettext/ngettext functions - `i18n:gettext', `i18n:ngettext' - -textdomain - `i18n:textdomain' - -bindtextdomain - `i18n:textdomaindir' - -setlocale - automatic - -Prerequisite - -- +File: gettext.info, Node: python-format, Next: lisp-format, Prev: c-format, Up: Translators for other Languages -Use or emulate GNU gettext - use - -Extractor - `xgettext -k_ -kENGLISH' - -Formatting with positions - `format "~1@*~D ~0@*~D"' - -Portability - On platforms without gettext, no translation. +Python Format Strings +--------------------- -po-mode marking - -- + Python format strings are described in Python Library reference / +2. Built-in Types, Exceptions and Functions / 2.2. Built-in Types / +2.2.6. Sequence Types / 2.2.6.2. String Formatting Operations. +`http://www.python.org/doc/2.2.1/lib/typesseq-strings.html'. -File: gettext.info, Node: clisp C, Next: Emacs Lisp, Prev: Common Lisp, Up: List of Programming Languages +File: gettext.info, Node: lisp-format, Next: elisp-format, Prev: python-format, Up: Translators for other Languages -GNU clisp C sources +Lisp Format Strings ------------------- -RPMs - clisp - -File extension - `d' - -String syntax - `"abc"' - -gettext shorthand - `ENGLISH ? "abc" : ""' - `GETTEXT("abc")' - `GETTEXTL("abc")' - -gettext/ngettext functions - `clgettext', `clgettextl' - -textdomain - -- - -bindtextdomain - -- - -setlocale - automatic - -Prerequisite - `#include "lispbibl.c"' - -Use or emulate GNU gettext - use - -Extractor - `clisp-xgettext' - -Formatting with positions - `fprintf "%2$d %1$d"' (POSIX but not C 99) - -Portability - On platforms without gettext, no translation. - -po-mode marking - -- - - -File: gettext.info, Node: Emacs Lisp, Next: librep, Prev: clisp C, Up: List of Programming Languages - -Emacs Lisp ----------- - -RPMs - emacs, xemacs - -File extension - `el' - -String syntax - `"abc"' - -gettext shorthand - `(_"abc")' - -gettext/ngettext functions - `gettext', `dgettext' (xemacs only) - -textdomain - `domain' special form (xemacs only) - -bindtextdomain - `bind-text-domain' function (xemacs only) - -setlocale - automatic - -Prerequisite - -- - -Use or emulate GNU gettext - use - -Extractor - `xgettext' - -Formatting with positions - `format "%2$d %1$d"' - -Portability - Only XEmacs. Without `I18N3' defined at build time, no translation. - -po-mode marking - -- - - -File: gettext.info, Node: librep, Next: Smalltalk, Prev: Emacs Lisp, Up: List of Programming Languages - -librep ------- - -RPMs - librep 0.15.3 or newer - -File extension - `jl' - -String syntax - `"abc"' - -gettext shorthand - `(_"abc")' - -gettext/ngettext functions - `gettext' - -textdomain - `textdomain' function - -bindtextdomain - `bindtextdomain' function - -setlocale - -- - -Prerequisite - `(require 'rep.i18n.gettext)' - -Use or emulate GNU gettext - use - -Extractor - `xgettext' - -Formatting with positions - `format "%2$d %1$d"' - -Portability - On platforms without gettext, no translation. - -po-mode marking - -- + Lisp format strings are described in the Common Lisp HyperSpec, +chapter 22.3 Formatted Output, +`http://www.lisp.org/HyperSpec/Body/sec_22-3.html'. -File: gettext.info, Node: Smalltalk, Next: Java, Prev: librep, Up: List of Programming Languages - -GNU Smalltalk -------------- - -RPMs - smalltalk - -File extension - `st' +File: gettext.info, Node: elisp-format, Next: librep-format, Prev: lisp-format, Up: Translators for other Languages -String syntax - `''abc''' - -gettext shorthand - `NLS? ''abc''' - `self? ''abc''' - -gettext/ngettext functions - `LcMessagesDomain>>#at:', `LcMessagesDomain>>#at:plural:with:' - -textdomain - `LcMessages>>#?' (returns a `LcMessagesDomain' object). - Example: `Locale default messages ? 'gettext'' - -bindtextdomain - `LcMessages>>#domain:directory:' (returns a `LcMessagesDomain' - object) - -setlocale - You can obtain any `Locale' object from `Locale' class methods - such as `#fromString:' or `#default'. - Example: `Locale default messages' gives the `LcMessages' object - for the default locale. - -Prerequisite - The gettext code is contained in the `I18N' package. - -Use or emulate GNU gettext - emulate - -Extractor - -- - -Formatting with positions - `'%1 %2' bindWith: 'Hello' with: 'world'' - -Portability - fully portable - -po-mode marking - -- - - -File: gettext.info, Node: Java, Next: gawk, Prev: Smalltalk, Up: List of Programming Languages - -Java ----- - -RPMs - java, java2 - -File extension - `java' - -String syntax - "abc" - -gettext shorthand - _("abc") - -gettext/ngettext functions - `GettextResource.gettext', `GettextResource.ngettext' - -textdomain - --, use `ResourceBundle.getResource' instead - -bindtextdomain - --, use CLASSPATH instead - -setlocale - automatic - -Prerequisite - -- - -Use or emulate GNU gettext - --, uses a Java specific message catalog format - -Extractor - `xgettext -k_' - -Formatting with positions - `MessageFormat.format "{1,number} {0,number}"' - -Portability - fully portable - -po-mode marking - -- - - Before marking strings as internationalizable, uses of the string -concatenation operator need to be converted to `MessageFormat' -applications. For example, `"file "+filename+" not found"' becomes -`MessageFormat.format("file {0} not found", new Object[] { filename })'. -Only after this is done, can the strings be marked and extracted. - - GNU gettext uses the native Java internationalization mechanism, -namely `ResourceBundle's. To convert a PO file to a ResourceBundle, the -`msgfmt' program can be used with the option `--java' or `--java2'. To -convert a ResourceBundle back to a PO file, the `msgunfmt' program can -be used with the option `--java'. - - Two different programmatic APIs can be used to access -ResourceBundles. Note that both APIs work with all kinds of -ResourceBundles, whether GNU gettext generated classes, or other -`.class' or `.properties' files. - - 1. The `java.util.ResourceBundle' API. - - In particular, its `getString' function returns a string - translation. Note that a missing translation yields a - `MissingResourceException'. - - This has the advantage of being the standard API. And it does not - require any additional libraries, only the `msgfmt' generated - `.class' files. But it cannot do plural handling, even if the - resource was generated from a PO file with plural handling. - - 2. The `gnu.gettext.GettextResource' API. - - Reference documentation in Javadoc 1.1 style format is in the - javadoc1 directory (javadoc1/tree.html) and in Javadoc 2 style - format in the javadoc2 directory (javadoc2/index.html). - - Its `gettext' function returns a string translation. Note that when - a translation is missing, the MSGID argument is returned unchanged. - - This has the advantage of having the `ngettext' function for plural - handling. - - To use this API, one needs the `libintl.jar' file which is part of - the GNU gettext package and distributed under the LGPL. - - -File: gettext.info, Node: gawk, Next: Pascal, Prev: Java, Up: List of Programming Languages - -GNU awk -------- - -RPMs - gawk 3.1 or newer - -File extension - `awk' - -String syntax - `"abc"' - -gettext shorthand - `_"abc"' - -gettext/ngettext functions - `dcgettext', missing `dcngettext' in gawk-3.1.0 - -textdomain - `TEXTDOMAIN' variable - -bindtextdomain - `bindtextdomain' function - -setlocale - automatic, but missing `setlocale (LC_MESSAGES, "")' in gawk-3.1.0 - -Prerequisite - -- - -Use or emulate GNU gettext - use - -Extractor - `xgettext' - -Formatting with positions - `printf "%2$d %1$d"' (GNU awk only) - -Portability - On platforms without gettext, no translation. On non-GNU awks, - you must define `dcgettext', `dcngettext' and `bindtextdomain' - yourself. +Emacs Lisp Format Strings +------------------------- -po-mode marking - -- + Emacs Lisp format strings are documented in the Emacs Lisp reference, +section Formatting Strings, +`http://www.gnu.org/manual/elisp-manual-21-2.8/html_chapter/elisp_4.html#SEC75'. +Note that as of version 21, XEmacs supports numbered argument +specifications in format strings while FSF Emacs doesn't. -File: gettext.info, Node: Pascal, Next: wxWindows, Prev: gawk, Up: List of Programming Languages - -Pascal - Free Pascal Compiler ------------------------------ - -RPMs - fpk - -File extension - `pp', `pas' - -String syntax - `'abc'' - -gettext shorthand - automatic - -gettext/ngettext functions - --, use `ResourceString' data type instead - -textdomain - --, use `TranslateResourceStrings' function instead +File: gettext.info, Node: librep-format, Next: smalltalk-format, Prev: elisp-format, Up: Translators for other Languages -bindtextdomain - --, use `TranslateResourceStrings' function instead - -setlocale - automatic, but uses only LANG, not LC_MESSAGES or LC_ALL - -Prerequisite - `{$mode delphi}' or `{$mode objfpc}' - `uses gettext;' - -Use or emulate GNU gettext - emulate partially - -Extractor - `ppc386' followed by `xgettext' or `rstconv' - -Formatting with positions - `uses sysutils;' - `format "%1:d %0:d"' - -Portability - ? - -po-mode marking - -- +librep Format Strings +--------------------- - The Pascal compiler has special support for the `ResourceString' data -type. It generates a `.rst' file. This is then converted to a `.pot' -file by use of `xgettext' or `rstconv'. At runtime, a `.mo' file -corresponding to translations of this `.pot' file can be loaded using -the `TranslateResourceStrings' function in the `gettext' unit. + librep format strings are documented in the librep manual, section +Formatted Output, +<http://librep.sourceforge.net/librep-manual.html#Formatted%20Output>, +<http://www.gwinnup.org/research/docs/librep.html#SEC122>. |