Phalcon translate
NOTE
All classes are prefixed with Phalcon
Translate\Adapter\AbstractAdapter ¶
-
Namespace
Phalcon\Translate\Adapter
-
Uses
Phalcon\Support\Helper\Arr\Get
Phalcon\Translate\Exception
Phalcon\Translate\InterpolatorFactory
-
Extends
-
Implements
AdapterInterface
Class AbstractAdapter
@package Phalcon\Translate\Adapter
@property string $defaultInterpolator @property InterpolatorFactory $interpolatorFactory
Properties¶
/**
* @var string
*/
protected $defaultInterpolator = ;
/**
* @var InterpolatorFactory
*/
protected $interpolatorFactory;
Methods¶
AbstractAdapter constructor. 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
-
Uses
-
Extends
-
Implements
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
Properties¶
Methods¶
Csv constructor. Check whether is defined a translation key in the internal array Check whether is defined a translation key in the internal array Returns the translation related to the given key Returns the internal array @todo to be removed when we get traitsTranslate\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
@property int $category @property string $defaultDomain @property string|array $directory @property string|false $locale
Properties¶
/**
* @var int
*/
protected $category;
/**
* @var string
*/
protected $defaultDomain;
/**
* @var string|array
*/
protected $directory;
/**
* @var string
*/
protected $locale;
Methods¶
Gettext constructor. Check whether is defined a translation key in the internal array 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
Class NativeArray
Defines translation lists using PHP arrays
@package Phalcon\Translate\Adapter
@property array $translate @property bool $triggerError
Properties¶
Methods¶
NativeArray constructor. Check whether is defined a translation key in the internal array 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 key Returns the internal arrayTranslate\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\Support\Helper\Str\Interpolate
-
Extends
-
Implements
InterpolatorInterface
Class AssociativeArray
@package Phalcon\Translate\Interpolator
Methods¶
Replaces placeholders by the values passedTranslate\Interpolator\IndexedArray¶
-
Namespace
Phalcon\Translate\Interpolator
-
Uses
-
Extends
-
Implements
InterpolatorInterface
Class IndexedArray
@package Phalcon\Translate\Interpolator
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
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.
Methods¶
InterpolatorFactor constructor. Create a new instance of the adapter Returns the available adaptersTranslate\TranslateFactory¶
-
Namespace
Phalcon\Translate
-
Uses
Phalcon\Config\ConfigInterface
Phalcon\Factory\AbstractFactory
Phalcon\Translate\Adapter\AdapterInterface
-
Extends
AbstractFactory
-
Implements
Class TranslateFactory
@package Phalcon\Translate
@property InterpolatorFactory $interpolator