volto icon indicating copy to clipboard operation
volto copied to clipboard

i18n script should support path option

Open ericof opened this issue 2 years ago • 7 comments

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

ericof avatar Aug 04 '23 18:08 ericof

@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.

sneridagh avatar Sep 08 '23 16:09 sneridagh

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

davisagli avatar Sep 08 '23 16:09 davisagli

@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 avatar Sep 08 '23 16:09 sneridagh

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.

sneridagh avatar Sep 08 '23 16:09 sneridagh

@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.

davisagli avatar Sep 08 '23 16:09 davisagli

@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.

sneridagh avatar Sep 11 '23 10:09 sneridagh

@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?

davisagli avatar Sep 11 '23 14:09 davisagli