msupply-foundation / open-msupply

Open mSupply represents our most recent advancement in the Logistics Management Information System (LMIS), expanding on more than two decades of development inherited from the well-established legacy of the original mSupply.
https://msupply.foundation/open-msupply/
Other
20 stars 12 forks source link

Custom translation overrides #5061

Open lache-melvin opened 1 week ago

lache-melvin commented 1 week ago

Is your feature request related to a problem? Please describe πŸ‘€

A way for users to configure custom translations on the OMS central server.

The user should be able to:

Describe the solution you'd like 🎁

QUESTIONS:

Describe alternatives you've considered πŸ’­

Additional context πŸ’Œ

Moneyworks Jobcode 🧰

roxy-dao commented 1 week ago

TODO: Check with report JSON form translations to make sure we're not doubling up on any work etc

mark-prins commented 1 week ago

Always serve custom.json along with common.json (would be empty object by default)

to clarify: custom.json would be empty by default, right? The proximity made me think the brackets relate to common.json

mark-prins commented 1 week ago

Alternatively - the server combines custom.json and common.json and serves up a single file. This would be easier to code for on the front end as no change would be required. If we have two files then we need to either combine the json files (during the i18n initialisation? ) or modify the useTranslation hook to always use the custom namespace while using common as the default or ..?

Do we need to support custom translations for multiple languages?

that would be more comprehensive as a solution, so I'd prefer to support that. In practice though - countries have only used a single language and would therefore only require a single language in the custom namespace. So we're adding complexity which would be unused.

lache-melvin commented 1 week ago

modify the useTranslation hook to always use the custom namespace while using common as the default

Yeah that was the thinking... just seeing as the useTranslation hook already has the "merging" functionality baked in, why not make the most of it! Not sure if that's a little safer too, keeping common.json separate so we know the fallbacks are definitely available?

Though yes, combining on the server is also a nice solution, and could be shared by both frontend and backend (for reports) πŸ‘€