Internationalization tools, particularly message translation.

Overview

Aura.Intl

The Aura.Intl package provides internationalization (I18N) tools, specifically package-oriented per-locale message translation.

Installation and Autoloading

This package is installable and PSR-4 autoloadable via Composer as aura/intl.

Alternatively, download a release, or clone this repository, then map the Aura\Intl\ namespace to the package src/ directory.

Dependencies

This package requires PHP 5.6 or later; it has been tested on PHP 5.6, 7.0 and HHVM. We recommend using the latest available version of PHP as a matter of principle.

Aura library packages may sometimes depend on external interfaces, but never on external implementations. This allows compliance with community standards without compromising flexibility. For specifics, please examine the package composer.json file.

Quality

Scrutinizer Code Quality Code Coverage Build Status

This project adheres to Semantic Versioning.

To run the unit tests at the command line, issue composer install and then phpunit at the package root. This requires Composer to be available as composer, and PHPUnit to be available as phpunit.

This package attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request.

Community

To ask questions, provide feedback, or otherwise communicate with other Aura users, please join our Google Group, follow @auraphp, or chat with us on Freenode in the #auraphp channel.

Documentation

This package is fully documented here.

Comments
  • Select format isn't supported by IntlFormatter

    Select format isn't supported by IntlFormatter

    $formatter = new \Aura\Intl\IntlFormatter();
    $pattern = '{name} is {gender} and {gender, select, female{she} male{he} other{it}} report bugs!';
    echo $formatter->format('en_US', $pattern, array(
        'name' => 'Alexander',
        'gender' => 'male',
    ));
    

    Should produce Alexander is male and he report bugs! but instead gives Alexander is male and 3 report bugs!. PHP 5.5's MessageFormatter does it properly.

    opened by samdark 21
  • Get rid of installer default

    Get rid of installer default

    I noticed a message in cakephp irc channel,

    I'm trying to install cake on ubuntu using composer and I get this runtime error. any ideas? Plugin aura/installer-default is missing a require statement for a version of the composer-plugin-api package. the command I'm using for the install is composer create-project --prefer-dist cakephp/app [app_name] waspinator, could you open an issue at https://github.com/auraphp/Aura.Intl/ ? sure waspinator, also you could do a -vvv to tell composer to display more errors

    May be we need v2 or I am also ok with the change for 1.x framework is no longer maintained .

    Also when I testing the same command, I have not experienced the issue.

    1.x 
    opened by harikt 20
  • 2.x release

    2.x release

    Hi @pmjones ,

    I would like to hear how you would love to release Aura.Intl. Can we push a 2.x release or do you think it is going for 3.x release ?

    May be we need a few betas or can we push this to a stable x.0.0 on the fly for there is little changes.

    I will be happy to do the releases if you raise the green flag :) .

    Thank you.

    opened by harikt 12
  • PHP Fatal error:  Trait 'Aura\Framework\Test\WiringAssertionsTrait' not found

    PHP Fatal error: Trait 'Aura\Framework\Test\WiringAssertionsTrait' not found

    I'm having issues trying to test a CakePHP 3 plugin and the problem comes when Cake internally loads aura.intl. This is the error shown:

    PHP Fatal error:  Trait 'Aura\Framework\Test\WiringAssertionsTrait' not found in /home/elboletaire/www/projectes/metropolitan/web-2015/vendor/cms/files/vendor/aura/intl/tests/WiringTest.php on line 8
    
    Fatal error: Trait 'Aura\Framework\Test\WiringAssertionsTrait' not found in /home/elboletaire/www/projectes/metropolitan/web-2015/vendor/cms/files/vendor/aura/intl/tests/WiringTest.php on line 8
    

    I've found this: https://github.com/auraphp/Aura.Marshal/issues/21 but it is not a valid solution. Making a search on the whole code I can see that the Trait does not exist.

    Searching in all your Aura repositories I can see that the trait exists in Aura.Framework, but this framework is not present in the Aura.intl composer file as a requirement.

    So, IMHO, this can be due to:

    • Aura.intl does not properly require the libraries in its composer file (adding the framework dependency should fix the issue).
    • CakePHP is not properly loading aura.intl, instead they should load aura.framework + aura.intl.
    • I'm totally wrong and I'm making some stupid error on my tests.
    opened by elboletaire 12
  • Making Translator's messages 'mutable'

    Making Translator's messages 'mutable'

    Alright, this PR is more a proposal than anything else.

    In my application i happen to only load translations "template" by template, thus i have a translation file by template. This means that i dynamically load translations at runtime depending on which template i need at that time.

    Because of the way Aura.Intl is made, there is no way to change the messages once a Translator has been created, disallowing one to load more translation messages at runtime.

    In order to fix this, i propose to make the Translator depending on a Package instance rather than its messages. We can then add new messages to the Package and the Translator will automatically have access to them.

    Is there any reason why the Translator was design this way in the 1st place ?

    opened by jhuet 10
  • 2.x Todo

    2.x Todo

    Hi @pmjones ,

    It looks to me the todo is already done https://github.com/auraphp/Aura.Intl/blob/2.x/TODO.md .

    Can you make sure if there is anything that need to be done ?

    question 2.x 
    opened by harikt 7
  • Formatting the translation key whenever arguments are passed.

    Formatting the translation key whenever arguments are passed.

    In some applications it is easier to use the key as a human readable string, which can contain formatting placeholders. With this feature the developer will be able to see immediate feedback of their translation messages without having to translate messages to a specific locale beforehand.

    opened by lorenzo 6
  • ICU and Intl Version Checks

    ICU and Intl Version Checks

    Making ICU Version 4.8+ a requirement for using IntlFormatter. If ICU < 4.8 a IcuVersionTooLow Exception is thrown on instantiating IntlFormatter.

    Skip tests if the intl extension is not loaded.

    opened by mapthegod 4
  • Support PHP 5.5 + and phpunit api changes for the tests

    Support PHP 5.5 + and phpunit api changes for the tests

    This PR is a rebased version of https://github.com/auraphp/Aura.Intl/pull/28 . I could actually send a force push to the other branch, but I don't wish to mess up all the history.

    opened by harikt 2
  • Plugin aura/installer-default is missing a require statement for a version of the composer-plugin-api package.

    Plugin aura/installer-default is missing a require statement for a version of the composer-plugin-api package.

    I'm getting a [RuntimeException] when I try to install a aura using composer.

    this is the composer.json file

    {
        "name": "aura/installer-default",
        "version": "1.0.0",
        "type": "composer-installer",
        "license": "BSD-2-Clause",
        "description": "Installs Aura packages using the Composer defaults.",
        "keywords": ["aura", "installer"],
        "authors": [
        {
            "name": "Paul M. Jones",
            "email": "[email protected]",
            "homepage": "http://paul-m-jones.com"
        }
        ],
        "autoload": {
        "psr-0": {
            "Aura\\Composer\\": "src/"
        }
        },
        "extra" : {
        "class" : "Aura\\Composer\\DefaultInstaller"
        }
    }
    

    and this is the output I get:

    waspinator@waspinator-pc:~$ composer create-project --prefer-dist cakephp/app poopsy -vvv
    Downloading https://packagist.org/packages.json
    Writing /home/waspinator/.composer/cache/repo/https---packagist.org/packages.json into cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2013.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2014.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2015.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2015-04.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2015-07.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2015-10.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2016-01.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-archived.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-latest.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$app.json from cache
    Installing cakephp/app (3.1.2)
      - Installing cakephp/app (3.1.2)
    Reading /home/waspinator/.composer/cache/files/cakephp/app/4fc9e693fac8bf987e69c0e5072e6761e4acc907.zip from cache
        Loading from cache
        Extracting archive
    Executing command (CWD): unzip 'poopsy//a09f70742b51d057ae7b643acff5cb64' -d '/home/waspinator/vendor/composer/663ac86b' && chmod -R u+w '/home/waspinator/vendor/composer/663ac86b'
    
    Created project in poopsy
    Reading ./composer.json
    Loading config file ./composer.json
    Failed to initialize global composer: Composer could not find the config file: /home/waspinator/.composer/composer.json
    To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
    Loading composer repositories with package information
    Downloading https://packagist.org/packages.json
    Writing /home/waspinator/.composer/cache/repo/https---packagist.org/packages.json into cache
    Installing dependencies (including require-dev)
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2013.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2014.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2015.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2015-04.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2015-07.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2015-10.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-2016-01.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-archived.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/p-provider-latest.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$app.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$cakephp.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-mobiledetect$mobiledetectlib.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$migrations.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$plugin-installer.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-nesbot$carbon.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-ircmaxell$password-compat.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-aura$intl.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-psr$log.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-robmorgan$phinx.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-aura$installer-default.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-symfony$console.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-symfony$config.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-symfony$class-loader.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-symfony$yaml.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-symfony$filesystem.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-symfony$polyfill-mbstring.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-psy$psysh.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-nikic$php-parser.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-dnoegel$php-xdg-base-dir.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-jakub-onderka$php-console-highlighter.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-jakub-onderka$php-console-color.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-symfony$var-dumper.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$debug-kit.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-jdorn$sql-formatter.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$bake.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$cache.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$collection.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$core.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$datasource.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$database.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$event.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$filesystem.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$i18n.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$log.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$orm.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$utility.json from cache
    Reading /home/waspinator/.composer/cache/repo/https---packagist.org/provider-cakephp$validation.json from cache
    Analyzed 1562 packages to resolve dependencies
    Analyzed 12415 rules to resolve dependencies
      - Installing aura/installer-default (1.0.0)
    Reading /home/waspinator/.composer/cache/files/aura/installer-default/52f8de3670cc1ef45a916f40f732937436d028c8.zip from cache
        Loading from cache
        Extracting archive
    Executing command (CWD): unzip '/home/waspinator/poopsy/vendor/aura/installer-default/9a3d9d7ea889b3fb918df436bec84cae' -d '/home/waspinator/poopsy/vendor/composer/896e397e' && chmod -R u+w '/home/waspinator/poopsy/vendor/composer/896e397e'
    
    Reading ./composer.json
    Loading config file ./composer.json
    Failed to initialize global composer: Composer could not find the config file: /home/waspinator/.composer/composer.json
    To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
    
    
      [RuntimeException]                                                                                              
      Plugin aura/installer-default is missing a require statement for a version of the composer-plugin-api package.  
    
    
    Exception trace:
     () at phar:///home/waspinator/apps/composer/composer.phar/src/Composer/Plugin/PluginManager.php:118
     Composer\Plugin\PluginManager->registerPackage() at phar:///home/waspinator/apps/composer/composer.phar/src/Composer/Installer/PluginInstaller.php:62
     Composer\Installer\PluginInstaller->install() at phar:///home/waspinator/apps/composer/composer.phar/src/Composer/Installer/InstallationManager.php:152
     Composer\Installer\InstallationManager->install() at phar:///home/waspinator/apps/composer/composer.phar/src/Composer/Installer/InstallationManager.php:139
     Composer\Installer\InstallationManager->execute() at phar:///home/waspinator/apps/composer/composer.phar/src/Composer/Installer.php:604
     Composer\Installer->doInstall() at phar:///home/waspinator/apps/composer/composer.phar/src/Composer/Installer.php:232
     Composer\Installer->run() at phar:///home/waspinator/apps/composer/composer.phar/src/Composer/Command/CreateProjectCommand.php:172
     Composer\Command\CreateProjectCommand->installProject() at phar:///home/waspinator/apps/composer/composer.phar/src/Composer/Command/CreateProjectCommand.php:130
     Composer\Command\CreateProjectCommand->execute() at phar:///home/waspinator/apps/composer/composer.phar/vendor/symfony/console/Command/Command.php:259
     Symfony\Component\Console\Command\Command->run() at phar:///home/waspinator/apps/composer/composer.phar/vendor/symfony/console/Application.php:840
     Symfony\Component\Console\Application->doRunCommand() at phar:///home/waspinator/apps/composer/composer.phar/vendor/symfony/console/Application.php:192
     Symfony\Component\Console\Application->doRun() at phar:///home/waspinator/apps/composer/composer.phar/src/Composer/Console/Application.php:167
     Composer\Console\Application->doRun() at phar:///home/waspinator/apps/composer/composer.phar/vendor/symfony/console/Application.php:123
     Symfony\Component\Console\Application->run() at phar:///home/waspinator/apps/composer/composer.phar/src/Composer/Console/Application.php:98
     Composer\Console\Application->run() at phar:///home/waspinator/apps/composer/composer.phar/bin/composer:43
     require() at /home/waspinator/apps/composer/composer.phar:25
    
    create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]
    
    1.x 
    opened by waspinator 2
Releases(3.0.1)
  • 3.0.1(Jan 28, 2022)

    CHANGELOG

    3.0.1

    • Moved from travis to github actions workflow.
    • Added yoast/phpunit-polyfills to support testing from 5.6 onwards.
    • Current supported php versions are 5.6 to 8.1
    • Using producer for release.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Jan 20, 2017)

    • Final release. No changes after first beta.
    • No BC breaks for 1.x users who are using as a library.
    • Aura.Framework 1.x users need to add the Di wiring configuration.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0-beta1(Dec 30, 2016)

    • Removed aura/installer-default from composer.json which was used by aura framework version 1 to install in package folder.
    • Fixes issue 17 by removing Aura.Di wiring trait tests.
    • Changed directory structure from PSR-0 to PSR-4.
    • Supported PHP version : 5.6+.
    • Good news is there is no other BC breaks.
    Source code(tar.gz)
    Source code(zip)
Owner
Aura for PHP
High-quality, well-tested, standards-compliant, decoupled libraries that can be used in any codebase.
Aura for PHP
Provides support for message translation and localization for dates and numbers.

The I18n library provides a I18n service locator that can be used for setting the current locale, building translation bundles and translating messages. Additionally, it provides the Time and Number classes which can be used to output dates, currencies and any numbers in the right format for the specified locale.

CakePHP 26 Oct 22, 2022
pH7CMS Internationalization package.

?? pH7CMS Internationalization (I18N) package ?? Get new languages for your pH7CMS website!

pH7 Social Dating CMS (pH7CMS) 18 Oct 5, 2022
A PHP internationalization library, powered by CLDR data.

intl A PHP 7.1+ internationalization library, powered by CLDR data. Features: NumberFormatter and CurrencyFormatter, inspired by intl. Currencies Lang

Commerce Guys 351 Dec 30, 2022
FBT - a internationalization framework for PHP designed to be not just powerful and flexible, but also simple and intuitive

FBT is an internationalization framework for PHP designed to be not just powerful and flexible, but also simple and intuitive. It helps with the follo

Richard Dobroň 4 Dec 23, 2022
The Translation component provides tools to internationalize your application.

Translation Component The Translation component provides tools to internationalize your application. Getting Started $ composer require symfony/transl

Symfony 6.4k Jan 6, 2023
Better translation management for Laravel

Better localization management for Laravel Introduction Keeping a project's translations properly updated is cumbersome. Usually translators do not ha

Waavi 354 Dec 18, 2022
[virion] Language management library for automatic translation

libtranslator :: library for automatic translation ✔️ Multilingual support for plugin messages ✔️ Translation language is set according to the player

PocketMine-MP projects of PresentKim 5 Jul 29, 2022
Laravel translation made __('simple').

Translation.io client for Laravel 5.5+/6/7/8 Add this package to localize your Laravel application. Use the official Laravel syntax (with PHP or JSON

Translation.io 109 Dec 29, 2022
🎌 Laravel Localization Helper :: Easily add translation variables from Blade templates.

LocalizationHelper Package for convenient work with Laravel's localization features and fast language files generation. Take a look at contributing.md

Awes.io 36 Jul 18, 2022
Manage Laravel translation files

Laravel 5 Translation Manager For Laravel 4, please use the 0.1 branch! This is a package to manage Laravel translation files. It does not replace the

Barry vd. Heuvel 1.5k Jan 4, 2023
A GUI for managing JSON translation files in your laravel projects.

Laravel Language Manager Langman is a GUI for managing your JSON language files in a Laravel project. Installation Begin by installing the package thr

Mohamed Said 515 Nov 30, 2022
A Gui To Manage Laravel Translation Files

Lingo A file based translation manager, which unlike other Lang managers don't need a database connection to handle the translation. Installation comp

Muah 97 Dec 5, 2022
Filament Translations - Manage your translation with DB and cache

Filament Translations Manage your translation with DB and cache, you can scan your languages tags like trans(), __(), and get the string inside and tr

Fady Mondy 32 Nov 28, 2022
Official PHP library for the DeepL language translation API.

deepl-php Official PHP client library for the DeepL API. The DeepL API is a language translation API that allows other computer programs to send texts

DeepL 78 Dec 23, 2022
French-Traduction-Pterodactyl est la traduction française de pterodactyl French-Traduction-Pterodactyl is the French translation of pterodactyl

French-Traduction-Pterodactyl Star French-Traduction-Pterodactyl est la traduction française de pterodactyl French-Traduction-Pterodactyl is the Frenc

null 5 Sep 26, 2022
Translation (i18n) Manager as a virion

TL Translation (i18n) Manager as a virion Translation use hook-like $t = $tl->useTranslation($player->getLocale()); $player->sendMessage($t("message-k

RedMC Network 3 Oct 28, 2022
Composer package providing translation features for PHP apps

PHP translation This is a composer package providing translation support for PHP applications. It is similar to gettext, in usage, with these differen

Sérgio Carvalho 0 Aug 15, 2022
Weblate translation provider for Symfony Translation.

Weblate Translation Provider This bundle provides a Weblate integration for Symfony Translation. Installation composer require m2mtech/weblate-transla

Martin Mandl 8 Sep 20, 2022
Provides support for message translation and localization for dates and numbers.

The I18n library provides a I18n service locator that can be used for setting the current locale, building translation bundles and translating messages. Additionally, it provides the Time and Number classes which can be used to output dates, currencies and any numbers in the right format for the specified locale.

CakePHP 26 Oct 22, 2022