/***************************************************************************** * Copyright (c) 2014-2024 OpenRCT2 developers * * For a complete list of all authors, please refer to contributors.md * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 * * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ #pragma once #include "../core/StringTypes.h" #include "../localisation/StringIdType.h" #include #include #include #include #include #include struct ILanguagePack; struct IObjectManager; namespace OpenRCT2 { struct IPlatformEnvironment; } namespace OpenRCT2::Localisation { class LocalisationService { private: const std::shared_ptr _env; int32_t _currentLanguage{}; bool _useTrueTypeFont{}; std::vector _languageOrder; std::vector> _loadedLanguages; std::stack _availableObjectStringIds; std::vector _objectStrings; public: int32_t GetCurrentLanguage() const { return _currentLanguage; } std::string_view GetCurrentLanguageLocale() const; bool UseTrueTypeFont() const { return _useTrueTypeFont; } void UseTrueTypeFont(bool value) { _useTrueTypeFont = value; } LocalisationService(const std::shared_ptr& env); ~LocalisationService(); const char* GetString(StringId id) const; std::string GetLanguagePath(uint32_t languageId) const; void OpenLanguage(int32_t id); void CloseLanguages(); StringId AllocateObjectString(const std::string& target); void FreeObjectString(StringId stringId); const std::vector& GetLanguageOrder() const; }; } // namespace OpenRCT2::Localisation // Legacy getters // TODO Remove usages of these and instead call via shared reference int32_t LocalisationService_GetCurrentLanguage(); bool LocalisationService_UseTrueTypeFont();