From 533c8a8a55665acd4e71b792d5c4db4c45296407 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Thu, 19 Jan 2023 06:40:32 +0300 Subject: [PATCH] [i18n] set decimal point based on language Signed-off-by: R4SAS --- i18n/I18N.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/i18n/I18N.cpp b/i18n/I18N.cpp index fe04bcb6..cf4873eb 100644 --- a/i18n/I18N.cpp +++ b/i18n/I18N.cpp @@ -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 * * See full license text in LICENSE file at top of project tree */ +#include #include "ClientContext.h" #include "I18N_langs.h" #include "I18N.h" @@ -18,9 +19,15 @@ namespace i18n { const auto it = i2p::i18n::languages.find(lang); if (it == i2p::i18n::languages.end()) // fallback + { i2p::client::context.SetLanguage (i2p::i18n::english::GetLocale()); + setlocale(LC_NUMERIC, "english"); + } else + { 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)