Olympus Hermes Translator is a bundle used to translate all messages from your WordPress website, its plugins and Olympus bundles.
composer require getolympus/olympus-hermes-translator
- Better and secure folder structure
- Dependency management with Composer
You can easily use the Hermes
translator thanks to its functions:
namespace MyCustomPackage;
use GetOlympus\Hermes\Hermes;
/**
* Load translations.
*
* @param array $translations
* @param string $locale
*/
Hermes::l([
'my-custom-domain' => '/absolute/path/to/custom/domain/directory/languages',
'my-other-domain' => '/absolute/path/to/other/domain/directory/languages',
'my-latest-domain' => '/absolute/path/to/latest/domain/directory/languages',
// (...)
], 'en_US');
/**
* Noop typo from WordPress.
*
* @param string $single
* @param string $plural
* @param integer $number
* @param string $domain
*
* @return string
*/
echo Hermes::n('%s message', '%s messages', 3, 'my-custom-domain');
/**
* Prepare noop typo from WordPress.
*
* @param string $single
* @param string $plural
*
* @return string
*/
echo Hermes::noop('My %s uniq message', 'My %s messages', 'my-custom-domain');
/**
* Translate typo.
*
* @param string $message
* @param string $domain
*
* @return string
*/
echo Hermes::t('My custom message to translate', 'my-custom-domain');
See CHANGELOG.md for all details.
- Fork it (https://github.com/GetOlympus/Hermes-Translator/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
Built with ♥ by Achraf Chouk ~ (c) since a long time.