[i18n] set decimal point based on language

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1854/head
R4SAS 1 year ago
parent a57ae4dc56
commit 533c8a8a55
No known key found for this signature in database
GPG Key ID: 66F6C87B98EBCFE2

@ -1,11 +1,12 @@
/* /*
* Copyright (c) 2021-2022, The PurpleI2P Project * Copyright (c) 2021-2023, The PurpleI2P Project
* *
* This file is part of Purple i2pd project and licensed under BSD3 * This file is part of Purple i2pd project and licensed under BSD3
* *
* See full license text in LICENSE file at top of project tree * See full license text in LICENSE file at top of project tree
*/ */
#include <clocale>
#include "ClientContext.h" #include "ClientContext.h"
#include "I18N_langs.h" #include "I18N_langs.h"
#include "I18N.h" #include "I18N.h"
@ -18,9 +19,15 @@ namespace i18n
{ {
const auto it = i2p::i18n::languages.find(lang); const auto it = i2p::i18n::languages.find(lang);
if (it == i2p::i18n::languages.end()) // fallback if (it == i2p::i18n::languages.end()) // fallback
{
i2p::client::context.SetLanguage (i2p::i18n::english::GetLocale()); i2p::client::context.SetLanguage (i2p::i18n::english::GetLocale());
setlocale(LC_NUMERIC, "english");
}
else else
{
i2p::client::context.SetLanguage (it->second.LocaleFunc()); i2p::client::context.SetLanguage (it->second.LocaleFunc());
setlocale(LC_NUMERIC, lang.c_str()); // set decimal point based on language
}
} }
std::string translate (const std::string& arg) std::string translate (const std::string& arg)

Loading…
Cancel
Save