OpenTTD Source 20241224-master-gf74b0cf984
|
Handling of translated strings. More...
#include "stdafx.h"
#include "currency.h"
#include "station_base.h"
#include "town.h"
#include "waypoint_base.h"
#include "depot_base.h"
#include "industry.h"
#include "newgrf_text.h"
#include "fileio_func.h"
#include "signs_base.h"
#include "fontdetection.h"
#include "error.h"
#include "error_func.h"
#include "strings_func.h"
#include "rev.h"
#include "core/endian_func.hpp"
#include "timer/timer_game_calendar.h"
#include "vehicle_base.h"
#include "engine_base.h"
#include "language.h"
#include "townname_func.h"
#include "string_func.h"
#include "company_base.h"
#include "smallmap_gui.h"
#include "window_func.h"
#include "debug.h"
#include "game/game_text.hpp"
#include "network/network_content_gui.h"
#include "newgrf_engine.h"
#include "core/backup_type.hpp"
#include "gfx_layout.h"
#include <stack>
#include <charconv>
#include "table/strings.h"
#include "table/control_codes.h"
#include "3rdparty/fmt/std.h"
#include "strings_internal.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | LanguagePack |
struct | LanguagePackDeleter |
struct | LoadedLanguagePack |
struct | UnitConversion |
Helper for unit conversion. More... | |
struct | Units |
Information about a specific unit system. More... | |
struct | UnitsLong |
Information about a specific unit system with a long variant. More... | |
class | LanguagePackGlyphSearcher |
Helper for searching through the language pack. More... | |
Functions | |
void | SetDParam (size_t n, uint64_t v) |
Set a string parameter v at index n in the global string parameter array. | |
uint64_t | GetDParam (size_t n) |
Get the current string parameter at index n from the global string parameter array. | |
void | SetDParamMaxValue (size_t n, uint64_t max_value, uint min_count, FontSize size) |
Set DParam n to some number that is suitable for string size computations. | |
void | SetDParamMaxDigits (size_t n, uint count, FontSize size) |
Set DParam n to some number that is suitable for string size computations. | |
void | CopyInDParam (const std::span< const StringParameterData > backup) |
Copy the parameters from the backup into the global string parameter array. | |
void | CopyOutDParam (std::vector< StringParameterData > &backup, size_t num) |
Copy num string parameters from the global string parameter array to the backup. | |
bool | HaveDParamChanged (const std::span< const StringParameterData > backup) |
Checks whether the global string parameters have changed compared to the given backup. | |
static void | StationGetSpecialString (StringBuilder &builder, StationFacility x) |
static void | GetSpecialTownNameString (StringBuilder &builder, int ind, uint32_t seed) |
static void | GetSpecialNameString (StringBuilder &builder, int ind, StringParameters &args) |
static void | FormatString (StringBuilder &builder, const char *str_arg, StringParameters &args, uint case_index, bool game_script, bool dry_run) |
Parse most format codes within a string and write the result to a buffer. | |
std::string_view | GetListSeparator () |
Get the list separator string for the current language. | |
const char * | GetStringPtr (StringID string) |
void | GetStringWithArgs (StringBuilder &builder, StringID string, StringParameters &args, uint case_index, bool game_script) |
Get a parsed string with most special stringcodes replaced by the string parameters. | |
std::string | GetString (StringID string) |
Resolve the given StringID into a std::string with all the associated DParam lookups and formatting. | |
void | AppendStringInPlace (std::string &result, StringID string) |
Resolve the given StringID and append in place into an existing std::string with all the associated DParam lookups and formatting. | |
std::string | GetStringWithArgs (StringID string, StringParameters &args) |
Get a parsed string with most special stringcodes replaced by the string parameters. | |
void | SetDParamStr (size_t n, const char *str) |
This function is used to "bind" a C string to a OpenTTD dparam slot. | |
void | SetDParamStr (size_t n, const std::string &str) |
This function is used to "bind" the C string of a std::string to a OpenTTD dparam slot. | |
void | SetDParamStr (size_t n, std::string &&str) |
This function is used to "bind" the std::string to a OpenTTD dparam slot. | |
static const char * | GetDecimalSeparator () |
static void | FormatNumber (StringBuilder &builder, int64_t number, const char *separator) |
Format a number into a string. | |
static void | FormatCommaNumber (StringBuilder &builder, int64_t number) |
static void | FormatNoCommaNumber (StringBuilder &builder, int64_t number) |
static void | FormatZerofillNumber (StringBuilder &builder, int64_t number, int count) |
static void | FormatHexNumber (StringBuilder &builder, uint64_t number) |
static void | FormatBytes (StringBuilder &builder, int64_t number) |
Format a given number as a number of bytes with the SI prefix. | |
static void | FormatYmdString (StringBuilder &builder, TimerGameCalendar::Date date, uint case_index) |
static void | FormatMonthAndYear (StringBuilder &builder, TimerGameCalendar::Date date, uint case_index) |
static void | FormatTinyOrISODate (StringBuilder &builder, TimerGameCalendar::Date date, StringID str) |
static void | FormatGenericCurrency (StringBuilder &builder, const CurrencySpec *spec, Money number, bool compact) |
static int | DeterminePluralForm (int64_t count, int plural_form) |
Determine the "plural" index given a plural form and a number. | |
static const char * | ParseStringChoice (const char *b, uint form, StringBuilder &builder) |
static const Units | GetVelocityUnits (VehicleType type) |
Get the correct velocity units depending on the vehicle type and whether we're using real-time units. | |
uint | ConvertSpeedToDisplaySpeed (uint speed, VehicleType type) |
Convert the given (internal) speed to the display speed. | |
uint | ConvertDisplaySpeedToSpeed (uint speed, VehicleType type) |
Convert the given display speed to the (internal) speed. | |
uint | ConvertKmhishSpeedToDisplaySpeed (uint speed, VehicleType type) |
Convert the given km/h-ish speed to the display speed. | |
uint | ConvertDisplaySpeedToKmhishSpeed (uint speed, VehicleType type) |
Convert the given display speed to the km/h-ish speed. | |
static std::span< const char *const > | GetSurnameOptions () |
static const char * | GetSurname (uint32_t seed) |
Get the surname of the president with the given seed. | |
static void | GenAndCoName (StringBuilder &builder, uint32_t seed) |
static void | GenPresidentName (StringBuilder &builder, uint32_t seed) |
bool | ReadLanguagePack (const LanguageMetadata *lang) |
Read a particular language. | |
const char * | GetCurrentLocale (const char *param) |
Determine the current charset based on the environment First check some default values, after this one we passed ourselves and if none exist return the value for $LANG. | |
const LanguageMetadata * | GetLanguage (uint8_t newgrflangid) |
Get the language with the given NewGRF language ID. | |
static bool | GetLanguageFileHeader (const std::string &file, LanguagePackHeader *hdr) |
Reads the language file header and checks compatibility. | |
static void | FillLanguageList (const std::string &path) |
Search for the languages in the given directory and add them to the _languages list. | |
void | InitializeLanguagePacks () |
Make a list of the available language packs. | |
const char * | GetCurrentLanguageIsoCode () |
Get the ISO language code of the currently loaded language. | |
void | CheckForMissingGlyphs (bool base_font, MissingGlyphSearcher *searcher) |
Check whether the currently loaded language pack uses characters that the currently loaded font does not support. | |
Variables | |
std::string | _config_language_file |
The file (name) stored in the configuration. | |
LanguageList | _languages |
The actual list of language meta data. | |
const LanguageMetadata * | _current_language = nullptr |
The currently loaded language. | |
TextDirection | _current_text_dir |
Text direction of the currently selected language. | |
std::unique_ptr< icu::Collator > | _current_collator |
Collator for the language currently in use. | |
ArrayStringParameters< 20 > | _global_string_params |
static LoadedLanguagePack | _langpack |
static bool | _scan_for_gender_data = false |
Are we scanning for the gender of the current string? (instead of formatting it) | |
static const Units | _units_velocity_calendar [] |
Unit conversions for velocity. | |
static const Units | _units_velocity_realtime [] |
Unit conversions for velocity. | |
static const Units | _units_power [] |
Unit conversions for power. | |
static const Units | _units_power_to_weight [] |
Unit conversions for power to weight. | |
static const UnitsLong | _units_weight [] |
Unit conversions for weight. | |
static const UnitsLong | _units_volume [] |
Unit conversions for volume. | |
static const Units | _units_force [] |
Unit conversions for force. | |
static const Units | _units_height [] |
Unit conversions for height. | |
static const Units | _units_time_days_or_seconds [] |
Unit conversions for time in calendar days or wallclock seconds. | |
static const Units | _units_time_months_or_minutes [] |
Unit conversions for time in calendar months or wallclock minutes. | |
static const Units | _units_time_years_or_periods [] |
Unit conversions for time in calendar years or economic periods. | |
static const Units | _units_time_years_or_minutes [] |
Unit conversions for time in calendar years or wallclock minutes. | |
static const char *const | _silly_company_names [] |
static const char *const | _surname_list [] |
static const char *const | _silly_surname_list [] |
static const char | _initial_name_letters [] |
Handling of translated strings.
Definition in file strings.cpp.
void AppendStringInPlace | ( | std::string & | result, |
StringID | string | ||
) |
Resolve the given StringID and append in place into an existing std::string with all the associated DParam lookups and formatting.
result | The std::string to place the translated string. |
string | The unique identifier of the translatable string. |
Definition at line 345 of file strings.cpp.
References GetStringWithArgs().
Referenced by DrawRoadVehDetails(), BuildIndustryWindow::MakeCargoListString(), DepotWindow::OnRightClick(), and ShowErrorMessage().
void CheckForMissingGlyphs | ( | bool | base_font, |
MissingGlyphSearcher * | searcher | ||
) |
Check whether the currently loaded language pack uses characters that the currently loaded font does not support.
If this is the case an error message will be shown in English. The error message will not be localized because that would mean it might use characters that are not in the font, which is the whole reason this check has been added.
base_font | Whether to look at the base font as well. |
searcher | The methods to use to search for strings to check. If nullptr the loaded language pack searcher is used. |
Definition at line 2291 of file strings.cpp.
References _current_text_dir, MissingGlyphSearcher::FindMissingGlyphs(), FontCacheSubSetting::font, InitFontCache(), INVALID_STRING_ID, LoadStringWidthTable(), FontCacheSettings::medium, FontCacheSettings::mono, MissingGlyphSearcher::Monospace(), FontCacheSubSetting::os_handle, SetDParamStr(), SetFallbackFont(), ShowErrorMessage(), TD_LTR, Utf8Encode(), WL_ERROR, and WL_WARNING.
Referenced by HandleBootstrap(), LoadIntroGame(), TextfileWindow::LoadText(), GameOptionsWindow::OnClick(), and GameOptionsWindow::OnDropdownSelect().
uint ConvertDisplaySpeedToKmhishSpeed | ( | uint | speed, |
VehicleType | type | ||
) |
Convert the given display speed to the km/h-ish speed.
speed | the speed to convert |
Definition at line 916 of file strings.cpp.
References Units::c, UnitConversion::FromDisplay(), and GetVelocityUnits().
Referenced by TimetableWindow::OnQueryTextFinished().
uint ConvertDisplaySpeedToSpeed | ( | uint | speed, |
VehicleType | type | ||
) |
Convert the given display speed to the (internal) speed.
speed | the speed to convert |
Definition at line 896 of file strings.cpp.
References Units::c, UnitConversion::FromDisplay(), and GetVelocityUnits().
Referenced by OrdersWindow::OnQueryTextFinished().
uint ConvertKmhishSpeedToDisplaySpeed | ( | uint | speed, |
VehicleType | type | ||
) |
Convert the given km/h-ish speed to the display speed.
speed | the speed to convert |
Definition at line 906 of file strings.cpp.
References Units::c, GetVelocityUnits(), and UnitConversion::ToDisplay().
Referenced by FormatString(), and TimetableWindow::OnClick().
uint ConvertSpeedToDisplaySpeed | ( | uint | speed, |
VehicleType | type | ||
) |
Convert the given (internal) speed to the display speed.
speed | the speed to convert |
Definition at line 883 of file strings.cpp.
References Units::c, GetVelocityUnits(), and UnitConversion::ToDisplay().
Referenced by DrawOrderString(), OrdersWindow::OnClick(), and OrdersWindow::SetStringParameters().
void CopyInDParam | ( | const std::span< const StringParameterData > | backup | ) |
Copy the parameters from the backup into the global string parameter array.
backup | The backup to copy from. |
Definition at line 159 of file strings.cpp.
Referenced by DrawNewsString(), ErrmsgWindow::DrawWidget(), TooltipsWindow::DrawWidget(), NewsWindow::DrawWidget(), ErrmsgWindow::SetStringParameters(), QueryWindow::SetStringParameters(), ErrmsgWindow::UpdateWidgetSize(), TooltipsWindow::UpdateWidgetSize(), and NewsWindow::UpdateWidgetSize().
void CopyOutDParam | ( | std::vector< StringParameterData > & | backup, |
size_t | num | ||
) |
Copy num string parameters from the global string parameter array to the backup.
backup | The backup to write to. |
num | Number of string parameters to copy. |
Definition at line 171 of file strings.cpp.
Referenced by ErrorMessageData::CopyOutDParams(), and NewsItem::NewsItem().
|
static |
Determine the "plural" index given a plural form and a number.
count | The number to get the plural index of. |
plural_form | The plural form we want an index for. |
Definition at line 587 of file strings.cpp.
References abs().
Referenced by FormatString().
|
static |
Search for the languages in the given directory and add them to the _languages list.
path | the base directory to search in |
Definition at line 2108 of file strings.cpp.
References _languages, Debug, LanguageMetadata::file, FS2OTTD(), GetLanguage(), GetLanguageFileHeader(), LanguagePackHeader::newgrflangid, and OTTD2FS().
Referenced by InitializeLanguagePacks().
|
static |
Format a given number as a number of bytes with the SI prefix.
builder | the string builder to write to |
number | the number of bytes to write down |
Definition at line 467 of file strings.cpp.
References lengthof, and NBSP.
Referenced by FormatString().
|
static |
Definition at line 440 of file strings.cpp.
|
static |
Definition at line 520 of file strings.cpp.
|
static |
Definition at line 457 of file strings.cpp.
|
static |
Definition at line 503 of file strings.cpp.
|
static |
Definition at line 447 of file strings.cpp.
|
static |
Format a number into a string.
builder | the string builder to write to |
number | the number to write down |
separator | the thousands-separator to use |
Definition at line 412 of file strings.cpp.
|
static |
Parse most format codes within a string and write the result to a buffer.
builder | The string builder to write the final string to. |
str_arg | The original string with format codes. |
args | Pointer to extra arguments used by various string codes. |
dry_run | True when the args' type data is not yet initialized. |
Definition at line 928 of file strings.cpp.
References _scan_for_gender_data, _settings_game, _sorted_cargo_specs, _units_force, _units_height, _units_power, _units_power_to_weight, _units_time_days_or_seconds, _units_time_months_or_minutes, _units_time_years_or_minutes, _units_time_years_or_periods, _units_volume, _units_weight, StringParameters::AdvanceOffset(), UnitsLong::c, CALLBACK_FAILED, CBID_VEHICLE_NAME, CBM_VEHICLE_NAME, ConvertKmhishSpeedToDisplaySpeed(), CreateTextRefStackBackup(), Debug, DEFAULT_GROUP, DeterminePluralForm(), FormatBytes(), FormatString(), GB(), CargoSpec::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_depot_pool >::Get(), CargoSpec::GetArraySize(), GetCurrency(), StringParameters::GetDataLeft(), GetGRFStringID(), SpecializedStation< Station, false >::GetIfValid(), SpecializedStation< Waypoint, true >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_sign_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetIfValid(), GetIndustrySpec(), GetListSeparator(), StringParameters::GetNextParameter(), StringParameters::GetNextParameterString(), StringParameters::GetOffset(), StringParameters::GetRemainingParameters(), GetStringTab(), GetStringWithArgs(), StringParameters::GetTypeAtOffset(), GetVehicleCallback(), GetVelocityUnits(), Vehicle::group_id, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsInsideMM(), IsValidCargoID(), Company::IsValidHumanID(), lengthof, GameSettings::locale, MakeStringID(), BaseConsist::name, BaseStation::name, CompanyProperties::name, Group::name, IndustrySpec::name, Town::name, CompanyProperties::name_1, CompanyProperties::name_2, Group::number, PowerOfTen(), CompanyProperties::president_name, CompanyProperties::president_name_1, CompanyProperties::president_name_2, CargoSpec::quantifier, RemapNewGRFStringControlCode(), RestoreTextRefStackBackup(), SCC_NEWGRF_FIRST, SCC_NEWGRF_PRINT_WORD_STRING_ID, SCC_NEWGRF_STRINL, StringParameters::SetOffset(), StartTextRefStackUsage(), IndustrySpec::station_name, StopTextRefStackUsage(), BaseStation::string_id, TAB_SIZE_GAMESCRIPT, TEXT_TAB_GAMESCRIPT_START, UnitConversion::ToDisplay(), BaseStation::town, Industry::town, Depot::town_cn, Waypoint::town_cn, Industry::type, BaseVehicle::type, Vehicle::unitnumber, LocaleSettings::units_force, LocaleSettings::units_height, LocaleSettings::units_power, CargoSpec::units_volume, LocaleSettings::units_volume, LocaleSettings::units_weight, UsingNewGRFTextStack(), TimerGameEconomy::UsingWallclockUnits(), Utf8Decode(), StringBuilder::Utf8Encode(), Utf8Encode(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by FormatString(), and GetStringWithArgs().
|
static |
Definition at line 511 of file strings.cpp.
|
static |
Definition at line 495 of file strings.cpp.
|
static |
Definition at line 452 of file strings.cpp.
|
static |
Definition at line 1855 of file strings.cpp.
|
static |
Definition at line 1861 of file strings.cpp.
const char * GetCurrentLanguageIsoCode | ( | ) |
Get the ISO language code of the currently loaded language.
Definition at line 2183 of file strings.cpp.
Referenced by GameOptionsWindow::DrawWidget(), GetTextfile(), and GameOptionsWindow::OnResize().
const char * GetCurrentLocale | ( | const char * | param | ) |
Determine the current charset based on the environment First check some default values, after this one we passed ourselves and if none exist return the value for $LANG.
param | environment variable to check conditionally if default ones are not set. Pass nullptr if you don't want additional checks. |
Definition at line 2046 of file strings.cpp.
Referenced by InitializeLanguagePacks().
|
static |
Definition at line 399 of file strings.cpp.
uint64_t GetDParam | ( | size_t | n | ) |
Get the current string parameter at index n from the global string parameter array.
n | Index of the string parameter. |
Definition at line 114 of file strings.cpp.
Referenced by ErrorMessageData::CopyOutDParams().
const LanguageMetadata * GetLanguage | ( | uint8_t | newgrflangid | ) |
Get the language with the given NewGRF language ID.
newgrflangid | NewGRF languages ID to check. |
Definition at line 2072 of file strings.cpp.
References _languages.
Referenced by FillLanguageList(), and GlobalVarChangeInfo().
|
static |
Reads the language file header and checks compatibility.
file | the file to read |
hdr | the place to write the header information to |
Definition at line 2087 of file strings.cpp.
References LanguagePackHeader::IsValid(), LanguagePackHeader::missing, FileHandle::Open(), and LanguagePackHeader::winlangid.
Referenced by FillLanguageList().
std::string_view GetListSeparator | ( | ) |
Get the list separator string for the current language.
Definition at line 229 of file strings.cpp.
References LoadedLanguagePack::list_separator.
Referenced by BuildCargoAcceptanceString(), NetworkContentListWindow::DrawDetails(), DrawRoadVehDetails(), and FormatString().
|
static |
Definition at line 1876 of file strings.cpp.
|
static |
Definition at line 1765 of file strings.cpp.
std::string GetString | ( | StringID | string | ) |
Resolve the given StringID into a std::string with all the associated DParam lookups and formatting.
string | The unique identifier of the translatable string. |
Definition at line 333 of file strings.cpp.
References GetStringWithArgs().
Referenced by StringFilter::AddLine(), Textbuf::Assign(), Subsidy::AwardTo(), BuildCargoAcceptanceString(), BuildGuiGroupList(), CargoSpecNameSorter(), ClassTagNameFilter(), CmdFoundTown(), CmdGiveMoney(), CompanyNewsInformation::CompanyNewsInformation(), NewGRFInspectWindow::DrawMainPanelWidget(), DrawNewsString(), DrawRoadVehDetails(), DrawString(), DrawStringMultiLine(), EngineNameSorter(), ErrorUnknownCallbackResult(), BuildVehicleWindow::FilterByText(), FiosGetFileList(), GenerateCompanyName(), GenerateDefaultSaveName(), GeneratePresidentName(), GetCargoSuffix(), BuildHouseWindow::GetHouseInformation(), BuildHouseWindow::GetHouseYear(), GetKeyboardLayout(), BaseSet< T, Tnum_files, Tsearch_in_tars >::GetListLabel(), GetNewGRFAdditionalText(), GetStringBoundingBox(), GetStringHeight(), GetStringLineCount(), IndustryTypeNameSorter(), BuildIndustryWindow::MakeCargoListString(), NetworkHandlePauseChange(), NetworkServerSendChat(), LandInfoWindow::OnInit(), SignListWindow::OnInit(), SelectGameWindow::OnResize(), openttd_main(), ReadLanguagePack(), ServerNetworkGameSocketHandler::Receive_CLIENT_ERROR(), ClientNetworkGameSocketHandler::Receive_SERVER_CHAT(), StoryBookWindow::RefreshSelectedPage(), SaveFileToDisk(), SaveHighScoreValue(), SaveHighScoreValueNetwork(), SaveOrLoad(), Script_CreateDummy(), ServerNetworkAdminSocketHandler::SendCompanyInfo(), ServerNetworkAdminSocketHandler::SendCompanyUpdate(), ServerNetworkAdminSocketHandler::SendError(), ServerNetworkGameSocketHandler::SendError(), ShowErrorMessage(), ShowNewGrfVehicleError(), TownActionRoadRebuild(), TranslateGRFStrings(), TypeTagNameFilter(), ScanProgressWindow::UpdateNewGRFScanStatus(), ViewportSign::UpdatePosition(), and VehicleNameSorter().
const char * GetStringPtr | ( | StringID | string | ) |
Definition at line 234 of file strings.cpp.
void GetStringWithArgs | ( | StringBuilder & | builder, |
StringID | string, | ||
StringParameters & | args, | ||
uint | case_index, | ||
bool | game_script | ||
) |
Get a parsed string with most special stringcodes replaced by the string parameters.
builder | The builder of the string. |
string | The ID of the string to parse. |
args | Arguments for the string. |
case_index | The "case index". This will only be set when FormatString wants to print the string in a different case. |
game_script | The string is coming directly from a game script. |
Definition at line 257 of file strings.cpp.
References Debug, FormatString(), GetGameStringPtr(), GetGRFStringPtr(), StringParameters::GetNextParameter(), GetStringIndex(), GetStringTab(), GetStringWithArgs(), LoadedLanguagePack::langtab_num, TEXT_TAB_GAMESCRIPT_START, and TEXT_TAB_NEWGRF_START.
Referenced by AppendStringInPlace(), FormatString(), GetString(), GetStringWithArgs(), GetStringWithArgs(), and GetTownName().
std::string GetStringWithArgs | ( | StringID | string, |
StringParameters & | args | ||
) |
Get a parsed string with most special stringcodes replaced by the string parameters.
string | The ID of the string to parse. |
args | Arguments for the string. |
Definition at line 358 of file strings.cpp.
References GetStringWithArgs().
|
static |
Get the surname of the president with the given seed.
seed | The seed the surname was generated from. |
Definition at line 1849 of file strings.cpp.
References GB().
|
static |
Definition at line 1838 of file strings.cpp.
|
static |
Get the correct velocity units depending on the vehicle type and whether we're using real-time units.
type | VehicleType to convert velocity for. |
Definition at line 866 of file strings.cpp.
References _settings_game, _units_velocity_calendar, _units_velocity_realtime, lengthof, GameSettings::locale, LocaleSettings::units_velocity, LocaleSettings::units_velocity_nautical, TimerGameEconomy::UsingWallclockUnits(), VEH_AIRCRAFT, and VEH_SHIP.
Referenced by ConvertDisplaySpeedToKmhishSpeed(), ConvertDisplaySpeedToSpeed(), ConvertKmhishSpeedToDisplaySpeed(), ConvertSpeedToDisplaySpeed(), and FormatString().
bool HaveDParamChanged | ( | const std::span< const StringParameterData > | backup | ) |
Checks whether the global string parameters have changed compared to the given backup.
backup | The backup to check against. |
Definition at line 184 of file strings.cpp.
void InitializeLanguagePacks | ( | ) |
Make a list of the available language packs.
Put the data in _languages list.
< Matching the language in the configuration file or the current locale
< Using pt_PT for pt_BR locale when pt_BR is not available
< Fallback when no locale-matching language has been found
Definition at line 2136 of file strings.cpp.
References _config_language_file, _languages, LanguageMetadata::file, FillLanguageList(), FS2OTTD(), GetCurrentLocale(), LANG_DIR, and ReadLanguagePack().
Referenced by openttd_main().
|
static |
Definition at line 708 of file strings.cpp.
bool ReadLanguagePack | ( | const LanguageMetadata * | lang | ) |
Read a particular language.
lang | The metadata about the language. |
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().
void SetDParam | ( | size_t | n, |
uint64_t | v | ||
) |
Set a string parameter v at index n in the global string parameter array.
n | Index of the string parameter. |
v | Value of the string parameter. |
Definition at line 104 of file strings.cpp.
Referenced by AdvertiseIndustryOpening(), AgeVehicle(), AircraftEntersTerminal(), AircraftHandleDestTooFar(), Subsidy::AwardTo(), BuildCargoAcceptanceString(), StoryBookWindow::BuildDropDownList(), GameOptionsWindow::BuildDropDownList(), BuildGuiGroupList(), BuildReplacementVehicle(), CalcRaildirsDrawstyle(), CcBuildIndustry(), ChangeIndustryProduction(), CheckAllowRemoveRoad(), CheckCompanyHasMoney(), ClientNetworkGameSocketHandler::CheckConnection(), CheckEngines(), CheckforTownRating(), CheckIfAuthorityAllowsNewStation(), CheckIndustries(), CheckOrders(), CheckTownRoadTypes(), CheckTrainCollision(), CheckTrainsLengths(), ClearTile_Station(), ClearTile_Town(), CmdBuildAirport(), CmdBuildBridge(), CmdCompanyCtrl(), CmdDecreaseLoan(), CmdFoundTown(), CmdGiveMoney(), CmdIncreaseLoan(), CmdIndustrySetProduction(), CompanyCheckBankrupt(), CompanyNewsInformation::CompanyNewsInformation(), CrashAirplane(), Disaster_CoalMine_Init(), DisasterTick_Aircraft(), DisasterTick_Big_Ufo(), DisasterTick_Zeppeliner(), StationViewWindow::DrawAcceptedCargo(), DrawAircraftDetails(), DrawAircraftPurchaseInfo(), TimetableWindow::DrawArrivalDeparturePanel(), StationViewWindow::DrawCargoRatings(), NetworkClientListWindow::DrawCompany(), CompanyInfrastructureWindow::DrawCountLine(), NetworkContentListWindow::DrawDetails(), DrawEngineList(), StationViewWindow::DrawEntries(), BaseGraphWindow::DrawGraph(), VehicleGroupWindow::DrawGroupInfo(), IndustryViewWindow::DrawInfo(), NewGRFInspectWindow::DrawMainPanelWidget(), DrawOrderString(), DrawPrice(), TownAuthorityWindow::DrawRatings(), DrawRoadVehDetails(), NetworkGameWindow::DrawServerLine(), SettingEntry::DrawSetting(), DrawShipDetails(), DrawSmallOrderList(), DrawStationCoverageAreaText(), TimetableWindow::DrawSummaryPanel(), TimetableWindow::DrawTimetablePanel(), SmallMapWindow::DrawTowns(), DrawTrainDetails(), DepotWindow::DrawVehicleInDepot(), BaseVehicleListWindow::DrawVehicleListItems(), DrawVehiclePurchaseInfo(), DrawVehicleRefitWindow(), ReplaceVehicleWindow::DrawWidget(), CheatWindow::DrawWidget(), SelectCompanyLiveryWindow::DrawWidget(), CompanyInfrastructureWindow::DrawWidget(), CompanyWindow::DrawWidget(), BuyCompanyWindow::DrawWidget(), EnginePreviewWindow::DrawWidget(), SaveLoadWindow::DrawWidget(), FramerateWindow::DrawWidget(), FrametimeGraphWindow::DrawWidget(), GSConfigWindow::DrawWidget(), GenerateProgressWindow::DrawWidget(), GraphLegendWindow::DrawWidget(), PaymentRatesGraphWindow::DrawWidget(), PerformanceRatingDetailWindow::DrawWidget(), IndustryProductionGraphWindow::DrawWidget(), VehicleGroupWindow::DrawWidget(), BuildIndustryWindow::DrawWidget(), SelectGameWindow::DrawWidget(), PerformanceLeagueWindow::DrawWidget(), ScriptLeagueWindow::DrawWidget(), MusicTrackSelectionWindow::DrawWidget(), MusicWindow::DrawWidget(), BaseNetworkContentDownloadStatusWindow::DrawWidget(), NetworkJoinStatusWindow::DrawWidget(), SpriteAlignerWindow::DrawWidget(), NewGRFParametersWindow::DrawWidget(), ScanProgressWindow::DrawWidget(), MessageHistoryWindow::DrawWidget(), ScriptListWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), GameSettingsWindow::DrawWidget(), SignListWindow::DrawWidget(), SmallMapWindow::DrawWidget(), CompanyStationsWindow::DrawWidget(), SelectStationWindow< T >::DrawWidget(), StatusBarWindow::DrawWidget(), StoryBookWindow::DrawWidget(), SubsidyListWindow::DrawWidget(), TownAuthorityWindow::DrawWidget(), TownViewWindow::DrawWidget(), TownDirectoryWindow::DrawWidget(), VehicleDetailsWindow::DrawWidget(), VehicleViewWindow::DrawWidget(), DrawYearColumn(), EngineNameSorter(), ErrorUnknownCallbackResult(), BuildVehicleWindow::FilterByText(), FloodVehicle(), GenerateCompanyName(), GenerateDefaultSaveName(), GeneratePresidentName(), BuildBridgeWindow::GetBridgeSelectString(), RefitWindow::GetCapacityString(), StationViewWindow::GetEntryString(), BuildHouseWindow::GetHouseInformation(), BuildHouseWindow::GetHouseYear(), IndustryDirectoryWindow::GetIndustryString(), BaseSet< T, Tnum_files, Tsearch_in_tars >::GetListLabel(), GetRailTypeDropDownList(), BaseGraphWindow::GetYLabelWidth(), GRFLoadConfig(), Vehicle::HandlePathfindingResult(), IndustryProductionCallback(), CommandHelperBase::InternalExecuteProcessResult(), LoadTownData(), BuildIndustryWindow::MakeCargoListString(), MakeScreenshotWithConfirm(), NetworkHandlePauseChange(), NetworkServerSendChat(), NewVehicleAvailable(), BuildVehicleWindow::OnClick(), CheatWindow::OnClick(), SelectCompanyManagerFaceWindow::OnClick(), CompanyWindow::OnClick(), DepotWindow::OnClick(), GSConfigWindow::OnClick(), GenerateLandscapeWindow::OnClick(), CreateScenarioWindow::OnClick(), IndustryViewWindow::OnClick(), NetworkStartServerWindow::OnClick(), NewGRFParametersWindow::OnClick(), OrdersWindow::OnClick(), ScriptSettingsWindow::OnClick(), GameSettingsWindow::OnClick(), CustomCurrencyWindow::OnClick(), StationViewWindow::OnClick(), TimetableWindow::OnClick(), TownViewWindow::OnClick(), VehicleViewWindow::OnClick(), WaypointWindow::OnClick(), GenerateLandscapeWindow::OnDropdownSelect(), NetworkClientListWindow::OnDropdownSelect(), SelectCompanyManagerFaceWindow::OnInit(), LandInfoWindow::OnInit(), SmallMapWindow::OnInit(), BuildAirportWindow::OnPaint(), EndGameWindow::OnPaint(), HighScoreWindow::OnPaint(), GameSettingsWindow::OnPaint(), BuildIndustryWindow::OnPlaceObject(), CompanyWindow::OnResize(), SelectGameWindow::OnResize(), DepotWindow::OnRightClick(), ReplaceVehicleWindow::OnTooltip(), IndustryCargoesWindow::OnTooltip(), LinkGraphLegendWindow::OnTooltip(), RealMakeScreenshot(), ClientNetworkGameSocketHandler::Receive_SERVER_CHAT(), StoryBookWindow::RefreshSelectedPage(), ReportNewsProductionChangeIndustry(), RoadVehArrivesAt(), SaveHighScoreValue(), SaveHighScoreValueNetwork(), ServerNetworkAdminSocketHandler::SendCompanyInfo(), ServerNetworkAdminSocketHandler::SendCompanyUpdate(), ServiceIntervalSettingsValueText(), SetDParamMaxDigits(), SetDParamsForOwnedBy(), SelectCompanyManagerFaceWindow::SetFaceStringParameters(), NIHelper::SetObjectAtStringParameters(), NIHelper::SetSimpleStringParameters(), AIConfigWindow::SetStringParameters(), BuildAirportWindow::SetStringParameters(), ReplaceVehicleWindow::SetStringParameters(), BuildVehicleWindow::SetStringParameters(), CompanyFinancesWindow::SetStringParameters(), SelectCompanyLiveryWindow::SetStringParameters(), CompanyInfrastructureWindow::SetStringParameters(), CompanyWindow::SetStringParameters(), BuyCompanyWindow::SetStringParameters(), SetDateWindow::SetStringParameters(), DepotWindow::SetStringParameters(), FramerateWindow::SetStringParameters(), FrametimeGraphWindow::SetStringParameters(), GenerateLandscapeWindow::SetStringParameters(), CreateScenarioWindow::SetStringParameters(), GoalListWindow::SetStringParameters(), GoalQuestionWindow::SetStringParameters(), IndustryProductionGraphWindow::SetStringParameters(), VehicleGroupWindow::SetStringParameters(), BuildIndustryWindow::SetStringParameters(), IndustryViewWindow::SetStringParameters(), IndustryDirectoryWindow::SetStringParameters(), IndustryCargoesWindow::SetStringParameters(), QueryStringWindow::SetStringParameters(), MusicTrackSelectionWindow::SetStringParameters(), ContentTextfileWindow::SetStringParameters(), NetworkStartServerWindow::SetStringParameters(), NetworkClientListWindow::SetStringParameters(), SpriteAlignerWindow::SetStringParameters(), NewGRFParametersWindow::SetStringParameters(), NewGRFTextfileWindow::SetStringParameters(), NewGRFWindow::SetStringParameters(), NewsWindow::SetStringParameters(), BuildObjectWindow::SetStringParameters(), OrdersWindow::SetStringParameters(), OskWindow::SetStringParameters(), BuildRailToolbarWindow::SetStringParameters(), BuildSignalWindow::SetStringParameters(), BuildRoadToolbarWindow::SetStringParameters(), ScriptListWindow::SetStringParameters(), ScriptSettingsWindow::SetStringParameters(), ScriptTextfileWindow::SetStringParameters(), ScriptDebugWindow::SetStringParameters(), BaseSetTextfileWindow::SetStringParameters(), GameOptionsWindow::SetStringParameters(), GameSettingsWindow::SetStringParameters(), CustomCurrencyWindow::SetStringParameters(), SignListWindow::SetStringParameters(), SignWindow::SetStringParameters(), SmallMapWindow::SetStringParameters(), CompanyStationsWindow::SetStringParameters(), StationViewWindow::SetStringParameters(), StoryBookWindow::SetStringParameters(), TimetableWindow::SetStringParameters(), ScenarioEditorToolbarWindow::SetStringParameters(), TownAuthorityWindow::SetStringParameters(), TownViewWindow::SetStringParameters(), TownDirectoryWindow::SetStringParameters(), RefitWindow::SetStringParameters(), VehicleListWindow::SetStringParameters(), VehicleDetailsWindow::SetStringParameters(), VehicleViewWindow::SetStringParameters(), ExtraViewportWindow::SetStringParameters(), WaypointWindow::SetStringParameters(), SetTimetableParams(), SettingsValueAbsolute(), SettingsValueVelocityUnit(), SetupSubsidyDecodeParam(), IntSettingDesc::SetValueDParams(), ShipArrivesAt(), ShowCostOrIncomeAnimation(), SetDateWindow::ShowDateDropDown(), ShowEstimatedCostOrIncome(), ShowFeederIncomeAnimation(), ShowFillingPercent(), ShowNewGRFError(), ShowNewGrfVehicleError(), ShowRefitOptionsList(), ShowRejectOrAcceptNews(), ToolbarScenDatePanel(), TownActionBuyRights(), TownActionRoadRebuild(), TrainDetailsCapacityTab(), TrainDetailsCargoTab(), TrainDetailsInfoTab(), TrainEnterStation(), UpdateFillingPercent(), SettingEntry::UpdateFilterState(), Sign::UpdateVirtCoord(), Town::UpdateVirtCoord(), Station::UpdateVirtCoord(), Waypoint::UpdateVirtCoord(), ReplaceVehicleWindow::UpdateWidgetSize(), CheatWindow::UpdateWidgetSize(), SelectCompanyLiveryWindow::UpdateWidgetSize(), CompanyWindow::UpdateWidgetSize(), BuyCompanyWindow::UpdateWidgetSize(), DepotWindow::UpdateWidgetSize(), EnginePreviewWindow::UpdateWidgetSize(), FramerateWindow::UpdateWidgetSize(), FrametimeGraphWindow::UpdateWidgetSize(), GenerateLandscapeWindow::UpdateWidgetSize(), CreateScenarioWindow::UpdateWidgetSize(), BaseGraphWindow::UpdateWidgetSize(), PaymentRatesGraphWindow::UpdateWidgetSize(), PerformanceRatingDetailWindow::UpdateWidgetSize(), IndustryProductionGraphWindow::UpdateWidgetSize(), PerformanceLeagueWindow::UpdateWidgetSize(), ScriptLeagueWindow::UpdateWidgetSize(), MusicTrackSelectionWindow::UpdateWidgetSize(), MessageHistoryWindow::UpdateWidgetSize(), GameSettingsWindow::UpdateWidgetSize(), CustomCurrencyWindow::UpdateWidgetSize(), SelectStationWindow< T >::UpdateWidgetSize(), StatusBarWindow::UpdateWidgetSize(), ScenarioEditorToolbarWindow::UpdateWidgetSize(), TownAuthorityWindow::UpdateWidgetSize(), TownDirectoryWindow::UpdateWidgetSize(), VehicleDetailsWindow::UpdateWidgetSize(), VehicleEnterDepot(), VehicleNameSorter(), VpSelectTilesWithMethod(), and VpSetPresizeRange().
void SetDParamMaxDigits | ( | size_t | n, |
uint | count, | ||
FontSize | size | ||
) |
Set DParam n to some number that is suitable for string size computations.
n | Index of the string parameter. |
count | Number of digits which shall be displayable. |
size | Font of the number |
Definition at line 143 of file strings.cpp.
References GetBroadestDigit(), and SetDParam().
Referenced by GetUnitNumberWidth(), SetDParamMaxValue(), DepotWindow::UpdateWidgetSize(), FramerateWindow::UpdateWidgetSize(), BuildIndustryWindow::UpdateWidgetSize(), BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(), NetworkJoinStatusWindow::UpdateWidgetSize(), SpriteAlignerWindow::UpdateWidgetSize(), ScanProgressWindow::UpdateWidgetSize(), TimetableWindow::UpdateWidgetSize(), and TownDirectoryWindow::UpdateWidgetSize().
void SetDParamMaxValue | ( | size_t | n, |
uint64_t | max_value, | ||
uint | min_count, | ||
FontSize | size | ||
) |
Set DParam n to some number that is suitable for string size computations.
n | Index of the string parameter. |
max_value | The biggest value which shall be displayed. For the result only the number of digits of max_value matter. |
min_count | Minimum number of digits independent of max. |
size | Font of the number |
Definition at line 127 of file strings.cpp.
References SetDParamMaxDigits().
Referenced by VehicleGroupWindow::ComputeGroupInfoSize(), TimetableWindow::DrawTimetablePanel(), OrdersWindow::DrawWidget(), CheatWindow::UpdateWidgetSize(), CompanyFinancesWindow::UpdateWidgetSize(), CompanyInfrastructureWindow::UpdateWidgetSize(), CompanyWindow::UpdateWidgetSize(), SetDateWindow::UpdateWidgetSize(), DepotWindow::UpdateWidgetSize(), GenerateLandscapeWindow::UpdateWidgetSize(), CreateScenarioWindow::UpdateWidgetSize(), GenerateProgressWindow::UpdateWidgetSize(), BaseGraphWindow::UpdateWidgetSize(), PerformanceRatingDetailWindow::UpdateWidgetSize(), NetworkGameWindow::UpdateWidgetSize(), NetworkJoinStatusWindow::UpdateWidgetSize(), NewGRFParametersWindow::UpdateWidgetSize(), ScanProgressWindow::UpdateWidgetSize(), SignListWindow::UpdateWidgetSize(), StatusBarWindow::UpdateWidgetSize(), TimetableWindow::UpdateWidgetSize(), and VehicleDetailsWindow::UpdateWidgetSize().
void SetDParamStr | ( | size_t | n, |
const char * | str | ||
) |
This function is used to "bind" a C string to a OpenTTD dparam slot.
n | slot of the string |
str | string to bind |
Definition at line 371 of file strings.cpp.
Referenced by Subsidy::AwardTo(), GameOptionsWindow::BuildDropDownList(), CheckForMissingGlyphs(), CmdCompanyCtrl(), CmdCustomNewsItem(), CmdFoundTown(), CmdIndustrySetProduction(), CompanyCheckBankrupt(), NetworkClientListWindow::DrawCompany(), NetworkContentListWindow::DrawDetails(), IndustryViewWindow::DrawInfo(), GoalListWindow::DrawListColumn(), AIConfigWindow::DrawWidget(), FramerateWindow::DrawWidget(), GSConfigWindow::DrawWidget(), GoalQuestionWindow::DrawWidget(), ScriptLeagueWindow::DrawWidget(), LandInfoWindow::DrawWidget(), MusicTrackSelectionWindow::DrawWidget(), MusicWindow::DrawWidget(), BaseNetworkContentDownloadStatusWindow::DrawWidget(), SpriteAlignerWindow::DrawWidget(), NewGRFParametersWindow::DrawWidget(), NewsWindow::DrawWidget(), ScriptListWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), GameOptionsWindow::DrawWidget(), StoryBookWindow::DrawWidget(), TownViewWindow::DrawWidget(), ErrorUnknownCallbackResult(), FiosGetFileList(), GenerateCompanyName(), TownViewWindow::GetDesiredInfoHeight(), StoryBookWindow::GetHeadHeight(), IndustryDirectoryWindow::GetIndustryString(), BaseSet< T, Tnum_files, Tsearch_in_tars >::GetListLabel(), StoryBookWindow::GetPageElementHeight(), GetSavegameFormat(), GetSaveLoadErrorMessage(), GraphicsSetLoadConfig(), GRFLoadConfig(), IndustryProductionCallback(), LoadTownData(), BuildIndustryWindow::MakeCargoListString(), NetworkDrawChatMessage(), NetworkGameWindow::OnClick(), NetworkStartServerWindow::OnClick(), NetworkClientListWindow::OnClick(), CustomCurrencyWindow::OnClick(), TextfileWindow::OnClick(), NetworkClientListWindow::OnDropdownSelect(), LandInfoWindow::OnInit(), IConsoleWindow::OnPaint(), GoalListWindow::OnPaint(), HighScoreWindow::OnPaint(), NewsWindow::OnResize(), GameOptionsWindow::OnResize(), DepotWindow::OnRightClick(), openttd_main(), RealMakeScreenshot(), ClientNetworkGameSocketHandler::Receive_SERVER_ERROR(), FrametimeGraphWindow::SetStringParameters(), GenerateLandscapeWindow::SetStringParameters(), GameManualTextfileWindow::SetStringParameters(), ScriptLeagueWindow::SetStringParameters(), AboutWindow::SetStringParameters(), MusicTrackSelectionWindow::SetStringParameters(), NetworkChatWindow::SetStringParameters(), ContentTextfileWindow::SetStringParameters(), NetworkClientListWindow::SetStringParameters(), NetworkAskRelayWindow::SetStringParameters(), SpriteAlignerWindow::SetStringParameters(), NewGRFTextfileWindow::SetStringParameters(), NewGRFWindow::SetStringParameters(), ScriptTextfileWindow::SetStringParameters(), ScriptDebugWindow::SetStringParameters(), BaseSetTextfileWindow::SetStringParameters(), GameOptionsWindow::SetStringParameters(), CustomCurrencyWindow::SetStringParameters(), StoryBookWindow::SetStringParameters(), ShowNewGRFError(), ShowNewGrfVehicleError(), TownActionBuyRights(), TownActionRoadRebuild(), FramerateWindow::UpdateWidgetSize(), GoalQuestionWindow::UpdateWidgetSize(), ScriptLeagueWindow::UpdateWidgetSize(), LandInfoWindow::UpdateWidgetSize(), MusicTrackSelectionWindow::UpdateWidgetSize(), MusicWindow::UpdateWidgetSize(), NetworkClientListWindow::UpdateWidgetSize(), SpriteAlignerWindow::UpdateWidgetSize(), NewGRFWindow::UpdateWidgetSize(), StoryBookWindow::UpdateWidgetSize(), and WarnCorruptSprite().
void SetDParamStr | ( | size_t | n, |
const std::string & | str | ||
) |
This function is used to "bind" the C string of a std::string to a OpenTTD dparam slot.
The caller has to ensure that the std::string reference remains valid while the string is shown.
n | slot of the string |
str | string to bind |
Definition at line 382 of file strings.cpp.
void SetDParamStr | ( | size_t | n, |
std::string && | str | ||
) |
This function is used to "bind" the std::string to a OpenTTD dparam slot.
Contrary to the other SetDParamStr
functions, this moves the string into the parameter slot.
n | slot of the string |
str | string to bind |
Definition at line 394 of file strings.cpp.
|
static |
Definition at line 1756 of file strings.cpp.
std::string _config_language_file |
The file (name) stored in the configuration.
Definition at line 52 of file strings.cpp.
Referenced by InitializeLanguagePacks(), and ReadLanguagePack().
std::unique_ptr<icu::Collator> _current_collator |
Collator for the language currently in use.
Definition at line 59 of file strings.cpp.
Referenced by ICUStringContains(), ReadLanguagePack(), and StrNaturalCompare().
const LanguageMetadata* _current_language = nullptr |
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().
TextDirection _current_text_dir |
Text direction of the currently selected language.
Definition at line 56 of file strings.cpp.
Referenced by AddCargoIconOverlay(), NWidgetLeaf::ButtonHit(), IndustryCargoesWindow::CalculatePositionInWidget(), CheckForMissingGlyphs(), ClickSliderWidget(), NWidgetMatrix::Draw(), NWidgetLeaf::Draw(), BaseSettingEntry::Draw(), CargoesField::Draw(), DrawAircraftImage(), DrawArrowButtons(), DrawButtonDropdown(), NetworkClientListWindow::DrawButtons(), DrawCargoIcons(), StationViewWindow::DrawCargoRatings(), DrawCategory(), NetworkClientListWindow::DrawCompany(), CompanyInfrastructureWindow::DrawCountLine(), DrawEngineList(), StationViewWindow::DrawEntries(), DrawFrame(), VehicleGroupWindow::DrawGroupInfo(), IndustryViewWindow::DrawInfo(), DrawLayoutLine(), GoalListWindow::DrawListColumn(), DrawOrderString(), TownAuthorityWindow::DrawRatings(), DrawRoadVehImage(), NetworkGameWindow::DrawServerLine(), SettingEntry::DrawSetting(), SettingsPage::DrawSetting(), DrawShipImage(), DrawSliderWidget(), DrawSmallOrderList(), Window::DrawSortButtonState(), TimetableWindow::DrawTimetablePanel(), DrawTrainDetails(), DrawTrainImage(), NewGRFInspectWindow::DrawVehicleChainWidget(), DepotWindow::DrawVehicleInDepot(), BaseVehicleListWindow::DrawVehicleListItems(), DrawVehicleRefitWindow(), BuildBridgeWindow::DrawWidget(), CheatWindow::DrawWidget(), SelectCompanyLiveryWindow::DrawWidget(), CompanyInfrastructureWindow::DrawWidget(), DepotWindow::DrawWidget(), GSConfigWindow::DrawWidget(), GenerateProgressWindow::DrawWidget(), GraphLegendWindow::DrawWidget(), PaymentRatesGraphWindow::DrawWidget(), PerformanceRatingDetailWindow::DrawWidget(), IndustryProductionGraphWindow::DrawWidget(), BuildIndustryWindow::DrawWidget(), IndustryCargoesWindow::DrawWidget(), PerformanceLeagueWindow::DrawWidget(), ScriptLeagueWindow::DrawWidget(), BaseNetworkContentDownloadStatusWindow::DrawWidget(), NetworkJoinStatusWindow::DrawWidget(), NewGRFParametersWindow::DrawWidget(), NewGRFWindow::DrawWidget(), ScanProgressWindow::DrawWidget(), MessageHistoryWindow::DrawWidget(), OrdersWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), SignListWindow::DrawWidget(), SmallMapWindow::DrawWidget(), CompanyStationsWindow::DrawWidget(), SubsidyListWindow::DrawWidget(), TownViewWindow::DrawWidget(), TownDirectoryWindow::DrawWidget(), RefitWindow::DrawWidget(), VehicleDetailsWindow::DrawWidget(), VehicleViewWindow::DrawWidget(), GetAlignedPosition(), GetAutoPlacePosition(), QueryString::GetBoundingRect(), NetworkClientListWindow::GetButtonAtPoint(), QueryString::GetCaretPosition(), QueryString::GetCharAtPosition(), Layouter::GetCharPosition(), SmallMapWindow::GetPositionOnLegend(), NWidgetMatrix::GetScrollOffsets(), GetSingleVehicleWidth(), GetToolbarAlignedWindowPosition(), NWidgetMatrix::GetWidgetFromPos(), HandleScrollbarHittest(), HandleScrollbarScrolling(), HighlightDragPosition(), Window::InitializeData(), IsGoodAutoPlace2(), ItemizeBidi(), LocalGetWindowPlacement(), Textbuf::MovePos(), ReplaceVehicleWindow::OnClick(), BuildVehicleWindow::OnClick(), CheatWindow::OnClick(), GSConfigWindow::OnClick(), VehicleGroupWindow::OnClick(), IndustryViewWindow::OnClick(), NewGRFParametersWindow::OnClick(), ScriptSettingsWindow::OnClick(), GameSettingsWindow::OnClick(), RefitWindow::OnPaint(), NetworkClientListWindow::OnTooltip(), ReadLanguagePack(), Window::ReInit(), ResizeWindow(), ScrollbarClickPositioning(), ScrollRect(), SetMouseCursorVehicle(), NWidgetLeaf::SetupSmallestSize(), ShowDropDownList(), ShowTerraformToolbar(), UniscribeItemizeString(), Textbuf::UpdateCaretPosition(), DropdownWindow::UpdateSizeAndPosition(), PerformanceRatingDetailWindow::UpdateWidgetSize(), and MusicWindow::UpdateWidgetSize().
ArrayStringParameters<20> _global_string_params |
Definition at line 62 of file strings.cpp.
|
static |
Definition at line 1833 of file strings.cpp.
|
static |
Definition at line 221 of file strings.cpp.
LanguageList _languages |
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().
|
static |
Are we scanning for the gender of the current string? (instead of formatting it)
Definition at line 223 of file strings.cpp.
Referenced by FormatString().
|
static |
Definition at line 1770 of file strings.cpp.
|
static |
Definition at line 1818 of file strings.cpp.
|
static |
Definition at line 1786 of file strings.cpp.
|
static |
Unit conversions for force.
Definition at line 824 of file strings.cpp.
Referenced by FormatString().
|
static |
Unit conversions for height.
Definition at line 831 of file strings.cpp.
Referenced by FormatString().
|
static |
Unit conversions for power.
Definition at line 790 of file strings.cpp.
Referenced by FormatString().
|
static |
Unit conversions for power to weight.
Definition at line 797 of file strings.cpp.
Referenced by FormatString().
|
static |
Unit conversions for time in calendar days or wallclock seconds.
Definition at line 838 of file strings.cpp.
Referenced by FormatString().
|
static |
Unit conversions for time in calendar months or wallclock minutes.
Definition at line 844 of file strings.cpp.
Referenced by FormatString().
|
static |
Unit conversions for time in calendar years or wallclock minutes.
Definition at line 856 of file strings.cpp.
Referenced by FormatString().
|
static |
Unit conversions for time in calendar years or economic periods.
Definition at line 850 of file strings.cpp.
Referenced by FormatString().
|
static |
Unit conversions for velocity.
Definition at line 772 of file strings.cpp.
Referenced by GetVelocityUnits().
|
static |
Unit conversions for velocity.
Definition at line 781 of file strings.cpp.
Referenced by GetVelocityUnits().
|
static |
Unit conversions for volume.
Definition at line 817 of file strings.cpp.
Referenced by FormatString().
|
static |
Unit conversions for weight.
Definition at line 810 of file strings.cpp.
Referenced by FormatString().