Are there any general localization/translation alternatives to gettext?
Open source or proprietary doesn't matter.
When I say alternative to gettext, I mean a library for internationalization, with a localization backend of sorts.
The reason I'm asking is because (among other things) I find the way gettext does things slightly cumbersome and static, mostly in the backend bit.
Gettext works by, first, generating a template file with all the strings to be translated directly extracted from the source files, this template file is called a . pot file which stands for Portable Object Template.
The gettext function searches the currently selected message catalogs for a string which is equal to msgid . If there is such a string available it is returned.
gettext utilities are a set of tools that provides a framework to help other packages produce multi-lingual messages. The minimum version of the gettext utilities supported is 0.19.
First of all I think gettext
is one of the best at this point.
You may take a look on Boost.Locale
that may provide a better API and use gettext
's dictionary model: http://cppcms.sourceforge.net/boost_locale/docs/ (not official part of Boost, still beta).
Edit:
If you don't like gettext
...
These are translation technologies:
Now:
gettext
. Not bad solution, but limited to Qt. Not so useful in generic programs.Now what do we have?
GNU gettext
, widely used, has great tools, has great plural forms support, very popular in translators community...
So decide, do you really think that gettext is not so good solution?
I don't think so. You haven't worked with other solutions at all, so try to understand how it works at first place.
Fluent is a new system that offers a number of adaptations that gettext lacks. Where gettext supports pluralization, fluent has a generic framework for the text variants. Where gettext uses the "untranslated" string as its translation key, fluent supports an abstract key (allowing multiple translations for something that just happens to be homonymous in the source language. Here is a more extensive comparison.
An example of fluent .ftl file, taken from firefox's preferences codebase, looks like this:
# 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With