NOTE
All classes are prefixed with Phalcon
Translate\Adapter\AbstractAdapter ¶
-
Namespace
Phalcon\Translate\Adapter
-
Uses
Phalcon\Helper\Arr\Get
Phalcon\Translate\Exception
Phalcon\Translate\InterpolatorFactory
-
Extends
-
Implements
AdapterInterface
Properties¶
/**
* @var string
*/
protected $defaultInterpolator = ;
/**
* @var InterpolatorFactory
*/
protected $interpolatorFactory;
Methods¶
Returns the translation string of the given key (alias of method 't') Check whether a translation key exists Returns the translation related to the given key Sets a translation value Unsets a translation from the dictionary Returns the translation string of the given key Replaces placeholders by the values passedTranslate\Adapter\AdapterInterface ¶
-
Namespace
Phalcon\Translate\Adapter
Phalcon\Translate\Adapter\AdapterInterface
Interface for Phalcon\Translate adapters
Methods¶
Check whether is defined a translation key in the internal array Returns the translation related to the given key Returns the translation string of the given keyTranslate\Adapter\Csv¶
-
Namespace
Phalcon\Translate\Adapter
-
Uses
ArrayAccess
Phalcon\Translate\Exception
Phalcon\Translate\InterpolatorFactory
-
Extends
AbstractAdapter
-
Implements
ArrayAccess
Allows to define translation lists using CSV file
Properties¶
Methods¶
Phalcon\Translate\Adapter\Csv constructor Check whether is defined a translation key in the internal array Returns the translation related to the given keyTranslate\Adapter\Gettext¶
-
Namespace
Phalcon\Translate\Adapter
-
Uses
ArrayAccess
Phalcon\Translate\Exception
Phalcon\Translate\InterpolatorFactory
-
Extends
AbstractAdapter
-
Implements
ArrayAccess
Phalcon\Translate\Adapter\Gettext
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
Properties¶
/**
* @var int
*/
protected $category;
/**
* @var string
*/
protected $defaultDomain;
/**
* @var $string|array
*/
protected $directory;
/**
* @var string
*/
protected $locale;
Methods¶
Phalcon\Translate\Adapter\Gettext constructor Check whether is defined a translation key in the internal arraypublic function nquery( string $msgid1, string $msgid2, int $count, array $placeholders = [], string $domain = null ): string;
// 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",
]
);
// Set locale to Dutch
$gettext->setLocale(LC_ALL, "nl_NL");
// Try different possible locale names for German
$gettext->setLocale(LC_ALL, "de_DE@euro", "de_DE", "de", "ge");
Translate\Adapter\NativeArray¶
-
Namespace
Phalcon\Translate\Adapter
-
Uses
ArrayAccess
Phalcon\Translate\Exception
Phalcon\Translate\InterpolatorFactory
-
Extends
AbstractAdapter
-
Implements
ArrayAccess
Allows to define translation lists using PHP arrays
Properties¶
Methods¶
Phalcon\Translate\Adapter\NativeArray constructor Check whether is defined a translation key in the internal array Whenever a key is not found this method will be called Returns the translation related to the given keyTranslate\Exception¶
-
Namespace
Phalcon\Translate
-
Uses
-
Extends
\Exception
-
Implements
Phalcon\Translate\Exception
Class for exceptions thrown by Phalcon\Translate
Translate\Interpolator\AssociativeArray¶
-
Namespace
Phalcon\Translate\Interpolator
-
Uses
Phalcon\Helper\Str\Interpolate
-
Extends
-
Implements
InterpolatorInterface
Methods¶
Replaces placeholders by the values passedTranslate\Interpolator\IndexedArray¶
-
Namespace
Phalcon\Translate\Interpolator
-
Uses
-
Extends
-
Implements
InterpolatorInterface
Methods¶
Replaces placeholders by the values passedTranslate\Interpolator\InterpolatorInterface ¶
-
Namespace
Phalcon\Translate\Interpolator
-
Uses
-
Extends
-
Implements
Phalcon\Translate\InterpolatorInterface
Interface for Phalcon\Translate interpolators
Methods¶
Replaces placeholders by the values passedTranslate\InterpolatorFactory¶
-
Namespace
Phalcon\Translate
-
Uses
Phalcon\Factory\AbstractFactory
Phalcon\Translate\Interpolator\InterpolatorInterface
-
Extends
AbstractFactory
-
Implements
Methods¶
AdapterFactory constructor. Create a new instance of the adapterClass Phalcon\Translate\TranslateFactory
| Namespace | Phalcon\Translate | | Uses | Phalcon\Config, Phalcon\Factory\AbstractFactory, Phalcon\Helper\Arr, Phalcon\Translate\Adapter\AdapterInterface | | Extends | AbstractFactory |
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.