- Build docs locally to ensure all files exist
yarn build
- Run translator
Specify the config file, see ./languages/jp.json.
python3 /opt/clickhouse-docs/scripts/translate/translate.py --input-folder /opt/clickhouse-docs/docs --output-folder /opt/clickhouse-docs/i18n/jp --config ./languages/jp.json
- Replace imports
For example, for jp
.
# osx
LC_ALL=C.UTF-8 find ./i18n/jp -type f -exec sed -i '' 's|@site/docs|@site/i18n/jp/docusaurus-plugin-content-docs/current|g' {} +
# ubuntu
LC_ALL=C.UTF-8 find ./i18n/jp -type f -exec sed -i 's|@site/docs|@site/i18n/jp/docusaurus-plugin-content-docs/current|g' {} +
- Build
Build and fix issues. Not all issues are detected with a yarn start
so build! i.e.:
DOCUSUARUS_LOCALE=jp yarn build
Changed files will automatically be re-translated if the source has changed (detected through .hash
with the translation of the source). Removed files in the source will also be removed in the target translation.
To force re-translation just delete the target translated file.
- Create translations
yarn docusaurus write-translations --locale jp
- Build docs locally to ensure all files exist
yarn build
- Run translator
Specify the config file, see ./languages/jp.json.
python3 /opt/clickhouse-docs/scripts/translate/translate.py --input-folder /opt/clickhouse-docs/docs --output-folder /opt/clickhouse-docs/i18n/jp --config ./languages/jp.json
- Replace imports
For example, for jp
# osx
LC_ALL=C.UTF-8 find . -type f -exec sed -i '' 's|@site/docs|@site/i18n/jp/docusaurus-plugin-content-docs/current|g' {} +
# ubuntu
LC_ALL=C.UTF-8 find . -type f -exec sed -i 's|@site/docs|@site/i18n/jp/docusaurus-plugin-content-docs/current|g' {} +
- Build
Build and fix issues. Not all issues are detected with a yarn start
so build! i.e.:
DOCUSUARUS_LOCALE=jp yarn build
- Create configs
Create docusauraus config file
cp docusaurus.config.js docusaurus.config.jp.js
Update the i18n
in this config file to include the translation e.g.
i18n: {
defaultLocale: "jp",
locales: ["jp", "en"],
path: "i18n",
localeConfigs: {
jp: {
htmlLang: "jp",
path: "jp",
},
en: {
htmlLang: "en",
path: "en",
},
},
},
Update any english phrases to your target language.
- Build
Build and fix issues. Not all issues are detected with a yarn start
so build! i.e.:
DOCUSUARUS_LOCALE=jp yarn build
Note: translation is incremental unless
--force_overwrite
is passed
- Add the re-write to vercel.json e.g.
{ "source": "/docs/jp/:path*", "destination": "/:path*" }
- Deploy to Vercel as a dedicated project. Add to the proxy project.
This allows each language to be deployed independently.
Ensure you only build if the languages folder changes e.g.
git diff HEAD^ HEAD --quiet -- ./i18n/jp
Example here.
- Add the route to the website worker - example PR
- translations can modify links in rare cases, causing issues.
- text splitting is not perfect for markdown - sometime it can't split due to large sections e.g. code blocks and errors. All threads will terminate - user must fix source.
- Translation may introduce invalid spacing on imports
- JSON files not translated which control tables
- Don't split on tables
|
- Custom code to metadata block (all pages need metadata so we can enforce)
- Introduce we can use to identify split
- Specify translate overrides + don't translate
- Dont translate titles on certain pages - formats and functions.
- Linter to check for unclosed ```. Lint checks on translations