2017-01-13 1 views
1

symfony2는 변환 파일 이름이 도메인 .locale.loader (예 : messages.en_GB.po) 형식이어야합니다.Symfony2 사용자 정의 번역 파일 이름

레거시 시스템에서 나는 en_GB.po으로 저장된 파일을 가지고 있으므로 symfony가 그 파일들을로드하는 간단한 방법이 있는지 궁금합니다. 파일을로드 할 때

+0

당신이 파일 이름을 바꿀 수 없습니다? – insertusernamehere

답변

0

당신은 도메인을 자신의 로더를 가지고 추가 할 수 있습니다 : 당신은 당신의 응용 프로그램의 부트 스트랩에 다음을로드 할 수

$this->translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader()); 
    $this->translator->addResource('yaml', __DIR__.'/../../resources/translations/en_US.yml', 'en_US', 'addressing'); 
    $this->translator->addResource('yaml', __DIR__.'/../../resources/translations/es_ES.yml', 'es_ES', 'addressing'); 

:

를 대략 그것은 뭔가 같은 것 그것을위한 서비스.

여기에서 자세한 내용을보실 수 있습니다 : http://symfony.com/doc/current/components/translation/custom_formats.html