Next-i18next
migration
byCodemod

Next I18next/Copy Keys

/icons/calendar.svg

Last update

Jul 24, 2024

This codemod copies specific keys from one translation namespace to another, for each of the supported languages.

The codemod expects the following arguments:

  • oldNamespace is the name of the namespace from which the keys are taken,
  • newNamespace is the name of the namespace to which the keys are copied,
  • keys is a comma-separated list of keys.

You need to pass these arguments using the Codemod Arguments' settings in Codemod VSCode extension or Codemod CLI.

Before

.../en/common.json

{
"copyKey": "copyKeyEnglish",
"noopKey": "noopKeyEnglish"
}

.../en/new.json

{
"existingKey": "existingKeyEnglish"
}

After

.../en/common.json

{
"copyKey": "copyKeyEnglish",
"noopKey": "noopKeyEnglish"
}

.../en/new.json

{
"existingKey": "existingKeyEnglish",
"copyKey": "copyKeyEnglish"
}

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now