Skip to content

Broken 'merge-i18n' script #4930

@jabrah

Description

@jabrah

Describe the bug

Looks like the merge-i18n script has been broken since the explicit declaration of commander as a dependency. The script fails to see the CLI args due to a breaking change between the previous and current versions of commander.

This results in i18n being broken for custom themes

To Reproduce

Following the i18n documentation dealing with custom themes:

You can use the provided custom theme, since it includes a couple of i18n strings.

  • Make sure dependencies are up-to-date. Older versions will have a transitive version of commander pulled from a different dependency (cypress, I think)
  • Run the merge-i18n script
$ npm checkout main # dspace-9_x would work too
$ npm run clean # Likely not be necessary, but nice to ensure a fresh start
$ npm install
$ npm run merge-i18n -- -s src/themes/custom/assets/i18n/

> [email protected] merge-i18n
> ts-node --project ./tsconfig.ts-node.json scripts/merge-i18n-files.ts -s src/themes/custom/assets/i18n/

Source or Output parameter is missing.
Usage: merge-i18n-files (-s <source-dir> [-d <output-dir>])

Options:
  -v, --version                  output the version number
  -d, --output-dir <output-dir>  output dir when running script on all language files (default: "/home/user/workspace/dspace/test/dspace-angular/src/assets/i18n")
  -s, --source-dir <source-dir>  source dir of translations to be merged
  -h, --help                     display help for command

Expected behavior

The script is expected to pick up source and destination arguments and succeed.


Notes

I believe this should be an easy fix. The old version of commander that was implicitly used allowed retrieval of options with syntax program['optName']. This needs to be updated to be program.opts()['optName'] and it should be fine.

I can provide a PR if assigned to the ticket.

Metadata

Metadata

Assignees

Labels

bugi18n / l10nInternationalisation and localisation, related to message catalogs

Type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions