getolympus/olympus-hermes-translator

Olympus Hermes is a bundle used to translate all messages from your WordPress packages and Olympus bundles.

v0.0.2 2020-02-25 21:55 UTC

This package is auto-updated.

Last update: 2024-10-10 17:57:48 UTC


README

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

Olympus Component CodeFactor Grade Packagist Version MIT

Features

  • Better and secure folder structure
  • Dependency management with Composer

With Composer

How to

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');

Release History

See CHANGELOG.md for all details.

Contributing

  1. Fork it (https://github.com/GetOlympus/Hermes-Translator/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Built with ♥ by Achraf Chouk ~ (c) since a long time.