diff --git a/src/plugin/pluginpreferencesutils.cpp b/src/plugin/pluginpreferencesutils.cpp index f1c6f31df7491931bd3ca302012772fc7ea46a7c..03ae4498c72012c54950e5fc583a83ca6af6c5a5 100644 --- a/src/plugin/pluginpreferencesutils.cpp +++ b/src/plugin/pluginpreferencesutils.cpp @@ -159,7 +159,26 @@ PluginPreferencesUtils::getPreferences(const std::string& rootPath, const std::s std::vector<std::map<std::string, std::string>> preferences; if (file) { // Get preferences locale +#ifdef WIN32 + std::string lang; + WCHAR localeBuffer[LOCALE_NAME_MAX_LENGTH]; + if (GetUserDefaultLocaleName(localeBuffer, LOCALE_NAME_MAX_LENGTH) != 0) { + char utf8Buffer[LOCALE_NAME_MAX_LENGTH] {}; + WideCharToMultiByte(CP_UTF8, + 0, + localeBuffer, + LOCALE_NAME_MAX_LENGTH, + utf8Buffer, + LOCALE_NAME_MAX_LENGTH, + nullptr, + nullptr); + + lang.append(utf8Buffer); + string_replace(lang, "-", "_"); + } +#else std::string lang = std::locale("").name(); +#endif // auto locales = getLocales(rootPath, std::string(string_remove_suffix(lang, '.'))); // Read the file to a json format