Thursday, March 15, 2012

Core - Internal Structures - Multilingual support

The Symfony framework supports "internationalization". Rather than writing strings directly we abstract the text we wish to display through a translator and display the result for the locale or language in use. This translator is not automatic but built up by the developer, by building up message catalogues for each language.

In simple terms this means that instead of:

echo "Welcome" ;

we will do something like this:

echo $this->get('translator')->trans('Welcome');

For each locale supported we will have entries to display the translation of 'Welcome':

# messages.fr.yml
'Welcome': Bienvenue


Though the initial system locale will be in English; I hope, that with help, I can expand to include Irish and other languages.

No comments:

Post a Comment