Tor*_*amo 27 localization gettext internationalization
gettext是否有任何通用的本地化/翻译替代方案?
开源或专有无关紧要.
当我说替代gettext时,我的意思是一个国际化的图书馆,有一个本地化的后端.
我问的原因是因为(除其他外)我发现gettext的方式稍微麻烦和静态,主要是在后端位.
Art*_*yom 43
首先,我认为这gettext
是目前最好的之一.
您可以看一下Boost.Locale
可能提供更好的API和使用gettext
的字典模型:http://cppcms.sourceforge.net/boost_locale/docs/(不是Boost的官方部分,仍然是测试版).
编辑:
如果你不喜欢gettext
......
这些是翻译技术:
现在:
gettext
.不错的解决方案,但仅限于Qt.在通用程序中不太有用.现在我们有什么?
GNU gettext
,广泛使用,有很棒的工具,有很多复数形式支持,在翻译社区很受欢迎......
那么决定,你真的认为gettext不是那么好的解决方案吗?
我不这么认为.您根本没有使用其他解决方案,因此请首先了解它的工作原理.
Fluent是一个新系统,它提供了许多 gettext 所缺乏的适应性。在 gettext 支持复数的地方,fluent 有一个用于文本变体的通用框架。在 gettext 使用“未翻译”字符串作为其翻译键的情况下,fluent 支持抽象键(允许对恰好在源语言中同名的内容进行多次翻译。 这是一个更广泛的比较。
一个流畅的 .ftl 文件示例,取自firefox 的首选项代码库,如下所示:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
blocklist-window =
.title = Block Lists
.style = width: 55em
blocklist-description = Choose the list { -brand-short-name } uses to block online trackers. Lists provided by <a data-l10n-name="disconnect-link" title="Disconnect">Disconnect</a>.
blocklist-close-key =
.key = w
blocklist-treehead-list =
.label = List
blocklist-button-cancel =
.label = Cancel
.accesskey = C
blocklist-button-ok =
.label = Save Changes
.accesskey = S
# This template constructs the name of the block list in the block lists dialog.
# It combines the list name and description.
# e.g. "Standard (Recommended). This list does a pretty good job."
#
# Variables:
# $listName {string, "Standard (Recommended)."} - List name.
# $description {string, "This list does a pretty good job."} - Description of the list.
blocklist-item-list-template = { $listName } { $description }
blocklist-item-moz-std-listName = Level 1 block list (Recommended).
blocklist-item-moz-std-description = Allows some trackers so fewer websites break.
blocklist-item-moz-full-listName = Level 2 block list.
blocklist-item-moz-full-description = Blocks all detected trackers. Some websites or content may not load properly.
Run Code Online (Sandbox Code Playgroud)