Translation infrastructure#
Important classes used to implement FlightGear translations are
FGLocale, FGTranslate,
TranslationDomain, TranslationResource,
TranslationUnit. There are also two parser classes:
DefaultTranslationParser and flightgear::XLIFFParser.
Base concepts like translation domains and resources (the latter being also known as translation contexts) are currently explained in locale.hxx.
In order to obtain translations at runtime, FGTranslate is a
convenient one-stop shop, however when fetching several strings from the same
resource, storing a reference to the appropriate
TranslationResource and querying it repeatedly is better (less
wasteful). Ditto with TranslationDomain when fetching
translations from the same domain, etc.
How to use these classes can be seen for instance in the test suite.
Some of the functions in FGLocale, such as
FGLocale::getLocalizedString() and friends, are very thin wrappers
around member functions of FGTranslate that keep
previously-existing code working. Those in FGTranslate and other
classes are more recent and likely more powerful (support for plural forms,
etc.).