diff --git a/components/l10n/messagebundles.cpp b/components/l10n/messagebundles.cpp index a8e9828d02..92b3011582 100644 --- a/components/l10n/messagebundles.cpp +++ b/components/l10n/messagebundles.cpp @@ -263,7 +263,10 @@ namespace L10n YAML::Node data = YAML::Load(input); std::string localeName = lang.getName(); if (localeName == "gmst") + { loadGmstYaml(data, mGmsts); + mGmstsLoaded = true; + } else loadLocaleYaml(data, lang, mBundles[localeName]); } diff --git a/components/l10n/messagebundles.hpp b/components/l10n/messagebundles.hpp index 164225e09d..5f2569f64f 100644 --- a/components/l10n/messagebundles.hpp +++ b/components/l10n/messagebundles.hpp @@ -55,7 +55,10 @@ namespace L10n void load(std::istream& input, const icu::Locale& lang); bool isLoaded(const icu::Locale& loc) const { - return mBundles.find(std::string_view(loc.getName())) != mBundles.end(); + std::string_view localeName = loc.getName(); + if (localeName == "gmst") + return mGmstsLoaded; + return mBundles.find(localeName) != mBundles.end(); } const icu::Locale& getFallbackLocale() const { return mFallbackLocale; } void setGmstLoader(GmstLoader fn) { mGmstLoader = std::move(fn); } @@ -66,6 +69,7 @@ namespace L10n // icu::Locale isn't hashable (or comparable), so we use the string form instead, which is canonicalized mutable StringMap> mBundles; mutable StringMap mGmsts; + bool mGmstsLoaded{ false }; mutable std::shared_mutex mMutex; const icu::Locale mFallbackLocale; std::vector mPreferredLocaleStrings;