56 bool hasPlural =
false);
69 std::string targetText);
80 std::vector<std::string> targetTexts);
91 std::shared_ptr<TranslationUnit>
110 std::string
get(
const std::string& basicId,
int index = 0)
const;
121 int index = 0)
const;
134 const std::string& defaultValue,
135 int index = 0)
const;
147 const std::string& basicId,
148 const std::string& defaultValue,
149 int index = 0)
const;
158 std::vector<std::string>
getAll(
const std::string&
name)
const;
180 using KeyType = std::pair<std::string, int>;
181 using TranslationUnitRef = std::shared_ptr<TranslationUnit>;
182 std::map<KeyType, TranslationUnitRef> _map;
Information on plural forms for the supported languages.
Container class for a string and its translation.
flightgear::LanguageInfo::intType intType
std::shared_ptr< TranslationUnit > translationUnit(const std::string &name, int index=0) const
Return a shared pointer to a TranslationUnit.
TranslationResource()=delete
std::string getWithDefault(const std::string &basicId, const std::string &defaultValue, int index=0) const
Get a single translation, with default for missing or empty strings.
static void setupGhost()
Set up a Nasal type that wraps TranslationResource.
std::vector< std::string > getAll(const std::string &name) const
Get translations for all strings with a given element name.
void setFirstTargetText(std::string name, int index, std::string targetText)
Set the first target text of a translation unit.
void setTargetTexts(std::string name, int index, std::vector< std::string > targetTexts)
Set all target texts of a translation unit.
std::string getPlural(intType cardinalNumber, const std::string &basicId, int index=0) const
Same as get(), but for a string that has plural forms.
std::string getPluralWithDefault(intType cardinalNumber, const std::string &basicId, const std::string &defaultValue, int index=0) const
Same as getWithDefault(), but for a string that has plural forms.
std::string get(const std::string &basicId, int index=0) const
Get a single translation.
void addTranslationUnit(std::string name, int index, std::string sourceText, bool hasPlural=false)
Add a translation unit to the TranslationResource.
std::size_t getCount(const std::string &name) const
Get the number of translated strings with the given element name.