dev-master
9999999-dev https://mvaliolahi.irAnother library to achieve translation in your beautiful application!
The Development Requires
by Meysam Valiolahi
by Meysam Valiolahi
language translation translator multilanguage
Wallogit.com
2017 © Pedro Peláez
Another library to achieve translation in your beautiful application!
Translate messages for any project., (*1)
`composer require mvaliolahi/translator`
Make a directory as resources path, inside the ResourcePath directory make several directory for different languages., (*2)
Resources/lang/en .en make a message.php file.The message.php is like below code:, (*3)
<?php
return [
'test' => 'Test',
];
Finally instantiate Validator like below:, (*4)
$translator = new Translator([
'locale' => en',
'resourcePath' => __DIR__ . '/../src/Resources/lang'
]);
Use of method to find translation in specified language., (*5)
$result = $translator->of('messages.test');
Output: Test
$result = $translator->of('test');
Output: Test
Tips: The messages.php is default translation file, you could define another files as you wish!, (*6)
Another library to achieve translation in your beautiful application!
language translation translator multilanguage