OpenTTD Source 20241224-master-gee860a5c8e
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< LanguageMetadataLanguageList
 Type for the list of language meta data.
 

Functions

bool ReadLanguagePack (const LanguageMetadata *lang)
 Read a particular language.
 
const LanguageMetadataGetLanguage (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
newgrflangidNewGRF 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()

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

◆ _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().