Sylius:为语言环境添加翻译 [英] Sylius: Adding Translations for locale

查看:28
本文介绍了Sylius:为语言环境添加翻译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Sylius/Sylius 包进行开发,并希望为我的访问者提供荷兰语界面.并非所有字符串都被翻译成荷兰语,有些字符串做得不好.我现在的问题是,如果不直接接触 Sylius 包,添加/覆盖翻译的最佳方法是什么?

I'm using the Sylius/Sylius package for development and would like to serve my visitors with a Dutch interface. Not all strings are translated to Dutch, and some are done poorly. My question now is, without touching the Sylius bundles directly, what would be the best way to add/override translations?

因为我想重新使用这些翻译,我正在编写我自己的 Sylius 包装器",它在当前的方法中扩展了 Sylius 包并拥有自己的 Resources/translations 文件夹.例如:MyWebBundle 通过 getParent() 扩展 SyliusWebBundle 并有一个 Resource/translations/messages.nl.yml包含荷兰语字符串的文件.

Because I want to re-use these translations I'm writing my own Sylius "wrapper", which in its current approach extends the Sylius bundles and have their own Resources/translations folder. For example: MyWebBundle extends SyliusWebBundle through getParent() and has a Resource/translations/messages.nl.yml file containing Dutch strings.

我期待听到您的想法.

推荐答案

由于翻译与包无关,而是与域相关,因此您可以从任何地方覆盖翻译.来自 app/Resources/translations/ 或来自您的包 Resources/translations/ 目录.

Since translations are not related to bundles, but to domains, you can overwrite the translations from anywhere. Either from app/Resources/translations/ or from your bundles Resources/translations/ directory.

不幸的是,Sylius 正确地缺少翻译域并且仅使用消息,这有点混乱,但 GitHub 上已经有讨论.翻译是 Sylius 中一个非常活跃的部分,可以随时更改.

Unfortunately Sylius is correctly missing a translations domain and uses only messages, this is a little mess, but there is already a discussion on GitHub. Translations is a very living part in Sylius and can change evrytime.

这篇关于Sylius:为语言环境添加翻译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆