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.
- Contentstack account
- CLI installed (version 1.1.0 and above)
Steps for execution
- Export the data from the source stack using the cm:stacks:export command.
- Download the examples folder and navigate to the folder using the cd command in the terminal.
- Find the change-master-locale script in the examples folder. Execute the script using the migration command as follows:
- Import the data to the target stack using the cm:stacks:import command.
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>
- This utility does not work for the clone command.