extends abstract class Phalcon\Translate\Adapter
implements Phalcon\Translate\AdapterInterface, ArrayAccess
use Phalcon\Translate\Adapter\Gettext; $adapter = new Gettext( [ "locale" => "de_DE.UTF-8", "defaultDomain" => "translations", "directory" => "/path/to/application/locales", "category" => LC_MESSAGES, ] );
Allows translate using gettext
Phalcon\Translate\Adapter\Gettext constructor
Returns the translation related to the given key.
$translator->query("你好 %name%!", ["name" => "Phalcon"]);
Check whether is defined a translation key in the internal array
The plural version of gettext(). Some languages have more than one form for plural messages dependent on the count.
Changes the current domain (i.e. the translation file)
Sets the default domain
Sets the domain default to search within when calls are made to gettext()
Sets the path for a domain
// Set the directory path $gettext->setDirectory("/path/to/the/messages"); // Set the domains and directories path $gettext->setDirectory( [ "messages" => "/path/to/the/messages", "another" => "/path/to/the/another", ] );
Sets locale information
// Set locale to Dutch $gettext->setLocale(LC_ALL, "nl_NL"); // Try different possible locale names for german $gettext->setLocale(LC_ALL, "[email protected]", "de_DE", "de", "ge");
Validator for constructor
Gets default options
...
Returns the translation string of the given key
Returns the translation string of the given key (alias of method ‘t’)
Sets a translation value
Check whether a translation key exists
Unsets a translation from the dictionary
Returns the translation related to the given key
Replaces placeholders by the values passed
© 2011–2017 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Translate_Adapter_Gettext.html