Skip to content
Snippets Groups Projects
Commit 2acedb38 authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Sébastien Blin
Browse files

plugins: fix locale in windows

Change-Id: I630a53810f39dc4b1df81417242eafb0da77766a
parent d21d8bbf
Branches
No related tags found
No related merge requests found
...@@ -159,7 +159,26 @@ PluginPreferencesUtils::getPreferences(const std::string& rootPath, const std::s ...@@ -159,7 +159,26 @@ PluginPreferencesUtils::getPreferences(const std::string& rootPath, const std::s
std::vector<std::map<std::string, std::string>> preferences; std::vector<std::map<std::string, std::string>> preferences;
if (file) { if (file) {
// Get preferences locale // 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(); std::string lang = std::locale("").name();
#endif //
auto locales = getLocales(rootPath, std::string(string_remove_suffix(lang, '.'))); auto locales = getLocales(rootPath, std::string(string_remove_suffix(lang, '.')));
// Read the file to a json format // Read the file to a json format
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment