From be31210afac5824a0413f1d809bcf19107d794d3 Mon Sep 17 00:00:00 2001 From: Pavlo Zhuk Date: Sun, 5 Apr 2020 00:43:41 +0300 Subject: [PATCH 1/2] Allow configuration of currency symbol instead of using language-based one --- config/template_config.ini | 3 +++ utils.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/template_config.ini b/config/template_config.ini index cb1650c..26cfeee 100644 --- a/config/template_config.ini +++ b/config/template_config.ini @@ -41,6 +41,9 @@ currency = EUR ; Currency exp parameter. You can find that on https://core.telegram.org/bots/payments/currencies.json. ; It has a value of 2 in most currencies (EUR, USD, GBP...) currency_exp = 2 +; Currency symbol which is show to the client users when displaying prices and transaction values +; If not defined here, default language specific currency symbol from strings would be used +currency_symbol = "€" # Credit card payment settings [Credit Card] diff --git a/utils.py b/utils.py index 855540f..36866f6 100644 --- a/utils.py +++ b/utils.py @@ -47,7 +47,7 @@ class Price: return f"" def __str__(self): - return strings.currency_format_string.format(symbol=strings.currency_symbol, + return strings.currency_format_string.format(symbol=(config["Payments"]["currency_symbol"] or strings.currency_symbol), value="{0:.2f}".format( self.value / (10 ** int(config["Payments"]["currency_exp"])))) From b1c313bf1de1fb275569d7875308db927fc419fd Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 5 Apr 2020 19:04:32 +0200 Subject: [PATCH 2/2] Bump config version --- config/template_config.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/template_config.ini b/config/template_config.ini index 26cfeee..cbe2381 100644 --- a/config/template_config.ini +++ b/config/template_config.ini @@ -5,7 +5,7 @@ # Config file parameters [Config] ; Config file version. DO NOT EDIT THIS! -version = 14 +version = 15 ; Set this to no when you are done editing the file is_template = yes ; Language code for string file