nowiko
nowiko

Reputation: 2567

How Symfony2 load translations from translations folder

I want to wrote the simple bundle, and I need to know how Symfony2 gets all translations from the Resources/translations of each bundle, before it will be placed into cache/catalogue.locale.yml I find the Translator class what generate file for cache, but how getting translations and parses into key => value format I dont know/

Upvotes: 1

Views: 1037

Answers (1)

Abdallah Arffak
Abdallah Arffak

Reputation: 1193

Check this

Symfony\Component\Translation\MessageCatalogue

this

private function doLoadCatalogue($locale)
    {
        ....
    }

in Symfony\Component\Translation\Translator

and this

protected function loadCatalogue($locale)
{
 ....
\$catalogue%s = new MessageCatalogue('%s', %s);
.....
 var_export($this->catalogues[$fallback]->all(), true),
...
}

in Symfony\Bundle\FrameworkBundle\Translation\Translator

If you want to do a translation bundle, you can take a look at this 'JMSTranslationBundle' bundle check this bundle

https://github.com/schmittjoh/JMSTranslationBundle

Upvotes: 2

Related Questions