reactioncommerce/reaction

Language-specific Money formatting

Open

#6511 aperta il 20 mag 2020

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)JavaScript (2198 fork)batch import
Internationalization (i18n)enhancementhelp wanted

Metriche repository

Star
 (12.181 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor