Skip to content

Multiple currency symbol Web UI support #2684

@oleh-maikovych

Description

@oleh-maikovych

Description

Parent issue: #2674

The goal of this issue is to provide Web UI support for displaying different currency symbols within the same application. This should be possible because currency is part of Money-typed values.

To provide Web UI support for different currency symbols within the same application, the following tasks need to be completed:

  • Enhance the formatMoney function in tg-numeric-utils to return a value with the currency specified in the Money-typed parameter, or the default currency if the Money value does not contain one.
  • Enhance the convertFromString method of the tg-money-editor element to return a Money object with the correct currency.
  • Ensure that the tg-chart-decker-template-behaviour element supports money formatting based on tg-numeric-utils.

Change overview

1. Custom currency symbols

It is now possible to define custom currency symbols in applications. This is done through application properties.

The syntax is the following, where X is a currency code and S is a symbol.

currency.X.symbol=S

Examples:

currency.AUD.symbol=A$
currency.EUR.symbol=€

Note that enabling unicode symbols in .properties files requires the code that reads them to do so using a suitable encoding (e.g., UTF-8).
This extra effort is necessary because the standard procedure Properties.load(java.io.InputStream) assumes the ISO 8859-1 encoding.

Here is an example of reading a .properties file using UTF-8:

var props = new Properties();
try (var reader = Files.newBufferedReader(Path.of(fileName), StandardCharsets.UTF_8)) {
    props.load(reader);
}

Expected outcome

Money values in EGI, editors, and charts have the proper currency symbol specified in their values.

Future work

  • Currency to symbol mapping should be defined per user.
    The platform should define an interface that acts as a function from users to mappings, which could then be implemented in TG-based applications.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions