同一种语言可以有两个翻译文件吗?
Is it possible to have two files of translation for the same language?
同一种语言可以有两个翻译文件吗?例如:
messages1.fr.yml
hello: "Salut"
messages2.fr.yml
here: "ici"
是的,它叫做translation domain
{{ "hello"|trans({},"messages1") }}
{{ "here"|trans({},"messages2") }}
在控制器中使用它是相同的逻辑:
参数是 the key
、the array of parameters
然后是 the translation domain
$this->get('translator')->trans('key', [], 'yourDomain);
你的情况
$this->get('translator')->trans('hello', [], 'message1);
同一种语言可以有两个翻译文件吗?例如:
messages1.fr.yml
hello: "Salut"
messages2.fr.yml
here: "ici"
是的,它叫做translation domain
{{ "hello"|trans({},"messages1") }}
{{ "here"|trans({},"messages2") }}
在控制器中使用它是相同的逻辑:
参数是 the key
、the array of parameters
然后是 the translation domain
$this->get('translator')->trans('key', [], 'yourDomain);
你的情况
$this->get('translator')->trans('hello', [], 'message1);