plone / volto

React-based frontend for the Plone Content Management System
https://demo.plone.org/
MIT License
448 stars 610 forks source link

i18n script should support path option #5062

Open ericof opened 1 year ago

ericof commented 1 year ago

Is your feature request related to a problem? Please describe.

Currently, it is not possible to run the i18n script and update the locales in a project containing addons in src/addons/

Describe the solution you'd like

The script should either have the option to update the locales for an addon in a project

Describe alternatives you've considered

It is possible to get the same result by:

  1. Copying the babel.config.js to the addon root (i.e. src/addons/volto-addon/)
  2. cd src/addons/volto-addon/ && ../../node_modules/.bin/i18n --addon
sneridagh commented 1 year ago

@ericof I've been thinking about the problem... if the problem is to update the current (single add-on) repo, why just not run yarn i18n in the root of the repo?

Even, if we have multiple add-ons, nothing keeps you from running them on each add-on.

The only "drawback" is that we should keep "@plone/scripts" (which we already do) as a dev dependency, and run yarn in the root of the repo "outside" docker.

davisagli commented 1 year ago

@sneridagh doesn't that require a babel configuration at the root of the addon repo?

sneridagh commented 1 year ago

@davisagli yes, we were already doing this, it's on the generator since long ago: https://github.com/plone/volto/blob/master/packages/generator-volto/generators/addon/templates/babel.config.js

but it's true that we were removing it in the docker implementations because we relied that the docker approach would provide everything needed.

Even if we come up with a script that does it, it will be needed anyways...

sneridagh commented 1 year ago

I made good progress using trying

process.chdir('src/addons/my-addon')

, then run the original script, still some rough edges... and we will have to get back the babel config.

davisagli commented 1 year ago

@sneridagh well if it's ok to add the babel config back for the docker approach, then we don't need this. possibly make i18n in the docker setup could even temporarily copy the babel config and leave it out of the repo.

sneridagh commented 1 year ago

@davisagli since it's something that will work even without the dockerized approach, I would include it anyways. In fact, the generator has it since some time ago, so it's already there.

davisagli commented 1 year ago

@sneridagh ok, then I think we can close this, and we just have to re-add the babel config to the addons where we are using the dockerized approach. @ericof do you agree?