Getting Started
#CloudCannon setup
Option 1: A single site
Editing of translations and the generation of the multilingual site occur on the same site on CloudCannon. You can use this option if you don't need the default redirect page that comes with Rosey. Your original language content will be served at the root of your URL, without a prefix.
-
Create a site on CloudCannon.
-
Add the environment variable
CLOUDCANNON_SYNC_PATHS, with the value/rosey/. -
Install the RCC by running
npm i rosey-cloudcannon-connectorin the root of your repository. -
Add a
.cloudcannon/postbuildfile at the root of your project if you don't have one already. Replacedistwith the build output directory of your project. If you already have a CloudCannon postbuild file, add this logic to your current one.
#!/usr/bin/env bash
npx rosey-cloudcannon-connector tag --source dist
npx rosey generate --source dist
npx rosey-cloudcannon-connector generate
echo "Translating site with Rosey"
mv ./dist ./untranslated_site
npx rosey build --source untranslated_site --dest dist --default-language-at-root
Option 2: A staging to production workflow
Editing of translations and the generation of the multilingual site occur on different sites on CloudCannon, typically using a staging -> production workflow. Editing of translations occurs on the staging site, while the generation of the multilingual site occurs on the production site.
This option is for you if you want the default redirect that comes with Rosey, and don't mind your original language being prefixed with a locale code. For example, if your original untranslated content is in English, it will be served at /en/, similar to the translated locales.
-
Create two sites using a
staging->productionpublishing workflow on CloudCannon, if you don't already have one. -
On your
stagingsite add the environment variableCLOUDCANNON_SYNC_PATHS, with the value/rosey/. -
On your
productionsite add the environment variableROSEY_PROD, with a value oftrue. -
On staging, install the RCC by running
npm i rosey-cloudcannon-connectorin the root of your project. -
On staging, add a
.cloudcannon/postbuildfile at the root of your project if you don't have one already. Replacedistwith the build output directory of your project. If you already have a CloudCannon postbuild file, add this logic to your current one.
#!/usr/bin/env bash
if [[ $ROSEY_PROD != "true" ]];
then
npx rosey-cloudcannon-connector tag --source dist
npx rosey generate --source dist
npx rosey-cloudcannon-connector generate
fi
if [[ $ROSEY_PROD == "true" ]];
then
npx rosey-cloudcannon-connector tag --source dist
echo "Translating site with Rosey"
mv ./dist ./untranslated_site
npx rosey build --source untranslated_site --dest dist
fi
The rest of the setup
-
Run
npx rosey-cloudcannon-connector generate-configin a terminal in the root of your project to generate a config file, and follow the prompts to populate the file. You can change your answers later by editing the generatedrosey/rcc.yamlfile if you need. -
Add a
translationscollection to yourcloudcannon.config.ymlunder thecollections_configkey.collections_config: translations: path: rosey icon: translate disable_url: true disable_add: true disable_add_folder: true disable_file_actions: false glob: - rcc.yaml - 'translations/**' _inputs: urlTranslation: type: text comment: Provide a translated URL, and Rosey will build this page at that address.If you have the collection_groups configuration key defined, add
translationsto a collection group, so that it is visible in your sidebar in CloudCannon.collection_groups: - heading: Pages collections: - pages - blog - heading: Data collections: - data - translations
If your site is nested in a subdirectory and you're using the source key you'll need to remove the
sourcekey, and manually add the subdirectory to each of the paths that were relying on it. Theroseycollection's path does not need the prefix of the subdirectory since it lives in the root of our project. Schema paths in CloudCannon are not affected by thesourcekey, so do not need updating.
-
Commit and push your changes, and wait for the CloudCannon build to finish. Then pull your changes down to your local.
All the files you need to get going will have been generated as part of the CloudCannon build.
Make sure there is at least one locale code to the
localesarray in therosey/rcc.yamlfile. Remember to replace the placeholder urls with your own if using either of the link features.
Remember to replace the placeholder urls with your own if using either of the link features.
You are ready to start tagging content for translation.