FlightGear next
flightgear::LanguageInfo Class Reference

Class providing information on plural forms. More...

#include <LanguageInfo.hxx>

Public Types

using intType = long long
 

Static Public Member Functions

static std::size_t getNumberOfPluralForms (const std::string &languageId)
 Return the number of plural forms in the specified language.
 
static std::size_t getPluralFormIndex (const std::string &languageId, intType number)
 Return the index of the plural form to use for a number of “items”
 

Detailed Description

Class providing information on plural forms.

Languages known to this class are identified by a languageId string which is "default" for the default translation, otherwise the value of /sim/intl/locale[n]/language-id for the selected locale.

Plural forms are identified by an index that starts from 0. Whenever possible, we use the same order as Qt Linguist for plural forms in a given language.

When retrieving a translation that has plural form, one obtains the index of the plural form to use by providing a “cardinal number” (a number of “items” of any kind, which could be concrete objects or abstract things) to a language-dependent function. This class contains a map from languageId strings to such functions, which is used by getPluralFormIndex().

Definition at line 37 of file LanguageInfo.hxx.

Member Typedef Documentation

◆ intType

Definition at line 40 of file LanguageInfo.hxx.

Member Function Documentation

◆ getNumberOfPluralForms()

std::size_t flightgear::LanguageInfo::getNumberOfPluralForms ( const std::string & languageId)
static

Return the number of plural forms in the specified language.

Definition at line 91 of file LanguageInfo.cxx.

◆ getPluralFormIndex()

std::size_t flightgear::LanguageInfo::getPluralFormIndex ( const std::string & languageId,
intType number )
static

Return the index of the plural form to use for a number of “items”

Definition at line 107 of file LanguageInfo.cxx.


The documentation for this class was generated from the following files: