![]() ![]() |
Info | ![]() |
![]() |
![]() ![]() |
Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2019-07-15 (18 days ago) ![]() | Not yet rated by the users | Total: Not yet counted | Not yet ranked |
Version | License | PHP version | Categories | |||
atk4-i18next-php 1.0 | MIT/X Consortium ... | 7 | Localization, PHP 7 |
Collaborate with this project | Author | |
atk4-i18next-php - github.com Description This package can Translate application texts like il8next-PHP. |
|
install with composer :
composer require abbadon1334/atk4-i18next-php
All documentation about the original library can be found here : http://i18next.com/
$this->translator = new TranslatorMock();
$this->translator->setTranslationsPath(__DIR__.'/data/locales');
Define if filename will be used has namespace :
$this->translator->useFilenameAsNamespace(true);
Define primary and fallback language (name of the folders where library load files) :
$this->translator->setLanguagePrimary($language);
$this->translator->setLanguageFallback($fallback);
Add additional language :
$this->translator->addLanguage('it');
Translate :
interface TranslatorInterface
{
/
* Translates the given message.
*
* @param string $key
* @param array|null $parameters Array of parameters used to translate message
* @param string|null $context
* @param string|null $locale The locale or null to use the default
*
* @return string The translated string
*/
public function _(string $key, ?array $parameters = null, ?string $context = null, ?string $locale = null): string;
}
// Usage
$result = $this->translator->_('definitionKey');
$result = $this->translator->_('definitionKey', ['param1' => 'test']);
$result = $this->translator->_('definitionKey', ['param1' => 'test'], 'context');
$result = $this->translator->_('definitionKey', ['param1' => 'test'], 'context', 'specificLanguage');
$result = $this->translator->_('namespace:definitionKey', ['param1' => 'test'], 'context', 'specificLanguage');
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Example | Example script | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation | ||
![]() ![]() |
Data | Auxiliary data |
Version Control | Unique User Downloads | |||||||
99% |
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.