Skip to content

Instantly share code, notes, and snippets.

@tml
Created May 20, 2018 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tml/593fdb868354a6f53dceb52cd25f9c34 to your computer and use it in GitHub Desktop.
Save tml/593fdb868354a6f53dceb52cd25f9c34 to your computer and use it in GitHub Desktop.
locale/en/LC_MESSAGES:
-rw-rw-r-- 1 joey joey 67 May 20 10:38 template.mo
-rw-rw-r-- 1 joey joey 28 May 20 10:37 template.po
template.po:
msgid "foo"
msgstr "foobar"
locale/it/LC_MESSAGES:
total 8
-rw-rw-r-- 1 joey joey 67 May 20 10:38 template.mo
-rw-rw-r-- 1 joey joey 28 May 20 10:37 template.po
template.po:
msgid "foo"
msgstr "barbat"
myscript.php:
<?php
setlocale(LC_ALL, 'en_GB.UTF-8');
bindtextdomain ("template", "./locale");
textdomain ("template");
echo _("foo"), "\n";
setlocale(LC_ALL, 'it_IT.UTF-8');
echo _("foo"), "\n";
php -f myscript.php:
foobar
barbat
@tml
Copy link
Author

tml commented May 20, 2018

strace -o /dev/stdout -e open -fF php -f myscript.php | grep locale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment