Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I'm trying to start a new PHP project with multilingual support. I've installed apache and PHP successfully and phpinfo() function tells me I've gettext support enabled. Gettext seems to work outside of PHP.
I've created the next simple code to test gettext under PHP (obtained from the official PHP doc examples):Code: Select all
<html><head><title>Testing gettext</title></head>
<body>
<?php
// Set language to Spanish
setlocale(LC_ALL, 'es_ES');
// Specify location of translation tables
bindtextdomain("messages", "./locale");
// Choose domain
textdomain("messages");
// Translation is looking for in ./locale/es_ES/LC_MESSAGES/messages.mo now
// Print a test message
echo _("Hello world");
?>
</body></html>Code: Select all
# mkdir -p ./locale/es_ES/LC_MESSAGES
# xgettext *.php
# vi messages.po
# cat messages.po
msgid "Hello world"
msgstr "Hola mundo"
# msgfmt -v messages.po
1 translated message.
# cp messages.mo ./locale/es_ES/LC_MESSAGES/Do I miss something?
T.I.A
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]