简体   繁体   English

单个YAML文件与不同文件夹和子文件夹中的多个YAML文件

[英]Single YAML file VS multiple YAML files in different folders and subfolders

I am working on automating the translation workflow and improving the Localization process as a whole of a Rails website. 我正在致力于自动化翻译工作流程并改善整个Rails网站的本地化过程。 I am using SimpleBackend so only YAML files are used for storing translations. 我正在使用SimpleBackend,因此仅YAML文件用于存储翻译。

The current locales directory consists of folders, then sub-folders (in some cases) and those sub-folders containing yml files. 当前的语言环境目录由文件夹,然后是子文件夹(在某些情况下)以及包含yml文件的子文件夹组成。 I am considering to integrate the project with some third-party tool like Transifex for translation management so may be using a single YAML file for each language may be good for management of workflow. 我正在考虑将该项目与Transifex之类的第三方工具集成,以进行翻译管理,因此对于每种语言使用单个YAML文件可能对工作流的管理很有帮助。

If someone can highlight the pros and cons of both structures then it would be really helpful to decide whether I should switch from nested file structure to single file pattern or not. 如果有人可以强调两种结构的优缺点,那么决定我是否应该从嵌套文件结构切换到单个文件模式将非常有帮助。 Also, the project is an Open-Source project with active contributors and so thinking for a long-term solution. 此外,该项目是一个具有积极贡献者的开源项目,因此正在考虑长期解决方案。

Thanks! 谢谢!

I think whatever tools you are using to make the process flow smoothly factors a lot in this decision. 我认为无论您使用什么工具来使流程平稳进行,在此决策中都起着很大的作用。 You should explore how exactly Transifex wants things to be structured in output, and try to keep your current input structure, and give that a shot before making a decision. 您应该探索Transifex如何精确地将输出结构化,并尝试保留当前的输入结构,并在做出决定之前先尝试一下。

However, in my opinion, for a large app with a lot of translatable text, my preference would be to allow for multiple yaml files in your default locale, and one or two consolidated yaml files for each foreign translation. 但是,我认为,对于具有大量可翻译文本的大型应用程序,我的偏好是在默认语言环境中允许多个yaml文件,并且每个外语翻译都允许一个或两个合并的yaml文件。 If there isn't a lot of translatable text in your app, maybe a single file is fine for you, but given it's already split up, there's a good chance that's the better choice. 如果您的应用程序中没有很多可翻译的文本,那么也许一个文件对您来说很好,但是考虑到它已经被分割,很有可能是更好的选择。 On a team with many contributors you can end up with a very high churn file (maybe with a lot of merge conflicts) that everyone changes all the time. 在一个由许多贡献者组成的团队中,您可能会得到一个很高的客户流失率文件(也许会有很多合并冲突),每个人都在不断变化。

Splitting into separate files lets you logically separate out text to match a domain in your app, like a separate yaml file for mailers (or even each mailer), and one for each domain (or controller). 拆分为单独的文件,您可以从逻辑上分离出文本以匹配应用程序中的域,例如为邮件(甚至每个邮件)提供单独的yaml文件,为每个域(或控制器)提供单独的yaml文件。 Either way, it puts you in control of your organization strategy. 无论哪种方式,它都使您可以控制组织策略。

However, there isn't a lot of value, IMO in separating your foreign translations to mirror that structure. 但是,IMO在分离您的外国翻译以反映该结构方面没有太多价值。 The systems I have experience with (not Transifex) generate your foreign translation files for you, so you just need to sync with the web interface and commit the results. 我经验丰富的系统(不是Transifex)会为您生成外部翻译文件,因此您只需要与Web界面同步并提交结果即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM