reactioncommerce/reaction

Language-specific Money formatting

Open

#6511 opened on May 20, 2020

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (12,181 stars) (2,198 forks)batch import
Internationalization (i18n)enhancementhelp wanted

Description

Per discussion in https://github.com/reactioncommerce/reaction/issues/6517, it would be good to work toward being able to do currency formatting differently depending on desired language.

Rough idea:

  • Reaction formatMoney, passes through to accounting-js. It does not support language-specific format so we would need to resolve the correct format value before calling accounting.formatMoney. This means Reaction formatMoney would need to accept a new optional argument language, or maybe just make an entirely new function.
  • Need to invent some additional property in CurrencyDefinitions that has format keyed by language code
  • (create an issue for this in api-core) Most formatting is done automatically in the Reaction API, based on the Money type in GraphQL resolvers. But this isn't currently aware of what language the client wants. Probably every field that has Money type would need to be updated to accept an optional language param, and Money resolver would need to pass that along to formatMoney.

Contributor guide