Update i18n drift status
Follow these steps to update the drifted_from_default front matter field for
localized content by running npm run fix:i18n:status per locale, committing
per locale, and optionally opening a PR.
Arguments
The skill accepts optional arguments:
--locale locale,...(optional): a comma-separated list of locale IDs to process, e.g.--locale pt,es,fr. When omitted, all non-English locales are processed.--create-pr(optional flag): create the PR automatically after processing. When omitted, ask the user withAskUserQuestionwhether to create the PR.
Preparation
These steps assume you have a local clone of the repository with the upstream
remote configured to point to the main repository. Run these steps locally from
the repository root.
Ensure your working tree is clean (no uncommitted changes).
Switch to
mainand pull the latest changes:git checkout main git pull upstream mainCreate the working branch:
git checkout -b i18n_update-drift-status
Discover locales
If --locale was not passed, discover all non-English locales from the content
directory:
find content -maxdepth 1 -mindepth 1 -type d ! -name 'en' -exec basename {} \;
This returns one locale ID per line (e.g. bn, es, fr, …).
If --locale was passed, use that list instead.
enEnglish is the default content and cannot drift, so it should never be
included in the locale list or processed by this skill. If en is included in
the --locale argument, ignore it or report an error.
Update drift status per locale
For each {LANG_ID} in the resolved locale list:
Run the drift-status update command:
npm run fix:i18n:status -- content/{LANG_ID}Collect stats for the PR description table:
# Drifted files grep -rl "drifted_from_default: true" content/{LANG_ID} | wc -l # Total translatable files grep -rl "default_lang_commit" content/{LANG_ID} | wc -lIf the command produced changes, stage and commit:
git add content/{LANG_ID} git commit -m "chore({LANG_ID}): update drift status"If there are no changes for a locale, skip the commit but still record the stats.
Create the PR
After processing all locales:
- If
--create-prwas not passed, useAskUserQuestionto ask the user whether to create the PR before proceeding. - If the user declines (or if
--create-prwas not passed and they say no), stop here and report the stats.
To create the PR, push the branch:
git push -u origin i18n_update-drift-status
Then run gh pr create with:
- Title:
[i18n] Update drift status for localized content - Description: fill in the table below with the stats collected above, including only the locales that were processed.
Updates the drift status for localized content.
Status per locale after this PR:
| Locale | Drifted files | Total files |
| ------ | ------------- | ----------- |
| {ID} | {drifted} | {total} |