2017 © Pedro Peláez
 

library localization

WordPress localization for Bright Nucleus components.

image

brightnucleus/localization

WordPress localization for Bright Nucleus components.

  • Monday, August 15, 2016
  • by schlessera
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,599 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Bright Nucleus Localization

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

WordPress localization for Bright Nucleus components., (*2)

Table Of Contents

Installation

The best way to use this package is through Composer:, (*3)

composer require brightnucleus/localization

Basic Usage

This package provides a trait to be used within Bright Nucleus components to load the translation files (compiled *.mo-files) for a given locale., (*4)

To use the trait, import it into your class, and call the loadLocalization( $domain, $path ) method., (*5)

Example:, (*6)

<?php namespace Localization\Example;

use BrightNucleus\Localization\LocalizationTrait;

class TranslatedClass {

    use LocalizationTrait;

    public function register() {

        $this->loadLocalization(
            'bn-localization-example',
            __DIR__ . '/../languages'
        );

        // Your normal registration comes here, knowing that all `gettext`
        // strings have already been translated.
    }
}

Filters

Each loading of localization files passes through two filters:, (*7)

  1. Localization::LOCALE_FILTER - Filter the locale of a Bright Nucleus library., (*8)

    Arguments:, (*9)

    • $locale (string) - The plugin's current locale.
    • $domain (string) - Text domain. Unique identifier for retrieving translated strings.

    Return value:, (*10)

    • $locale (string) - Filtered locale.
  2. Localization::MOFILE_FILTER - Filter the name of the MO-file of a Bright Nucleus library., (*11)

    Arguments:, (*12)

    • $path (string) - Path to the MO-file.
    • $locale (string) - The plugin's current locale.
    • $domain (string) - Text domain. Unique identifier for retrieving translated strings.

    Return value:, (*13)

    • $path (string) - Fitlered path to the MO-file.

Contributing

All feedback / bug reports / pull requests are welcome., (*14)

License

Copyright (c) 2016 Alain Schlesser, Bright Nucleus, (*15)

This code is licensed under the MIT License., (*16)

The Versions

15/08 2016

dev-master

9999999-dev

WordPress localization for Bright Nucleus components.

  Sources   Download

MIT

15/08 2016

v0.1.0

0.1.0.0

WordPress localization for Bright Nucleus components.

  Sources   Download

MIT