now*_*iko 6 php translation internationalization symfony
众所周知,Symfony2在这些目录中寻找翻译:
YourBundle\Resources\translations\ - here lot of .yml files
app\Resources\translations\ - here lot of .yml files
Run Code Online (Sandbox Code Playgroud)
但是如果我想把我的翻译放进去怎么办?
MyBundle\Resources\translations\2015_04_23\ - and lot of .yml files will lay here
我阅读了文档,但没有看到解决方案,有可能吗?也许我省略了部分文档?有人能帮助我吗?谢谢!
您的操作与文档中的操作完全相同,但是当您使用翻译加载器时,您可以通过选择自己的目录来添加翻译:
$translator->addResource('my_format', __DIR__.'/translations/messages.txt', 'fr_FR');
Run Code Online (Sandbox Code Playgroud)
(只需替换__DIR__为您明智选择的目录,例如,如果您使用动态文件,请务必小心:您应该使用例如服务来确保您的代码易于维护)