FACTOID # 90: Russia has almost twice as many judges and magistrates as the United States. Meanwhile, the United States has 8 times as much crime.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RELATED ARTICLES
People who viewed "Gettext" also viewed:
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Gettext
Free software Portal

gettext is the GNU internationalization (i18n) library. It is commonly used for writing multilingual programs. The latest version is 0.16. Image File history File links Portal. ... GNU (pronounced ) is a free operating system consisting of a kernel, libraries, system utilities, compilers, and end-user applications. ... Internationalization and localization are means of adapting products such as publications or software for non-native environments, especially other nations and cultures. ...

Contents

Workflow

Programmer

Source code is first modified to use the GNU gettext calls. This is, for most programming languages, done by wrapping strings that the user will see in the gettext function. To save on typing time, and to reduce code clutter, this function is usually aliased to _, so that the C code Wikibooks has a book on the topic of C Programming The C programming language (often, just C) is a general-purpose, procedural, imperative computer programming language developed in the early 1970s by Dennis Ritchie for use on the Unix operating system. ...

 printf("My name is %s.n", my_name); 

would become

 printf(_("My name is %s.n"), my_name); 

gettext then uses the supplied strings as keys for looking up alternative translations, and will return the original string when no translation is available. This is in contrast to systems like catgets or the use of LoadString under Microsoft Windows where a programmatic ID (often an integer) is used. Microsoft Windows is a family of operating systems by Microsoft. ...


In addition to C, GNU gettext has the following implementations: C++, Objective-C, sh script, bash script, Python, GNU CLISP, Emacs Lisp, librep, GNU Smalltalk, Java, GNU awk, Pascal, wxWidgets (through the wxLocale class), YCP (the YaST2 language), Tcl, Perl, PHP, Pike, and R. Usage is similar to C for most of these. C++ (generally pronounced ) is a general-purpose, high-level programming language with low-level facilities. ... Objective-C, often referred to as ObjC or more seldomly as Objective C or Obj-C, is an object oriented programming language implemented as an extension to C. It is used primarily on Mac OS X and GNUstep, two environments based on the OpenStep standard, and is the primary language... The Bourne shell, or sh, was the default Unix shell of Unix Version 7, and replaced the Thompson shell, whose executable file had the same name, sh. ... bash is a Unix shell written for the GNU Project. ... Python is an interpreted programming language created by Guido van Rossum in 1990. ... CLISP is a Common Lisp implementation. ... Emacs Lisp is a dialect of the Lisp programming language used by the GNU Emacs and XEmacs text editors (which we will collectively refer to as Emacs in this article. ... Smalltalk is an object-oriented, dynamically typed, reflective programming language. ... Java is an object-oriented programming language developed by James Gosling and colleagues at Sun Microsystems in the early 1990s. ... AWK is a general purpose computer language that is designed for processing text-based data, either in files or data streams. ... Pascal is an imperative computer programming language, developed in 1970 by Niklaus Wirth as a language particularly suitable for structured programming. ... The correct title of this article is wxWidgets. ... YaST from SUSE 9. ... // Tcl (originally from Tool Command Language, but nonetheless conventionally rendered as Tcl rather than TCL; and pronounced like tickle) is a scripting language created by John Ousterhout. ... Perl, also Practical Extraction and Report Language (a backronym, see below) is a dynamic procedural programming language designed by Larry Wall and first released in 1987. ... PHP (PHP: Hypertext Preprocessor) is a reflective programming language originally designed for producing dynamic Web pages. ... Pike is a general-purpose, high-level, dynamic programming language, with a syntax similar to that of C. Unlike many other dynamic languages, pike is statically typed, and requires explicit type definitions. ... The R programming language, sometimes described as GNU S, is a programming language and software environment for statistical computing and graphics. ...


xgettext is run on the sources to produce a .pot file, or template, which contains a list of all the translatable strings extracted from the sources. For the above, an entry in the .pot file would look like:

 #: src/name.c:36 msgid "My name is %s.n" msgstr "" 

Comments for translators

If the developer wants to give the translator a hint for a specific string, he can do it in the source with a TAG. This TAG is for xgettext to filter those hints and put them in the pot-file. The hints were displayed by Kbabel and Poedit.

 printf(_("My name is %s.n"), my_name); // TRANSLATORS: Please let %s as it is, because it is exchanged by the program. // Thank you for contributing to this project. 

In this example the TAG is // and has to be given to xgettext when building the .pot template file to be able to extract the comments for the translators. This TAG can be every other char as well, as long as you use it consistently in all your source.

 xgettext -c=// 

The .pot file looks like this with the comment:

 #. TRANSLATORS: Please let %s as it is, because it is exchanged by the program. #. Thank you for contributing to this project. #: src/name.c:36 msgid "My name is %s.n" msgstr "" 

Translator

The translator derives a .po file from the template using the msginit program, then fills out the translations. msginit initializes the translations so, for instance, if we wish to create a French language translation, we'd run

 msginit --locale=fr --input=name.pot 

This will create fr.po. A sample entry would look like

 #: src/name.c:36 msgid "My name is %s.n" msgstr "My name is %s.n" 

The translator will have to edit these, either by hand or with a translation tool like poEdit. When they are done, the entry will look like this: poEdit is a cross-platform gettext catalog editor to aid in the process of internationalization and localization. ...

 #: src/name.c:36 msgid "My name is %s.n" msgstr "Je m'appelle %s.n" 

Finally, the .po files are compiled into binary .mo files with msgfmt. These are now ready for distribution with the software package.


User

The user, on Unix-type systems, sets the environment variable LANG, and the program will display strings in the selected language, if there is a .mo file for it. Unix or UNIX is a computer operating system originally developed in the 1960s and 1970s by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie, and Douglas McIlroy. ... Environment variables are a set of dynamic values that can affect the way running processes will behave on a computer. ...


External links


  Results from FactBites:
 
a2 --- Gettext: introduzione (1907 words)
La logica di Gettext è molto semplice: il programma incorpora solo i messaggi in inglese; all'esterno si associano una serie di file, uno per ogni linguaggio disponibile, con le traduzioni corrispondenti.
La predisposizione di un programma per Gettext potrebbe essere fatta in modo più o meno automatico, attraverso strumenti specifici, oppure si può procedere in modo più semplice, anche se più oneroso dal punto di vista del tempo impiegato.
Perché Gettext sappia qual è il file che contiene i messaggi tradotti, nell'ambito della configurazione locale, fa riferimento a un nome che viene definito «pacchetto», che di solito si sceglie opportunamente simile a quello del programma per il quale si fa la traduzione:
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.