17#include <simgear/props/propsfwd.hxx>
18#include <simgear/misc/strutils.hxx>
176 const std::string& context,
191 const std::string& resource,
192 const std::string& defaultValue = {});
203 const std::string& resource);
211 const std::string& context)
const;
222 std::string
localizedPrintf(
const char*
id,
const char* resource, ... );
224 std::string
vlocalizedPrintf(
const char*
id,
const char* resource, va_list args);
261 const SGPath& xmlFile,
const std::string& domain,
262 const std::string& resource);
276 const std::string& domain);
287 const std::string& domain);
289 const std::string& domain);
335 void loadXLIFF(
const SGPath& basePath, SGPropertyNode* localeNode,
336 const std::string& domain);
342 static std::string removeEncodingPart(
const std::string& locale);
343 std::shared_ptr<const flightgear::TranslationDomain> getDomain(
344 const std::string& domain)
const;
351 bool _inited =
false;
354 using TranslationDomainRef = std::shared_ptr<flightgear::TranslationDomain>;
355 std::map<std::string, TranslationDomainRef> _domains;
363std::string
fgTrMsg(
const char* key);
Container for all TranslationResource's belonging to a domain.
void loadAircraftTranslations()
void loadDefaultTranslation(const simgear::Dir &defaultTranslationDir, const std::string &domain)
Load all default translation files from the specified directory.
std::string getLocalizedStringWithIndex(const std::string &id, const std::string &context, int index) const
Obtain a single translation with the given identifier, context and index.
std::size_t getLocalizedStringCount(const std::string &id, const std::string &context) const
Return the number of strings with a given id in the specified context.
bool selectLanguage(const std::string &language={})
Select the locale's primary language according to user-level, system-level language settings and the ...
FGLocale(SGPropertyNode *root)
void loadCoreResourcesForDefaultTranslation()
Load the core default translation ('atc', 'menu', 'options', 'sys', etc.).
std::string getLanguageId() const
Return the value of _languageId, which uniquely identifies the language for the LanguageInfo class (h...
std::string vlocalizedPrintf(const char *id, const char *resource, va_list args)
std::string _languageId
This is used to fetch linguistic data such as the number of plural forms for the selected locale.
static void utf8toLatin1(std::string &s)
Simple UTF8 to Latin1 encoder.
void loadAddonTranslations()
void loadResourcesFromAircraftOrAddonDir(const SGPath &basePath, const std::string &domain)
From an add-on or aircraft directory, load the default translation and, if available,...
std::string _currentLocaleString
Corresponds to user's language settings, possibly overridden by the –language value.
string_list getUserLanguages() const
Obtain user's default language settings.
std::vector< std::string > getLocalizedStrings(const std::string &id, const std::string &resource)
Obtain a list of translations that share the same tag name (id stem).
std::string localizedPrintf(const char *id, const char *resource,...)
Obtain a message string, from a localized resource ID, and use it as a printf format string.
void loadXLIFF(const SGPath &basePath, SGPropertyNode *localeNode, const std::string &domain)
Load an XLIFF 1.2 file.
void loadXLIFFFromAircraftOrAddonDir(const SGPath &basePath, const std::string &domain)
SGPropertyNode_ptr _currentLocale
SGPropertyNode * findLocaleNode(const std::string &language)
Find a property node matching the given language.
void loadResourceForDefaultTranslation(const SGPath &xmlFile, const std::string &domain, const std::string &resource)
Load default strings for the requested resource ("atc", "menu", etc.).
std::string getDefaultFont(const char *fallbackFont)
Obtain default font for current locale.
void clear()
reset all data in the locale.
SGPropertyNode_ptr selectLanguageNode(SGPropertyNode *langs) const
Given a node with children corresponding to different language / locale codes, select one based on th...
std::string findLanguageId() const
Return the appropriate value for _languageId according to _currentLocale.
SGPropertyNode_ptr _fallbackLocale
Proper locale (corresponding to a /sim/intl/locale[n] node, as opposed to the default translation) us...
std::string getLocalizedString(const std::string &id, const std::string &resource, const std::string &defaultValue={})
Obtain a single string matching the given id, with fallback.
std::string getPreferredLanguage() const
Return the preferred language according to user choice and/or settings.
Class that holds translation resources within a domain.
std::vector< std::string > string_list
std::string fgTrPrintfMsg(const char *key,...)
std::string fgTrMsg(const char *key)
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...