Repository navigation
Internationalize docs home page and add Bible verse localization - #79
Merged
Merged
Conversation
Register each machine-translated docs directory (found by its .translated-docs marker) as a VuePress locale, which turns on the default theme's language dropdown in the navbar. Languages are listed by their native names and switching keeps the reader on the same page. The navbar and sidebar are generated per locale, the custom home, footer and 404 links now stay in the current language, and Arabic and Urdu pages are rendered right to left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0111WiCk7wYZYbBipgb3u7HG
Move the navbar and sidebar labels (plus the language menu's text) into docs/.vuepress/labels.json. The site config builds each locale's menus from docs/<language>/labels.json, falling back to English for any label a translation lacks, and also uses them for breadcrumb names. tools/translate-docs.ts now translates labels.json alongside the pages. The label files for the 18 existing languages were written by hand, since the translation API was not available here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0111WiCk7wYZYbBipgb3u7HG
Move the text of the custom home page, footer and 404 page into
docs/.vuepress/labels.json, grouped as nav, home, footer and notFound,
and have the components read the current locale's labels. The config
passes every locale's labels to the client, filling anything a
translation lacks from English.
tools/translate-docs.ts now translates nested label files, and runs each
label through the same markdown conversion as page prose, so **bold**
and {{ placeholders }} survive translation. The existing nav labels are
moved under "nav"; the new text stays English until
`pnpm translate:docs` is run.
The 404 page switches to the reader's language once mounted, since one
build-time page serves every locale, and text direction now follows the
address's locale so the home and 404 pages are right to left in Arabic
and Urdu too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0111WiCk7wYZYbBipgb3u7HG
The two verses on the docs home page are now listed per language in
docs/.vuepress/verses.ts, with the verse text, the translation's book
name, its abbreviation and its Free Use Bible API translation ID (also
used for the Seed Bible link). A language without its own verses shows
the English ones, marked as English.
They are removed from labels.json so translate-docs no longer
machine-translates Scripture; only the link's "Open {{ reference }} in
Seed Bible" label is translated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0111WiCk7wYZYbBipgb3u7HG
Add pnpm fill:docs-verses, which writes each translated language's home page verses to docs/<language>/verses.json from the Free Use Bible API, using the repo's own API client. The translation is chosen with the Seed Bible app's default-translation logic, ported from BibleReadingManager.tsx and languageMeta.ts (seed-bible eecc7e8) into tools/seed-bible-translations.ts: its preferred translation, then any catalog translation in the language, then the language's fallback, then English (which the script leaves to the existing English fallback). Verses already in a file are kept unless --force is passed, so they can still be set by hand. A verse quoted from a fallback language records that language so the page marks it correctly. The English verses move to docs/.vuepress/verses.json; verses.ts keeps which verses are quoted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0111WiCk7wYZYbBipgb3u7HG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive internationalization support to the documentation site, enabling the home page and navigation to be translated into multiple languages. It also implements a system for displaying Bible verses in the appropriate language for each locale.
Key Changes
Internationalization Infrastructure
docs/.vuepress/labels.jsoncontaining all UI text (navbar, sidebar, home page, footer, 404 page) that needs translationdocs/.vuepress/labels.tswith amergeLabels()utility to fill in missing translations from Englishdocs/.vuepress/composables/useLocale.tsto provide locale context throughout Vue componentsdocs/.vuepress/composables/formatLabel.tswith utilities to fill placeholders and render labels with HTML markupHome Page Localization
HomePage.vueto use translated labels instead of hardcoded English textdocs/.vuepress/verses.tsanddocs/.vuepress/verses.jsonBible Verse Management
tools/fill-docs-verses.tsscript to automatically populate Bible verses for each translated languagetools/seed-bible-translations.ts) to choose appropriate Bible translations by language--forceflag to replace existing verses and--dry-runfor previewConfiguration Updates
docs/.vuepress/config.tsto:__SITE_LABELS__and__SITE_VERSES__globalsComponent Updates
HomePage.vueto render all text from labels and use computed versesSiteFooter.vueto use translated labels with HTML placeholder supportNotFound.vueto support locale switching after mount for proper 404 page localizationclient.tsto set document direction (LTR/RTL) based on page languageTranslation Tool Enhancement
tools/translate-docs.tsto also translatelabels.jsonfiles alongside markdown pagestranslateLabels()function to handle nested label objects while preserving placeholdersTranslated Content
labels.jsonfiles for 16 languages (af, am, ar, bn, de, es, fr, ha, hi, id, it, ja, pt, ru, sw, ur, zh-CN, zu)verses.jsonwith English Bible verses as the base for all localesNotable Implementation Details
provideLocaleAfterMount()to switch to the reader's language after hydration, avoiding build-time HTML mismatcheshttps://claude.ai/code/session_0111WiCk7wYZYbBipgb3u7HG