Skip to content

Internationalize docs home page and add Bible verse localization - #79

Merged
KallynGowdy merged 5 commits into
mainfrom
claude/awesome-edison-aqd9rz
Oct 7, 2026
Merged

KallynGowdy merged 5 commits into
mainfrom
claude/awesome-edison-aqd9rz

Conversation

@KallynGowdy

Copy link
Copy Markdown
Collaborator

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

  • Created docs/.vuepress/labels.json containing all UI text (navbar, sidebar, home page, footer, 404 page) that needs translation
  • Added docs/.vuepress/labels.ts with a mergeLabels() utility to fill in missing translations from English
  • Created docs/.vuepress/composables/useLocale.ts to provide locale context throughout Vue components
  • Added docs/.vuepress/composables/formatLabel.ts with utilities to fill placeholders and render labels with HTML markup

Home Page Localization

  • Refactored HomePage.vue to use translated labels instead of hardcoded English text
  • Implemented dynamic Bible verse display system via docs/.vuepress/verses.ts and docs/.vuepress/verses.json
  • Verses are loaded per-locale and fall back to English when translations are unavailable
  • Updated comparison table to use translated labels from the labels system

Bible Verse Management

  • Created tools/fill-docs-verses.ts script to automatically populate Bible verses for each translated language
  • Implements Seed Bible's translation selection algorithm (via tools/seed-bible-translations.ts) to choose appropriate Bible translations by language
  • Script supports --force flag to replace existing verses and --dry-run for preview

Configuration Updates

  • Enhanced docs/.vuepress/config.ts to:
    • Dynamically discover translated language directories
    • Generate per-locale navbar and sidebar configurations from labels
    • Inject labels and verses into the build via __SITE_LABELS__ and __SITE_VERSES__ globals
    • Support language name overrides and fallbacks

Component Updates

  • Updated HomePage.vue to render all text from labels and use computed verses
  • Updated SiteFooter.vue to use translated labels with HTML placeholder support
  • Updated NotFound.vue to support locale switching after mount for proper 404 page localization
  • Modified client.ts to set document direction (LTR/RTL) based on page language

Translation Tool Enhancement

  • Extended tools/translate-docs.ts to also translate labels.json files alongside markdown pages
  • Added translateLabels() function to handle nested label objects while preserving placeholders

Translated Content

  • Added labels.json files for 16 languages (af, am, ar, bn, de, es, fr, ha, hi, id, it, ja, pt, ru, sw, ur, zh-CN, zu)
  • Added verses.json with English Bible verses as the base for all locales

Notable Implementation Details

  • Bible verses use real translations from the Free Use Bible API rather than machine translation
  • The comparison table structure was refactored to separate marks from their explanatory text, allowing translations to provide localized explanations
  • Locale context is injected via Vue's provide/inject to allow nested components to access the current locale
  • The 404 page uses provideLocaleAfterMount() to switch to the reader's language after hydration, avoiding build-time HTML mismatches
  • Language selection in the navbar is automatically populated from discovered translated directories

https://claude.ai/code/session_0111WiCk7wYZYbBipgb3u7HG

claude added 5 commits October 7, 2026 19:43
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
@KallynGowdy
KallynGowdy merged commit 741b7df into main Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants