mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-06 13:01:50 +02:00
support rendering currency without full name
This commit is contained in:
parent
212f323800
commit
a015904365
1 changed files with 7 additions and 4 deletions
|
@ -282,16 +282,19 @@ class FormEnum(Enum):
|
|||
return str(self.value)
|
||||
|
||||
|
||||
def render_localized_currency(code):
|
||||
def render_localized_currency(code, detailed=True):
|
||||
if code == "XXX":
|
||||
return _("No Currency")
|
||||
locale = get_locale() or "en_US"
|
||||
symbol = get_currency_symbol(code, locale=locale)
|
||||
details = ""
|
||||
if detailed:
|
||||
l10n_name = get_currency_name(code, locale=locale)
|
||||
details = f" − {get_currency_name(code, locale=locale)}"
|
||||
if symbol == code:
|
||||
return f"{code} - {l10n_name}"
|
||||
return f"{code}{details}"
|
||||
else:
|
||||
return f"{code} - {symbol} - {l10n_name}"
|
||||
return f"{code} − {symbol}{details}"
|
||||
|
||||
|
||||
def render_localized_template(template_name_prefix, **context):
|
||||
|
|
Loading…
Reference in a new issue