2012年9月10日 星期一

symfony translation


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

The term locale refers roughly to the user's language and country. It can be any string that your application uses to manage translations and other format differences (e.g. currency format). We recommended the ISO639-1 language code, an underscore (_), then the ISO3166 Alpha-2 country code (e.g. fr_FR for French/France).

Translations are handled by a Translator service that uses the user's locale to lookup and return translated messages. Before using it, enable the Translator in your configuration:
YAML
1
2
3
# app/config/config.yml
framework:
    translator: { fallback: en }

Translation Locations and Naming Conventions

Symfony2 looks for message files (i.e. translations) in the following locations:
  • the <kernel root directory>/Resources/translations directory;
  • the <kernel root directory>/Resources/<bundle name>/translations directory;
  • the Resources/translations/ directory of the bundle.
The locations are listed with the highest priority first. That is you can override the translation messages of a bundle in any of the top 2 directories

沒有留言:

張貼留言