You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
934 B

3 years ago
  1. Translation Component
  2. =====================
  3. The Translation component provides tools to internationalize your application.
  4. Getting Started
  5. ---------------
  6. ```
  7. $ composer require symfony/translation
  8. ```
  9. ```php
  10. use Symfony\Component\Translation\Translator;
  11. use Symfony\Component\Translation\Loader\ArrayLoader;
  12. $translator = new Translator('fr_FR');
  13. $translator->addLoader('array', new ArrayLoader());
  14. $translator->addResource('array', [
  15. 'Hello World!' => 'Bonjour !',
  16. ], 'fr_FR');
  17. echo $translator->trans('Hello World!'); // outputs « Bonjour ! »
  18. ```
  19. Resources
  20. ---------
  21. * [Documentation](https://symfony.com/doc/current/translation.html)
  22. * [Contributing](https://symfony.com/doc/current/contributing/index.html)
  23. * [Report issues](https://github.com/symfony/symfony/issues) and
  24. [send Pull Requests](https://github.com/symfony/symfony/pulls)
  25. in the [main Symfony repository](https://github.com/symfony/symfony)