note 119437 added to function.bindtextdomain
| From: | roel dot vermeulen at gmail dot com | Date: | Sun, 05 Jun 2016 17:49:03 +0000 |
| Subject: | note 119437 added to function.bindtextdomain | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205667@lists.php.net to get a copy of this message | ||
I recommend using absolute paths in the $directory parameter. This caused me several hours to debug
as Ajax calls to my localization functions messed up the path. And since no error if thrown if the
path in $directory cannot be found, one should check the result always:
<?php
// Imagine the path for this file is "/localization" and your locales are in the
"/locale" directory.
$pathToDomain = __DIR__ . "/../locale";
if ($pathToDomain != bindtextdomain($domain, $pathToDomain)) {
// Error handling.
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 62.151.243.88
----
Manual Page -- http://php.net/manual/en/function.bindtextdomain.php
Edit -- https://master.php.net/note/edit/119437
Del: integrated -- https://master.php.net/note/delete/119437/integrated
Del: useless -- https://master.php.net/note/delete/119437/useless
Del: bad code -- https://master.php.net/note/delete/119437/bad+code
Del: spam -- https://master.php.net/note/delete/119437/spam
Del: non-english -- https://master.php.net/note/delete/119437/non-english
Del: in docs -- https://master.php.net/note/delete/119437/in+docs
Del: other reasons-- https://master.php.net/note/delete/119437
Reject -- https://master.php.net/note/reject/119437
Search -- https://master.php.net/manage/user-notes.php