Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Gettext
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Translating=== The translator derives a <code>.po</code> (Portable Object) file from the template using the <code>msginit</code> program, then fills out the translations.<ref name=msginit>{{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}}</ref> <code>msginit</code> initializes the translations so, for instance, for a French language translation, the command to run would be:<ref name=":0">{{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}}</ref> msginit --locale=fr --input=name.pot This will create <code>fr.po</code>. The translator then edits the resultant file, either by hand or with a translation tool like [[Poedit]], or [[Emacs]] with its editing mode for <code>.po</code> files. An edited entry will look like: <syntaxhighlight lang="po"> #: src/name.c:36 msgid "My name is %s.\n" msgstr "Je m'appelle %s.\n" </syntaxhighlight> Finally, the .po files are compiled with <code>msgfmt</code> into binary <code>.mo</code> (Machine Object) files. GNU gettext may use its own file name extension <code>.gmo</code> on systems with another gettext implementation.<ref>{{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}}</ref> These are now ready for distribution with the software package. GNU <code>msgfmt</code> 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;<ref>{{cite web |title=msgfmt Invocation |url=https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html |website=GNU gettext utilities}}</ref> the [[X/Open]] equivalent is <code>gencat</code>. In later phases of the developmental workflow, <code>msgmerge</code> can be used to "update" an old translation to a newer template. There is also <code>msgunfmt</code> for reverse-compiling <code>.mo</code> files, and many other utilities for batch processing.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)