bindtextdomain('hello', '/usr/share/locale')
textdomain('hello')
2. Wrap strings to be translated in gettext('translate me') or, using the gettext alias, _('translate me').
return _('this string is to be translated');3. Extract the strings using the xgettext utility.
xgettext -d hello -s -o hello.pot hello.c4. Turn the .pot file into a .po file that can be passed on to the translators
msginit -l es_US -o spanish.po -i hello.pot5. Translate the strings in the .po file
6. Convert the .po file into a compiled .mo using the msgfmt utility, note that the output filename must match the domain given as the first argument to bindtextdomain and textdomain and must be placed in the location specified as the second argument to bindtextdomainmsgid "Hello\n"
msgstr "Hola\n"
joined with the language set in setlocale or set in the environment
msgfmt -c -v -o hello.mo spanish.posource
cp hello.mo /usr/share/locale/es_US/LC_MESSAGES
No comments:
Post a Comment