Change Master Locale

While importing data using Contentstack’s CLI, if the destination stack has a different master locale than the source stack, the API throws an error indicating that the master locale of the incoming data does not exist in the destination stack.

As a solution, you can change the master locale of the data exported from the CLI using the change-master-locale utility so that it matches the master locale of the destination stack.

Prerequisites

Steps for execution

  1. Export the data from the source stack using the cm:stacks:export command.
  2. Download the examples folder and navigate to the folder using the cd command in the terminal.
  3. cd <path-to-examples>
  4. Find the change-master-locale script in the examples folder. Execute the script using the migration command as follows:
  5. csdx cm:stacks:migration --file-path ./change-master-locale/01-change-master-locale.js --config target_locale:<target-locale> data_dir:<path-to-the-exported-data>

    Note: path-to-the-exported-data can either be the relative path or the absolute path.

    Alternatively, You can save the config parameters to a config.json file and use it as follows:

     csdx cm:stacks:migration --file-path ./change-master-locale/01-change-master-locale.js --config-file <path-to-the-config-file>
  6. Import the data to the target stack using the cm:stacks:import command.

Limitations

  • This utility does not work for the clone command.

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

^