MFEs internationalization and updates to

Let’s say I want to locally modify a string in /edx/app/account/frontend-app-account/src/i18n/messages/fr.json, what is the simplest way to make sure that new string is picked up by the MFE?

Thus far, I only have been able to modify the language file in my fork if I completely reinstall the MFE for it to work. There must be something easier…

1 Like

@sambapete I assume this is for development? If so, I’d recommend you run the MFE directly using npm. If you do that changes will automatically be picked up, and the site will reload with the changes applied.

Otherwise, you will need to run npm build after each change.

Hello @xitij2000

Kind of. I wanted to easily test a new translation without having to reinstall the MFE.

While in Testing or in Development of a new release (like lilac for example), this is not a big issue and I can simply reinstall the MFE.

In Production, sometimes some of our users will be unsatisfied by a specific translation. Of course, I can change the string in Transifex and wait until the next release, but that would not be satisfactory to our users.

Obviously, I can also change the string directly into the .js files that are created by npm in the dist directory, but that is more of a workaround than anything else and the might disappear if I don’t update the JSON files in src/i18n/messages if I need to rebuild the MFE.

I guess I was hoping for something else…

Thanks

I am not sure how well editing the files in the dist folder will work. Since these are not expected to change they may be aggressively cached, and might not be re-requested by browsers.

I have recently been looking into themes and theming, and how to enable loading themes without rebuilding the entire app. A similar approach could probably be used for translations. i.e. the translations could “plug” into the app in a way that they can be entirely replaced without needing to rebuild the entire app, just the translations.

I will be posting more about this soon, but I think while what you’d like to see isn’t possible right now, I think it’s definitely possible.