为什么gettext没有db存储选项? [英] Why doesn't gettext have a db storage option?

查看:112
本文介绍了为什么gettext没有db存储选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Django的Web应用程序上做了一些i18n,它使用gettext作为其i18n基础。似乎一个明显的想法是,翻译应该存储在数据库中,并不难做,但文件系统上的po文件仍在使用中。为什么是这样?

I'm doing some i18n on a web-based app using Django, which uses gettext as its i18n foundation. It seems like an obvious idea that translations should be stored in the database, and not difficult to do, but po files on the filesystem are still being used. Why is this?

我目前的怀疑是,开发数据库备份的好处远远超过了gettext作为一个完善的包的可靠性/熟悉度。有没有其他重要的原因继续存储在文件系统上的翻译?

My current suspicion is that the benefits of developing a db backaged are simply outweighed by the reliability/familiarity of gettext as a well-established package. Are there other significant reasons for continuing to store the translations on the filesystem?

推荐答案

性能是主要原因。 Gettext 不使用数据库,因为数据库总是比文件慢得多。字典的加载时间非常重要,因此几乎所有人都在使用文件。

Performance is the main reason. Gettext is not using a database because a database will always be considerably slower than a file. The load time of the dictionary is very important and for this reason almost everyone is using files for that.

另外,编译的gettext文件(。 mo )针对内存中的加载进行了优化,因此它们比纯文本文件(如未编译的 .po 文件)更合适。

Also, the compiled gettext files (.mo) are optimized for loading in memory and for this reason they are more appropriate than plain text files (like not-compiled .po files).

您可以随时使用翻译平台(可能使用数据库后端)进行翻译,并将结果导出到文本文件。示例: Pootle Narro Launchpad Rosetta Transifex(仅托管)

You can always use translation platform, probably that uses a database backend, for doing the translation and export the results to text files. Examples: Pootle, Narro, Launchpad Rosetta, Transifex (hosted only).

不要将您的应用程序语言文件与本地化数据库。您的应用程序应使用快速加载的基于文件的字典,并且您的本地化系统可能必须使用数据库,并且可以逻辑地将数据导出到文件。

Do not confuse your application language files with the localization database. Your application should use file based dictionaries that are fast to load and your localization system probably will have to use a database and logically be able to export data to files.

由方式,使用 gettext 可能是您可能会对本地化做出最好的技术决策。我从来没有看到任何商业解决方案或内部开发,以便能够在功能,工具甚至支持上与之竞争。

By the way, using gettext is probably the best technological decision you may be able to make regarding localization. I never seen any commercial solution or in-house developed to be able to compete with it on features, tools and even support.

这篇关于为什么gettext没有db存储选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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