OpenTTD Source: src/language.h File Reference

OpenTTD Source 15.0-beta1

Data Structures | Typedefs | Functions | Variables
language.h File Reference

Information about languages and their files. More...

`#include <unicode/coll.h>`
`#include "strings_type.h"`
`#include <filesystem>`

Go to the source code of this file.

## Data Structures
struct | LanguagePackHeader
| Header of a language file. More...
struct | LanguageMetadata
| Make sure the size is right. More...

## Typedefs
typedef std::vector< LanguageMetadata > | LanguageList
| Type for the list of language meta data.

## Functions
bool | ReadLanguagePack (const LanguageMetadata *lang)
| Read a particular language.
const LanguageMetadata * | GetLanguage (uint8_t newgrflangid)
| Get the language with the given NewGRF language ID.

## Variables
static const uint8_t | CASE_GENDER_LEN = 16
| The (maximum) length of a case/gender string.
static const uint8_t | MAX_NUM_GENDERS = 8
| Maximum number of supported genders.
static const uint8_t | MAX_NUM_CASES = 16
| Maximum number of supported cases.
LanguageList | _languages
| The actual list of language meta data.
const LanguageMetadata * | _current_language
| The currently loaded language.
std::unique_ptr< icu::Collator > | _current_collator
| Collator for the language currently in use.

## Detailed Description

Information about languages and their files.

Definition in file language.h.

## Typedef Documentation

## ◆ LanguageList

typedef std::vector<LanguageMetadata> LanguageList

Type for the list of language meta data.

Definition at line 98 of file language.h.

## Function Documentation

## ◆ GetLanguage()

const LanguageMetadata * GetLanguage | ( | uint8_t | newgrflangid | ) |

Get the language with the given NewGRF language ID.

Parameters

  newgrflangid | NewGRF languages ID to check.

Returns
  The language's metadata, or nullptr if it is not known.

Definition at line 2072 of file strings.cpp.

References _languages.

Referenced by FillLanguageList(), and GlobalVarChangeInfo().

## ◆ ReadLanguagePack()

bool ReadLanguagePack | ( | const LanguageMetadata * | lang | ) |

Read a particular language.

Parameters

  lang | The metadata about the language.

Returns
  Whether the loading went okay or not.

Definition at line 1937 of file strings.cpp.

References _config_language_file, _current_collator, _current_language, _current_text_dir, BuildContentTypeStringList(), BuildIndustriesLegend(), LanguageMetadata::file, FS2OTTD(), GetString(), Layouter::Initialize(), InitializeSortedCargoSpecs(), InvalidateWindowClassesData(), LanguagePackHeader::isocode, LoadedLanguagePack::langtab_num, LoadedLanguagePack::langtab_start, LoadedLanguagePack::list_separator, MacOSSetCurrentLocaleName(), LanguagePackHeader::newgrflangid, ReadFileToMem(), ReconsiderGameScriptLanguage(), SetCurrentGrfLangID(), SortIndustryTypes(), TAB_SIZE, LanguagePackHeader::text_dir, TEXT_TAB_END, WC_AIRCRAFT_LIST, WC_BUILD_VEHICLE, WC_INDUSTRY_DIRECTORY, WC_ROADVEH_LIST, WC_SHIPS_LIST, WC_STATION_LIST, and WC_TRAINS_LIST.

Referenced by InitializeLanguagePacks(), and GameOptionsWindow::OnDropdownSelect().

## Variable Documentation

## ◆ _current_collator

std::unique_ptr<icu::Collator> _current_collator
| extern

Collator for the language currently in use.

Definition at line 59 of file strings.cpp.

Referenced by ICUStringContains(), ReadLanguagePack(), and StrNaturalCompare().

## ◆ _current_language

const LanguageMetadata* _current_language
| extern

The currently loaded language.

Definition at line 54 of file strings.cpp.

Referenced by GameOptionsWindow::BuildDropDownList(), SelectGameWindow::DrawWidget(), UnmappedChoiceList::Flush(), ICUParagraphLayoutFactory::InitializeLayouter(), SelectGameWindow::OnInit(), SelectGameWindow::OnResize(), ReadLanguagePack(), ReconsiderGameScriptLanguage(), GameOptionsWindow::SetStringParameters(), ICURun::Shape(), SurveyConfiguration(), and UniscribeItemizeString().

## ◆ _languages

LanguageList _languages
| extern

The actual list of language meta data.

Definition at line 53 of file strings.cpp.

Referenced by GameOptionsWindow::BuildDropDownList(), FillLanguageList(), GetLanguage(), InitializeLanguagePacks(), and GameOptionsWindow::OnDropdownSelect().

## ◆ CASE_GENDER_LEN

const uint8_t CASE_GENDER_LEN = 16
| static

The (maximum) length of a case/gender string.

Definition at line 19 of file language.h.

## ◆ MAX_NUM_CASES

const uint8_t MAX_NUM_CASES = 16
| static

Maximum number of supported cases.

Definition at line 21 of file language.h.

Referenced by LanguagePackHeader::GetCaseIndex(), GlobalVarChangeInfo(), FileStringReader::HandlePragma(), and LanguagePackHeader::IsValid().

## ◆ MAX_NUM_GENDERS

const uint8_t MAX_NUM_GENDERS = 8
| static

Maximum number of supported genders.

Definition at line 20 of file language.h.

Referenced by LanguagePackHeader::GetGenderIndex(), GlobalVarChangeInfo(), FileStringReader::HandlePragma(), and LanguagePackHeader::IsValid().