reactioncommerce/reaction

Language-specific Money formatting

Open

#6,511 建立於 2020年5月20日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)JavaScript (12,181 star) (2,198 fork)batch import
Internationalization (i18n)enhancementhelp wanted

描述

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.

貢獻者指南

Language-specific Money formatting · reactioncommerce/reaction#6511 | Good First Issue