Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

[READ-ONLY] Subtree split of the Symfony Translation Component -- clone into Symfony/Component/ (master at symfony/symfony)

Merge branch '2.4'

* 2.4:
  Little correction for case 'ar'
  No need to use mb functions here
  Fix doc-blocks
  Fix doc blocks
  [HttpFoundation] update phpdoc of SessionHandlerInterface and unify parameters of all handlers according to interface
  [Doctrine Bridge] fix DbalSessionHandler for high concurrency, interface compliance, compatibility with all drivers (oci8, mysqli, pdo with mysql, sqlsrv, sqlite)
  [Finder] Marked test skipped when ftp stream wrapper is not available

Conflicts:
	src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php
latest commit d456c7b751
Fabien Potencier fabpot authored April 18, 2014
Octocat-spinner-32 Catalogue Enforce sprintf for exceptions April 11, 2013
Octocat-spinner-32 Dumper Merge branch '2.4' April 16, 2014
Octocat-spinner-32 Exception [Translation] uniformized the way exception are thrown in LoaderInter… December 13, 2012
Octocat-spinner-32 Extractor made {@inheritdoc} annotations consistent across the board April 16, 2014
Octocat-spinner-32 Loader Merge branch '2.3' into 2.4 April 16, 2014
Octocat-spinner-32 Tests Merge branch '2.4' April 16, 2014
Octocat-spinner-32 Writer Fixed most of the docblocks/unused namespaces December 19, 2012
Octocat-spinner-32 .gitignore Added missing files .gitignore July 21, 2013
Octocat-spinner-32 CHANGELOG.md [Translation] Added template for relative file paths March 03, 2014
Octocat-spinner-32 IdentityTranslator.php [Translation] make IdentityTranslater consistent with normal translator November 20, 2013
Octocat-spinner-32 Interval.php fixed types in phpdocs April 16, 2014
Octocat-spinner-32 LICENSE update year on licenses January 07, 2014
Octocat-spinner-32 MessageCatalogue.php unified return null usages April 16, 2014
Octocat-spinner-32 MessageCatalogueInterface.php fixed types in phpdocs April 16, 2014
Octocat-spinner-32 MessageSelector.php made phpdoc types consistent with those defined in Hack April 15, 2014
Octocat-spinner-32 MetadataAwareInterface.php Fix doc blocks April 18, 2014
Octocat-spinner-32 PluralizationRules.php Merge branch '2.4' April 18, 2014
Octocat-spinner-32 README.md updated version to 2.5 November 24, 2013
Octocat-spinner-32 Translator.php added getLoaders() method September 27, 2013
Octocat-spinner-32 TranslatorInterface.php Merge branch '2.3' into 2.4 April 16, 2014
Octocat-spinner-32 composer.json updated version to 2.5 November 24, 2013
Octocat-spinner-32 phpunit.xml.dist made usage of Composer autoloader for subtree-split unit tests November 09, 2012
README.md

Translation Component

Translation provides tools for loading translation files and generating translated strings from these including support for pluralization.

use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\MessageSelector;
use Symfony\Component\Translation\Loader\ArrayLoader;

$translator = new Translator('fr_FR', new MessageSelector());
$translator->setFallbackLocales(array('fr'));
$translator->addLoader('array', new ArrayLoader());
$translator->addResource('array', array(
    'Hello World!' => 'Bonjour',
), 'fr');

echo $translator->trans('Hello World!')."\n";

Resources

Silex integration:

https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/TranslationServiceProvider.php

Documentation:

http://symfony.com/doc/2.5/book/translation.html

You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/Translation/
$ composer.phar install
$ phpunit
Something went wrong with that request. Please try again.