mirror of https://github.com/OpenMW/openmw.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
2 years ago
|
#ifndef COMPONENTS_L10N_MANAGER_H
|
||
|
#define COMPONENTS_L10N_MANAGER_H
|
||
|
|
||
|
#include <components/l10n/messagebundles.hpp>
|
||
|
|
||
|
namespace VFS
|
||
|
{
|
||
|
class Manager;
|
||
|
}
|
||
|
|
||
|
namespace l10n
|
||
|
{
|
||
|
|
||
|
class Manager
|
||
|
{
|
||
|
public:
|
||
|
Manager(const VFS::Manager* vfs)
|
||
|
: mVFS(vfs)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void dropCache() { mCache.clear(); }
|
||
|
void setPreferredLocales(const std::vector<std::string>& locales);
|
||
|
const std::vector<icu::Locale>& getPreferredLocales() const { return mPreferredLocales; }
|
||
|
|
||
|
std::shared_ptr<const MessageBundles> getContext(
|
||
|
const std::string& contextName, const std::string& fallbackLocale = "en");
|
||
|
|
||
|
private:
|
||
|
void readLangData(const std::string& name, MessageBundles& ctx, const icu::Locale& lang);
|
||
|
void updateContext(const std::string& name, MessageBundles& ctx);
|
||
|
|
||
|
const VFS::Manager* mVFS;
|
||
|
std::vector<icu::Locale> mPreferredLocales;
|
||
|
std::map<std::pair<std::string, std::string>, std::shared_ptr<MessageBundles>> mCache;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif // COMPONENTS_L10N_MANAGER_H
|