mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-22 14:04:18 +00:00
Merge pull request #42 from pzhuk/conf-currency-symbol
Allow configuration of currency symbol instead of using language-base…
This commit is contained in:
commit
87922e8aad
2 changed files with 5 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
||||||
# Config file parameters
|
# Config file parameters
|
||||||
[Config]
|
[Config]
|
||||||
; Config file version. DO NOT EDIT THIS!
|
; Config file version. DO NOT EDIT THIS!
|
||||||
version = 14
|
version = 15
|
||||||
; Set this to no when you are done editing the file
|
; Set this to no when you are done editing the file
|
||||||
is_template = yes
|
is_template = yes
|
||||||
; Language code for string file
|
; Language code for string file
|
||||||
|
@ -41,6 +41,9 @@ currency = EUR
|
||||||
; Currency exp parameter. You can find that on https://core.telegram.org/bots/payments/currencies.json.
|
; 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...)
|
; It has a value of 2 in most currencies (EUR, USD, GBP...)
|
||||||
currency_exp = 2
|
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 payment settings
|
||||||
[Credit Card]
|
[Credit Card]
|
||||||
|
|
2
utils.py
2
utils.py
|
@ -47,7 +47,7 @@ class Price:
|
||||||
return f"<Price of value {self.value}>"
|
return f"<Price of value {self.value}>"
|
||||||
|
|
||||||
def __str__(self):
|
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(
|
value="{0:.2f}".format(
|
||||||
self.value / (10 ** int(config["Payments"]["currency_exp"]))))
|
self.value / (10 ** int(config["Payments"]["currency_exp"]))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue