<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Gettext</id>
	<title>Gettext - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Gettext"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Gettext&amp;action=history"/>
	<updated>2026-06-10T01:16:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Gettext&amp;diff=5123276&amp;oldid=prev</id>
		<title>imported&gt;ClueBot NG: Reverting possible vandalism by ~2025-35968-03 to version by 131.93.105.41. Report False Positive? Thanks, ClueBot NG. (4452402) (Bot)</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Gettext&amp;diff=5123276&amp;oldid=prev"/>
		<updated>2025-11-24T02:52:13Z</updated>

		<summary type="html">&lt;p&gt;Reverting possible vandalism by &lt;a href=&quot;/wiki143/index.php?title=Special:Contributions/~2025-35968-03&quot; title=&quot;Special:Contributions/~2025-35968-03&quot;&gt;~2025-35968-03&lt;/a&gt; to version by 131.93.105.41. &lt;a href=&quot;/wiki143/index.php?title=WP:CBFP&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:CBFP (page does not exist)&quot;&gt;Report False Positive?&lt;/a&gt; Thanks, &lt;a href=&quot;/wiki143/index.php?title=WP:CBNG&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:CBNG (page does not exist)&quot;&gt;ClueBot NG&lt;/a&gt;. (4452402) (Bot)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Previous revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 02:52, 24 November 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l32&quot;&gt;Line 32:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 32:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Initially, POSIX provided no means of localizing messages. Two proposals were raised in the late 1980s, the 1988 Uniforum gettext and the 1989 X/Open catgets (XPG-3 § 5). [[Sun Microsystems]] implemented the first gettext in 1993.&amp;lt;ref name=sun /&amp;gt; The Unix and POSIX developers never really agreed on what kind of interface to use (the other option is the X/Open catgets), so many [[C library|C libraries]], including [[glibc]], implemented both.&amp;lt;ref&amp;gt;{{cite web |title=Message Translation |url=https://www.gnu.org/software/libc/manual/html_node/Message-Translation.html |website=The GNU C Library}}&amp;lt;/ref&amp;gt; {{As of|2019|08}}, whether gettext should be part of POSIX was still a point of debate in the [[Austin Group]], despite the fact that its old foe has already fallen out of use. Concerns cited included its dependence on the system-set locale (a [[global variable]] subject to multithreading problems) and its support for newer C-language extensions involving wide strings.&amp;lt;ref&amp;gt;{{cite web |title=0001122: POSIX should include gettext() and friends - Austin Group Defect Tracker |url=http://austingroupbugs.net/view.php?id=1122 |website=Austin Group Defect Tracker}}&amp;lt;/ref&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Initially, POSIX provided no means of localizing messages. Two proposals were raised in the late 1980s, the 1988 Uniforum gettext and the 1989 X/Open catgets (XPG-3 § 5). [[Sun Microsystems]] implemented the first gettext in 1993.&amp;lt;ref name=sun /&amp;gt; The Unix and POSIX developers never really agreed on what kind of interface to use (the other option is the X/Open catgets), so many [[C library|C libraries]], including [[glibc]], implemented both.&amp;lt;ref&amp;gt;{{cite web |title=Message Translation |url=https://www.gnu.org/software/libc/manual/html_node/Message-Translation.html |website=The GNU C Library}}&amp;lt;/ref&amp;gt; {{As of|2019|08}}, whether gettext should be part of POSIX was still a point of debate in the [[Austin Group]], despite the fact that its old foe has already fallen out of use. Concerns cited included its dependence on the system-set locale (a [[global variable]] subject to multithreading problems) and its support for newer C-language extensions involving wide strings.&amp;lt;ref&amp;gt;{{cite web |title=0001122: POSIX should include gettext() and friends - Austin Group Defect Tracker |url=http://austingroupbugs.net/view.php?id=1122 |website=Austin Group Defect Tracker}}&amp;lt;/ref&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The [[GNU Project]] decided that the message-as-key approach of gettext is simpler and more friendly. (Most other systems, including catgets, requires the developer to come up with &quot;key&quot; names for every string.)&amp;lt;ref&amp;gt;{{cite web |title=The Programmer&#039;s View |url=http://ftp.gnu.org/old-gnu/Manuals/gettext-0.10.35/html_chapter/gettext_8.html |website=gettext 0.10.35| date=30 April 1998}}&amp;lt;/ref&amp;gt; They released GNU gettext, a [[free software]] implementation of the system in 1995.&amp;lt;ref name=history /&amp;gt; Gettext, GNU or not, has since been ported to many programming languages.&amp;lt;ref&amp;gt;{{cite web |title=GNU gettext utilities: List of Programming Languages |url=https://www.gnu.org/software/gettext/manual/html_node/List-of-Programming-Languages.html#List-of-Programming-Languages}}&amp;lt;/ref&amp;gt; The simplicity of po and widespread editor support even &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;lead &lt;/del&gt;to its adoption in non-program contexts for text documents or as an intermediate between other localization formats, with converters like po4a (po for anything) and Translate Toolkit emerging to provide such a bridge.&amp;lt;ref&amp;gt;{{cite web |title=po4a |url=https://po4a.org/index.php.en |website=po4a.org}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web |title=The essential toolkit for localization engineers |url=https://toolkit.translatehouse.org/ |website=Translate Toolkit}}&amp;lt;/ref&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The [[GNU Project]] decided that the message-as-key approach of gettext is simpler and more friendly. (Most other systems, including catgets, requires the developer to come up with &quot;key&quot; names for every string.)&amp;lt;ref&amp;gt;{{cite web |title=The Programmer&#039;s View |url=http://ftp.gnu.org/old-gnu/Manuals/gettext-0.10.35/html_chapter/gettext_8.html |website=gettext 0.10.35| date=30 April 1998}}&amp;lt;/ref&amp;gt; They released GNU gettext, a [[free software]] implementation of the system in 1995.&amp;lt;ref name=history /&amp;gt; Gettext, GNU or not, has since been ported to many programming languages.&amp;lt;ref&amp;gt;{{cite web |title=GNU gettext utilities: List of Programming Languages |url=https://www.gnu.org/software/gettext/manual/html_node/List-of-Programming-Languages.html#List-of-Programming-Languages}}&amp;lt;/ref&amp;gt; The simplicity of po and widespread editor support even &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;led &lt;/ins&gt;to its adoption in non-program contexts for text documents or as an intermediate between other localization formats, with converters like po4a (po for anything) and Translate Toolkit emerging to provide such a bridge.&amp;lt;ref&amp;gt;{{cite web |title=po4a |url=https://po4a.org/index.php.en |website=po4a.org}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web |title=The essential toolkit for localization engineers |url=https://toolkit.translatehouse.org/ |website=Translate Toolkit}}&amp;lt;/ref&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Operation==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Operation==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;ClueBot NG</name></author>
	</entry>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Gettext&amp;diff=388777&amp;oldid=prev</id>
		<title>imported&gt;Supercat3point0: /* Translating */ Fix formating of msginit command</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Gettext&amp;diff=388777&amp;oldid=prev"/>
		<updated>2025-02-06T02:26:43Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Translating: &lt;/span&gt; Fix formating of msginit command&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{short description|GNU internationalization and localization software}}&lt;br /&gt;
{{multiple issues|&lt;br /&gt;
{{More citations needed|date=August 2008}}&lt;br /&gt;
{{how-to|date=January 2025}}&lt;br /&gt;
}}&lt;br /&gt;
{{lowercase title}}&lt;br /&gt;
{{Use dmy dates|date=December 2020}}&lt;br /&gt;
{{Infobox software&lt;br /&gt;
| name                   = gettext&lt;br /&gt;
| logo                   = &lt;br /&gt;
| author                 = [[Sun Microsystems]]&amp;lt;ref name=sun&amp;gt;{{cite web |url=https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/gettext.html |title=About gettext |website=gnu.org |access-date=2024-05-09}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| developer              = various&lt;br /&gt;
| released               = {{start date and age|1990}}&amp;lt;ref name=history&amp;gt;{{cite web|url=http://compgroups.net/comp.unix.solaris/History-of-gettext-et-al |archive-url=https://web.archive.org/web/20120323032211/http://compgroups.net/comp.unix.solaris/History-of-gettext-et-al |url-status=usurped |archive-date=23 March 2012 |title=History of gettext() et al? - comp.unix.solaris |website=Compgroups.net |access-date=2016-04-03}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| discontinued           = &lt;br /&gt;
| latest release version = {{wikidata|property|preferred|references|edit|Q937302|P348|P548=Q2804309}}&lt;br /&gt;
| latest release date    = {{start date and age|{{wikidata|qualifier|preferred|single|Q937302|P348|P548=Q2804309|P577}}}}&lt;br /&gt;
| programming language   = &lt;br /&gt;
| operating system       = [[Cross-platform]]&lt;br /&gt;
| platform               = &lt;br /&gt;
| size                   = &lt;br /&gt;
| language               = &lt;br /&gt;
| language count         = &amp;lt;!-- DO NOT include this parameter unless you know what it does --&amp;gt;&lt;br /&gt;
| language footnote      = &lt;br /&gt;
| genre                  = [[Internationalization and localization]]&lt;br /&gt;
| license                = Various [[free software license]]s&lt;br /&gt;
| alexa                  = &lt;br /&gt;
| repo                   = various based on OpenSolaris and GNU gettext&lt;br /&gt;
}}&lt;br /&gt;
In [[computing]], &amp;#039;&amp;#039;&amp;#039;gettext&amp;#039;&amp;#039;&amp;#039; is an [[internationalization and localization]] (i18n and l10n) system commonly used for writing multilingual programs on [[Unix-like]] computer [[operating system]]s. One of the main benefits of gettext is that it separates programming from translating.&amp;lt;ref&amp;gt;{{Cite web|url=https://www.linuxjournal.com/article/5966|title=Bridging the Digital Divide in South Africa {{!}} Linux Journal|last=Martindale|first=Linda|date=2002-11-01|website=linuxjournal.com|publisher=[[Linux Journal]]|url-status=live|archive-url=https://archive.today/20190917015344/https://www.linuxjournal.com/article/5966|archive-date=17 September 2019|access-date=2019-09-17}}&amp;lt;/ref&amp;gt; The most commonly used implementation of gettext is &amp;#039;&amp;#039;&amp;#039;GNU gettext&amp;#039;&amp;#039;&amp;#039;,&amp;lt;ref&amp;gt;{{Cite web|url=https://www.linuxjournal.com/article/6176|title=Introduction to Internationalization Programming {{!}} Linux Journal|last=Tykhomyrov|first=Olexiy Ye|date=2002-11-01|website=linuxjournal.com|publisher=[[Linux Journal]]|url-status=live|archive-url=https://archive.today/20190917020307/https://www.linuxjournal.com/article/6176|archive-date=17 September 2019|access-date=2019-09-17}}&amp;lt;/ref&amp;gt; released by the [[GNU Project]] in 1995. The runtime library is &amp;#039;&amp;#039;&amp;#039;libintl&amp;#039;&amp;#039;&amp;#039;. gettext provides an option to use different strings for any number of [[plural form]]s of nouns, but this feature has no support for [[grammatical gender]]. The main [[filename extension]]s used by this system are [[.POT]] (Portable Object Template), [[Portable object (computing)|.PO]] (Portable Object) and .MO (Machine Object).&amp;lt;ref name=&amp;quot;:0&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
Initially, POSIX provided no means of localizing messages. Two proposals were raised in the late 1980s, the 1988 Uniforum gettext and the 1989 X/Open catgets (XPG-3 § 5). [[Sun Microsystems]] implemented the first gettext in 1993.&amp;lt;ref name=sun /&amp;gt; The Unix and POSIX developers never really agreed on what kind of interface to use (the other option is the X/Open catgets), so many [[C library|C libraries]], including [[glibc]], implemented both.&amp;lt;ref&amp;gt;{{cite web |title=Message Translation |url=https://www.gnu.org/software/libc/manual/html_node/Message-Translation.html |website=The GNU C Library}}&amp;lt;/ref&amp;gt; {{As of|2019|08}}, whether gettext should be part of POSIX was still a point of debate in the [[Austin Group]], despite the fact that its old foe has already fallen out of use. Concerns cited included its dependence on the system-set locale (a [[global variable]] subject to multithreading problems) and its support for newer C-language extensions involving wide strings.&amp;lt;ref&amp;gt;{{cite web |title=0001122: POSIX should include gettext() and friends - Austin Group Defect Tracker |url=http://austingroupbugs.net/view.php?id=1122 |website=Austin Group Defect Tracker}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [[GNU Project]] decided that the message-as-key approach of gettext is simpler and more friendly. (Most other systems, including catgets, requires the developer to come up with &amp;quot;key&amp;quot; names for every string.)&amp;lt;ref&amp;gt;{{cite web |title=The Programmer&amp;#039;s View |url=http://ftp.gnu.org/old-gnu/Manuals/gettext-0.10.35/html_chapter/gettext_8.html |website=gettext 0.10.35| date=30 April 1998}}&amp;lt;/ref&amp;gt; They released GNU gettext, a [[free software]] implementation of the system in 1995.&amp;lt;ref name=history /&amp;gt; Gettext, GNU or not, has since been ported to many programming languages.&amp;lt;ref&amp;gt;{{cite web |title=GNU gettext utilities: List of Programming Languages |url=https://www.gnu.org/software/gettext/manual/html_node/List-of-Programming-Languages.html#List-of-Programming-Languages}}&amp;lt;/ref&amp;gt; The simplicity of po and widespread editor support even lead to its adoption in non-program contexts for text documents or as an intermediate between other localization formats, with converters like po4a (po for anything) and Translate Toolkit emerging to provide such a bridge.&amp;lt;ref&amp;gt;{{cite web |title=po4a |url=https://po4a.org/index.php.en |website=po4a.org}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web |title=The essential toolkit for localization engineers |url=https://toolkit.translatehouse.org/ |website=Translate Toolkit}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Operation==&lt;br /&gt;
&lt;br /&gt;
===Programming===&lt;br /&gt;
[[File:Gettext.svg|thumb|Typical gettext workflow.  The de.po instance on the left shows a &amp;quot;renewing&amp;quot; of translations via msgmerge.]]&lt;br /&gt;
The basic interface of gettext is the {{code|gettext(const char*)}} function, which accepts a [[string (computer science)|string]] that the user will see in the original language, usually English. To save typing time and reduce code clutter, this function is commonly [[aliasing (computing)|aliased]] to &amp;lt;code&amp;gt;_&amp;lt;/code&amp;gt;:&amp;lt;ref&amp;gt;{{Cite web |date= |title=GNU gettext utilities: How Marks Appear in Sources |url=https://www.gnu.org/software/gettext/manual/gettext.html#How-Marks-Appear-in-Sources |url-status=live |archive-url=https://web.archive.org/web/20240325095308/https://www.gnu.org/software/gettext/manual/gettext.html#How-Marks-Appear-in-Sources |archive-date=2024-03-25 |access-date=2024-04-03 |website=www.gnu.org}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
printf(gettext(&amp;quot;My name is %s.\n&amp;quot;), my_name);&lt;br /&gt;
printf(_(&amp;quot;My name is %s.\n&amp;quot;), my_name); // same, but shorter&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;gettext()&amp;lt;/code&amp;gt; then uses the supplied strings as keys for looking up translations, and will return the original string when no translation is available. This is in contrast to [[POSIX]] &amp;lt;code&amp;gt;catgets()&amp;lt;/code&amp;gt;,&amp;lt;ref&amp;gt;{{cite web|url=https://www.gnu.org/software/gettext/manual/html_node/catgets.html |website=gnu.org |title=About catgets |access-date=2017-10-24}}&amp;lt;/ref&amp;gt; [[AmigaOS]] &amp;lt;code&amp;gt;GetString()&amp;lt;/code&amp;gt;,&amp;lt;ref&amp;gt;{{Cite web |title=AmigaOS Manual: Python Modules and Packages - AmigaOS Documentation Wiki |url=https://wiki.amigaos.net/wiki/AmigaOS_Manual:_Python_Modules_and_Packages#GetString.28.29 |access-date=2023-07-09 |website=wiki.amigaos.net}}&amp;lt;/ref&amp;gt; or [[Microsoft Windows]] &amp;lt;code&amp;gt;LoadString()&amp;lt;/code&amp;gt;  where a programmatic ID (often an integer) is used. To handle the case where the same original-language text can have different meanings, gettext has functions like &amp;lt;code&amp;gt;cgettext()&amp;lt;/code&amp;gt; that accept an additional &amp;quot;context&amp;quot; string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;xgettext&amp;lt;/code&amp;gt; is run on the sources to produce a &amp;lt;code&amp;gt;.pot&amp;lt;/code&amp;gt; (Portable Object Template) file, which contains a list of all the translatable strings extracted from the sources. Comments starting with &amp;lt;code&amp;gt;///&amp;lt;/code&amp;gt; are used to give translators hints, although other prefixes are also configurable to further limit the scope. One such common prefix is &amp;lt;code&amp;gt;TRANSLATORS:&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For example, an input file with a comment might look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/// TRANSLATORS: %s contains the user&amp;#039;s name as specified in Preferences&lt;br /&gt;
printf(_(&amp;quot;My name is %s.\n&amp;quot;), my_name);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;xgettext&amp;lt;/code&amp;gt; is run using the command:&lt;br /&gt;
&lt;br /&gt;
 xgettext -c /&lt;br /&gt;
&lt;br /&gt;
The resultant .pot file looks like this with the comment (note that xgettext recognizes the string as a [[C (programming language)|C]]-language [[printf]] format string):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;po&amp;quot;&amp;gt;&lt;br /&gt;
#. TRANSLATORS: %s contains the user&amp;#039;s name as specified in Preferences&lt;br /&gt;
#, c-format&lt;br /&gt;
#: src/name.c:36&lt;br /&gt;
msgid &amp;quot;My name is %s.\n&amp;quot;&lt;br /&gt;
msgstr &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In POSIX [[shell script]], gettext provides a &amp;lt;code&amp;gt;gettext.sh&amp;lt;/code&amp;gt; library one can include that provides the many same functions gettext provides in similar languages.&amp;lt;ref&amp;gt;{{cite web |title=GNU gettext utilities: sh |url=https://www.gnu.org/software/gettext/manual/html_node/sh.html}}&amp;lt;/ref&amp;gt; [[GNU bash]] also has a simplified construct &amp;lt;code&amp;gt;$&amp;quot;msgid&amp;quot;&amp;lt;/code&amp;gt; for the simple gettext function, although it depends on the C library to provide a &amp;lt;code&amp;gt;gettext()&amp;lt;/code&amp;gt; function.&amp;lt;ref&amp;gt;{{cite web |title=GNU gettext utilities: bash |url=https://www.gnu.org/software/gettext/manual/html_node/bash.html}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Translating===&lt;br /&gt;
The translator derives a &amp;lt;code&amp;gt;.po&amp;lt;/code&amp;gt; (Portable Object) file from the template using the &amp;lt;code&amp;gt;msginit&amp;lt;/code&amp;gt; program, then fills out the translations.&amp;lt;ref name=msginit&amp;gt;{{cite web|url=https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/PO-Files.html |title=GNU gettext utilities: PO Files |website=Gnu.org |access-date=2016-04-03}}&amp;lt;/ref&amp;gt; &amp;lt;code&amp;gt;msginit&amp;lt;/code&amp;gt; initializes the translations so, for instance, for a French language translation, the command to run would be:&amp;lt;ref name=&amp;quot;:0&amp;quot;&amp;gt;{{cite web|url=http://www.icanlocalize.com/site/tutorials/how-to-translate-with-gettext-po-and-pot-files/ |title=How to Translate With GetText PO and POT Files |website=Icanlocalize.com |access-date=2016-04-03}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 msginit --locale=fr --input=name.pot&lt;br /&gt;
&lt;br /&gt;
This will create &amp;lt;code&amp;gt;fr.po&amp;lt;/code&amp;gt;. The translator then edits the resultant file, either by hand or with a translation tool like [[Poedit]], or [[Emacs]] with its editing mode for &amp;lt;code&amp;gt;.po&amp;lt;/code&amp;gt; files. An edited entry will look like:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;po&amp;quot;&amp;gt;&lt;br /&gt;
#: src/name.c:36&lt;br /&gt;
msgid &amp;quot;My name is %s.\n&amp;quot;&lt;br /&gt;
msgstr &amp;quot;Je m&amp;#039;appelle %s.\n&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the .po files are compiled with &amp;lt;code&amp;gt;msgfmt&amp;lt;/code&amp;gt; into binary &amp;lt;code&amp;gt;.mo&amp;lt;/code&amp;gt; (Machine Object) files.  GNU gettext may use its own file name extension &amp;lt;code&amp;gt;.gmo&amp;lt;/code&amp;gt; on systems with another gettext implementation.&amp;lt;ref&amp;gt;{{cite web | url=https://www.gnu.org/software/gettext/manual/html_node/Files.html | title=Files Conveying Translations|website=Gnu.org | access-date=2014-04-22}}&amp;lt;/ref&amp;gt; These are now ready for distribution with the software package.&lt;br /&gt;
&lt;br /&gt;
GNU &amp;lt;code&amp;gt;msgfmt&amp;lt;/code&amp;gt; can also perform some checks relevant to the [[format string]] used by the programming language. It also allows for outputting to language-specific formats other than MO;&amp;lt;ref&amp;gt;{{cite web |title=msgfmt Invocation |url=https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html |website=GNU gettext utilities}}&amp;lt;/ref&amp;gt; the [[X/Open]] equivalent is &amp;lt;code&amp;gt;gencat&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In later phases of the developmental workflow, &amp;lt;code&amp;gt;msgmerge&amp;lt;/code&amp;gt; can be used to &amp;quot;update&amp;quot; an old translation to a newer template. There is also &amp;lt;code&amp;gt;msgunfmt&amp;lt;/code&amp;gt; for reverse-compiling &amp;lt;code&amp;gt;.mo&amp;lt;/code&amp;gt; files, and many other utilities for batch processing.&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
The user, on [[Unix]]-type systems, sets the [[environment variable]] &amp;lt;code&amp;gt;LC_MESSAGES&amp;lt;/code&amp;gt;, and the program will display strings in the selected language, if there is an &amp;lt;code&amp;gt;.mo&amp;lt;/code&amp;gt; file for it.&lt;br /&gt;
&lt;br /&gt;
Users on [[GNU variants]] can also use the environment variable &amp;lt;code&amp;gt;LANGUAGE&amp;lt;/code&amp;gt; instead. Its main difference from the Unix variable is that it supports multiple languages, separated with a colon, for fallback.&amp;lt;ref&amp;gt;{{cite web|url=https://www.gnu.org/software/gettext/manual/html_node/Locale-Environment-Variables.html#Locale-Environment-Variables |title=GNU gettext utilities: Locale Environment Variables |website=Gnu.org |access-date=2016-04-03}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Plural form ==&lt;br /&gt;
The &amp;lt;code&amp;gt;ngettext()&amp;lt;/code&amp;gt; interface accounts for the count of a noun in the string. As with the convention of &amp;lt;code&amp;gt;gettext()&amp;lt;/code&amp;gt;, it is often aliased to &amp;lt;code&amp;gt;N_&amp;lt;/code&amp;gt; in practical use. Consider the code sample:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// parameters: english singular, english plural, integer count&lt;br /&gt;
printf(ngettext(&amp;quot;%d translated message&amp;quot;, &amp;quot;%d translated messages&amp;quot;, n), n);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A header in the &amp;lt;code&amp;gt;&amp;quot;&amp;quot;&amp;lt;/code&amp;gt; (empty string) entry of the PO file stores some metadata, one of which is the plural form that the language uses, usually specified using a C-style [[?:|ternary operator]]. Suppose we want to translate for the [[Slovene language]]:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;po&amp;quot;&amp;gt;&lt;br /&gt;
msgid &amp;quot;&amp;quot;&lt;br /&gt;
msgstr &amp;quot;&amp;quot;&lt;br /&gt;
&amp;quot;...&amp;quot;&lt;br /&gt;
&amp;quot;Language: sl\n&amp;quot;&lt;br /&gt;
&amp;quot;Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0);\n&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since now there are four plural forms, the final po would look like:&amp;lt;!-- example from gettext-tools/po/sl.po --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;po&amp;quot;&amp;gt;&lt;br /&gt;
#: src/msgfmt.c:876&lt;br /&gt;
#, c-format&lt;br /&gt;
msgid &amp;quot;%d translated message&amp;quot;&lt;br /&gt;
msgid_plural &amp;quot;%d translated messages&amp;quot;&lt;br /&gt;
msgstr[0] &amp;quot;%d prevedenih sporočil&amp;quot;&lt;br /&gt;
msgstr[1] &amp;quot;%d prevedeno sporočilo&amp;quot;&lt;br /&gt;
msgstr[2] &amp;quot;%d prevedeni sporočili&amp;quot;&lt;br /&gt;
msgstr[3] &amp;quot;%d prevedena sporočila&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference plural rules for languages are provided by the [[Unicode consortium]].&amp;lt;ref&amp;gt;{{cite web |title=Language Plural Rules |url=https://unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html |website=unicode.org}}&amp;lt;/ref&amp;gt; msginit also prefills the appropriate rule when creating a file for one specific language.&amp;lt;ref name=msginit/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementations==&lt;br /&gt;
In addition to [[C (programming language)|C]], gettext has the following implementations: [[C Sharp (programming language)|C#]] for both [[ASP.NET]]&amp;lt;ref&amp;gt;{{cite web|url=https://code.google.com/p/gettext-cs-utils/ |title=Google Code Archive - Long-term storage for Google Code Project Hosting |website=Code.google.com |access-date=2016-04-03}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/turquoiseowl/i18n |title=turquoiseowl/i18n: Smart internationalization for ASP.NET |website=GitHub.com |access-date=2016-04-03}}&amp;lt;/ref&amp;gt; and for [[Windows Presentation Foundation|WPF]],&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/robert-j-engdahl/ngettext-wpf |title=NGettext.Wpf - Proper internationalization support for WPF (via NGettext)|website=[[GitHub]]|date=16 August 2019}}&amp;lt;/ref&amp;gt; [[Perl]],&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/gflohr/libintl-perl |title=libintl-perl - An Internationalization Library for Perl That Aims To Be Compatible With the Uniforum Message Translations System as Implemented For Example in GNU Gettext |website=github.com |access-date=2017-09-14}}&amp;lt;/ref&amp;gt; [[PHP]],&amp;lt;ref&amp;gt;{{cite web|url=https://secure.php.net/manual/en/book.gettext.php |title=Gettext |website=php.net |access-date=2017-10-24}}&amp;lt;/ref&amp;gt; [[Python (programming language)|Python]],&amp;lt;ref&amp;gt;{{cite web|url=https://docs.python.org/library/gettext.html|title=gettext – Multilingual internationalization services – Python 3.7.0 documentation|website=docs.python.org|access-date=2018-09-21}}&amp;lt;/ref&amp;gt; [[R (programming language)|R]],&amp;lt;ref&amp;gt;{{Cite web|title=gettext: Translate Text Messages|url=https://rdrr.io/r/base/gettext.html|access-date=2021-11-13|website=rdrr.io|language=en}}&amp;lt;/ref&amp;gt; [[Scala (programming language)|Scala]],&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/makkarpov/scalingua|title=makkarpov/scalingua: A simple gettext-like internationalization library for Scala|website=github.com|access-date=2016-04-28}}&amp;lt;/ref&amp;gt; and [[Node.js]].&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/DanielBaulig/node-gettext |title=DanielBaulig/node-gettext: An adaption of Joshua I. Miller&amp;#039;s Javascript Gettext library for node.js |website=GitHub.com |access-date=2016-04-03}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GNU gettext has native support for Objective-C, but there is no support for the [[Swift programming language]] yet. A commonly used gettext implementation on these Cocoa platforms is POLocalizedString.&amp;lt;ref&amp;gt;{{cite web |title=hulab/POLocalizedString: gettext for iOS/OS X/watchOS/tvOS |url=https://github.com/hulab/POLocalizedString |website=GitHub |publisher=hulab |date=19 September 2019}}&amp;lt;/ref&amp;gt; The Microsoft Outlook for iOS team also provides a LocalizedStringsKit library with a gettext-like API.&amp;lt;ref&amp;gt;{{cite web |title=microsoft/LocalizedStringKit: Generate .strings files directly from your code |url=https://github.com/microsoft/LocalizedStringKit |website=GitHub |publisher=Microsoft |date=12 February 2020}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Commons category|GNU gettext}}&lt;br /&gt;
{{Portal|Free and open-source software}}&lt;br /&gt;
* [[gtranslator]]&lt;br /&gt;
* [[Poedit]]&lt;br /&gt;
* [[Translate Toolkit]]&lt;br /&gt;
* [[Virtaal]]&lt;br /&gt;
* [[Weblate]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* {{official website|https://www.gnu.org/software/gettext/gettext.html|Official GNU gettext site}}&lt;br /&gt;
&lt;br /&gt;
[[Category:GNU Project software]]&lt;br /&gt;
[[Category:Internationalization and localization]]&lt;br /&gt;
[[Category:Software-localization tools]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Supercat3point0</name></author>
	</entry>
</feed>