summaryrefslogtreecommitdiff
path: root/zen/i18n.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:17:51 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:17:51 +0200
commit237aedc590b58c0e69d7dfcac92b5f767b7c004a (patch)
tree83f361a82ba483f2daf83b677e8685cd953812d9 /zen/i18n.h
parent4.5 (diff)
downloadFreeFileSync-237aedc590b58c0e69d7dfcac92b5f767b7c004a.tar.gz
FreeFileSync-237aedc590b58c0e69d7dfcac92b5f767b7c004a.tar.bz2
FreeFileSync-237aedc590b58c0e69d7dfcac92b5f767b7c004a.zip
4.6
Diffstat (limited to 'zen/i18n.h')
-rw-r--r--zen/i18n.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/zen/i18n.h b/zen/i18n.h
index de615cdb..08ebd05c 100644
--- a/zen/i18n.h
+++ b/zen/i18n.h
@@ -9,6 +9,8 @@
#include <string>
#include <memory>
+#include <clocale> //thousands separator
+#include "utf8.h" //
//thin layer to enable localization - without platform/library dependencies!
#ifndef WXINTL_NO_GETTEXT_MACRO
@@ -27,7 +29,6 @@ struct TranslationHandler
{
virtual ~TranslationHandler() {}
- virtual std::wstring thousandsSeparator() = 0;
virtual std::wstring translate(const std::wstring& text) = 0; //simple translation
virtual std::wstring translate(const std::wstring& singular, const std::wstring& plural, int n) = 0;
};
@@ -35,8 +36,9 @@ struct TranslationHandler
void setTranslator(TranslationHandler* newHandler = NULL); //takes ownership
TranslationHandler* getTranslator();
-inline
-std::wstring getThousandsSeparator() { return getTranslator() ? getTranslator()->thousandsSeparator() : L","; };
+std::wstring getThousandsSeparator();
+
+
@@ -91,6 +93,18 @@ void setTranslator(TranslationHandler* newHandler) { implementation::globalHandl
inline
TranslationHandler* getTranslator() { return implementation::globalHandler().get(); }
+
+
+inline
+std::wstring getThousandsSeparator() //consistency with sprintf(): just use the same values the C-runtime uses!!!
+{
+ //::setlocale (LC_ALL, ""); -> implicitly called by wxLocale
+ const lconv* localInfo = ::localeconv(); //always bound according to doc
+ return utf8CvrtTo<std::wstring>(localInfo->thousands_sep);
+ // why not working?
+ // THOUSANDS_SEPARATOR = std::use_facet<std::numpunct<wchar_t> >(std::locale("")).thousands_sep();
+ // DECIMAL_POINT = std::use_facet<std::numpunct<wchar_t> >(std::locale("")).decimal_point();
+}
}
#endif //I18_N_HEADER_3843489325045
bgstack15