Xgettext recursive relationship

Unsupported SSL/TLS Version

Use xgettext to create badz.info from all PHP files in a directory (recursive), and place it in /languages/. - gist Download: badz.info faster than the recursive find, but unreliable if the database has not been recently updated). The option has an effect on all input files. To enable or disable checks for a certain string, you can mark it with an xgettext: special comment in the source file.

Expat This package contains programs for parsing XML. It is required for XML-Parser. Expect This package contains a program for carrying out scripted dialogues with other interactive programs.

It is commonly used for testing other packages. File This package contains a utility for determining the type of a given file or files. A few packages need it to build. Findutils This package contains programs to find files in a file system. It is used in many packages' build scripts.

Flex This package contains a utility for generating programs that recognize patterns in text. It is the GNU version of the lex lexical analyzer program. It is required to build several LFS packages. Gawk This package contains programs for manipulating text files. It is used in many other packages' build scripts. Gcc This package is the Gnu Compiler Collection.

Gettext This package contains utilities and libraries for internationalization and localization of numerous packages.

Design pattern: recursive associations

Glibc This package contains the main C library. Linux programs would not run without it. GMP This package contains math libraries that provide useful functions for arbitrary precision arithmetic.

It is required to build Gcc. Gperf This package a program that generates a perfect hash function from a key set. It is required for Eudev. Grep This package contains programs for searching through files. These programs are used by most packages' build scripts.

Groff This package contains programs for processing and formatting text. One important function of these programs is to format man pages. It is one of several boot loaders available, but is the most flexible. Gzip This package contains programs for compressing and decompressing files. It is needed to decompress many packages in LFS and beyond.

Iana-etc This package provides data for network services and protocols.

linux - Recursive scan for files with xgettext - Stack Overflow

It is needed to enable proper networking capabilities. Inetutils This package contains programs for basic network administration. Intltool This package contains tools for extracting translatable strings from source files. It was chosen over the other common network tools package net-tools for its IPv6 capabilities.

Kbd This package contains key-table files, keyboard utilities for non-US keyboards, and a number of console fonts. Kmod This package contains programs needed to administer Linux kernel modules. Less This package contains a very nice text file viewer that allows scrolling up or down when viewing a file.

It is also used by Man-DB for viewing manpages. Libpipeline The Libpipeline package contains a library for manipulating pipelines of subprocesses in a flexible and convenient way. It is required by the Man-DB package. Libtool This package contains the GNU generic library support script. For this reason it is important to cover argument capturing first.

However, some consequences of argument capturing will be omitted in this section, and covered in other sections where they apply directly.

Current Gettext calls are a "thin" wrapper around coding framework's native strings. They take a native string, find or not its translation in the message catalog, and return the translated or original native string. This makes it possible to quickly prepare for translation a piece of code which was not made translatable from the start.

Other than wrapping the original strings with Gettext calls, nothing else needs to be changed in the code. With generalized Gettext, arguments are captured and their substitution into the string is done by the translation system. The native string delivered at the end is a complete message, requiring no further intervention. Here is how the most verbose variant of this would look like: Finally, to be usable at the destination -- a GUI widget label, shell output, log file -- this object has methods for conversion to a native string.

The translation object is exposed to the client code not only to be able to call argument substitution methods on it, but also in order to be able to defer argument substitution: At this point all of the arguments should have been provided to the translation object and stored [7]and they are formatted into strings and substituted into the translation fetched from the catalog.

One convenience of this lazy resolution can be recognized immediately: Lazy resolution is also crucial for translation scripting, as will be shown later.

However, due to the conversion methods which return native strings, and due to argument substitution methods which can take native data types, there also has to exist specialized support for different frameworks within the same programming language: Instead, Gettext distribution could contain only a single implementation for Cand let particular coding frameworks languages, foundation libraries create their own bindings. One particular substitutable argument type would be translation objects themselves.

This again is not just a convenience, but a crucial point when working with customizable markup. How should the translation class Gettext:: Translator be placed in the object hierarchy of the coding framework?

In general, it should interact with the native object hierarchy only through its substitution and conversion methods. In particular, it should not derive from framework's native string class, because it is in fact not a string at all, but a translated text composer.

Previous formulation suggests introducing a more basic text composer class, called Gettext:: Composer, from which Gettext:: Composer would actually do everything related to argument substitution and markup resolution, while Gettext:: Translator would be tasked with fetching the translation and evaluating translation scripts. Translator should not be directly constructable e. On the other hand, Gettext:: Composer would be directly constructable, enabling its use in, for example, structuring of longer texts: Translator in this way, because it would try to translate its own text, which could lead even if unlikely to unexpectedly fetching a translation from the catalog.

Gettext Generalized

Explicit use of Gettext:: Composer comes even more into play when customizable markup is considered. Explicit Conversion to Native String For the moment putting aside the verbosity due to keyword-like argument placeholders the section about placeholders will discuss thatthe only real inconvenience in the proposed generalized Gettext interface is the need to explicitly call a conversion method to get the resolved translated and arguments substituted native string.

There are several possibilities to get around this. The ideal world variant is that different destinations GUI widgets, shell writers Composer; that is, that Gettext:: Composer can be an argument wherever the native string can be. This would be that more important when customizable markup is taken into account, because, in principle, it could resolve into different destination markups.

This is presented in much more detail in the section on markup. Since the destination knows which type of markup it can process, it would internally call the appropriate conversion method of Gettext:: In absence of aware destinations, the second thing that comes to mind is implicit conversion, through e.

Keeping in mind the previous paragraph, you may observe that one problem with implicit conversion is how to specify the target markup; but this will be discussed in the section on markup. A more pressing problem are inadvertent conversions. There can be several layers of code between the composite message and the translated substitutions, so if the problem is detected long after the code has been written, it may be difficult to refactor it.

There can also be a middle ground. It follows from two observations: There could be a parallel set of immediate-resolution calls, which would take all the arguments at once, call a conversion method internally, and return a native string. Both of the following two lines would set msg to a Python string object: However, a stripped-down variant is still possible, by limiting oneself to ordinal placeholders: This puts an arbitrary limit on number of arguments, but 9 is a nice number: It depends on programmer's sensibility which of these three variants -- explicit conversion, implicit conversion, immediate-resolution -- is preferable.

Some programmers may not mind using verbose explicit conversion everywhere, to keep things uniform and having least surprise. Others may opt for the combination of immediate-resolution calls most of the time and explicit conversion when necessary. Yet some will have no grudge against implicit conversion especially when they do not use any markup in text. Therefore the generalized Gettext library may very well provide all three variants with implicit conversion that can be disabledsubject to applicability in different programming languages.

Generalized Plural Call In current Gettext, the translation call for plural forms ngettext takes an explicit integer argument to decide the plural form. Enter pygettext, which uses Python's standard tokenize module to scan Python source code, generating. From there, the standard GNU tools can be used. A word about marking Python strings as candidates for translation.

GNU xgettext recognizes the following keywords: But those can be a lot of text to include all over your code. Thus these are both translatable strings: However some options are still missing or are not fully implemented.

Also, xgettext's use of command line switches with option arguments is broken, and in these cases, pygettext just defines additional switches. See also the -X option. These lines appear before each msgid. This is the default. If filename is '-' then the output is sent to standard out. Two styles are supported: