I am working on multi-language project. The content such as articles, product description will be shown from database. This is no problem. The problem is there are some "static" descriptions, e.g. Form labels, error messages etc.
So far I ended with this. I store language in COOKIE and I have function to write the messages in set lanugeage. I have file named _lang.php with this content:
$['empty_field']['sk'] = "Slovak description of error";
$['empty_field']['en'] = "English description of error";
And so on. Is this good solution or not ? Any other solutions ? Thanks
So I've tried the gettext() and ended with this: (output is welcome)
putenv("LANGUAGE=sk_SK");
setlocale(LC_ALL, 'sk_SK');
$dom = "roids";
bindtextdomain($dom, "www/roids/_locale");
textdomain($dom);
echo gettext('welcome');
I created folder this folder: _locale/sk_SK/roids.po
Content of roids.po:
msgid ""
msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "welcome"
msgstr "vitaj"
I' using WAMP server and I do not know whether this path: www/roids/_locale is good. Wamp is installed here: D:\wamp and ww files are in D:\wamp\www