Skip to content

I18n#83

Merged
brunoborges merged 3 commits intomainfrom
i18n
Feb 25, 2026
Merged

I18n#83
brunoborges merged 3 commits intomainfrom
i18n

Conversation

@brunoborges
Copy link
Copy Markdown
Member

Internationalization and locale support:

  • Added support for loading locale display names from locales.properties and UI strings from JSON translation files, with English fallback for missing keys. Also implemented flattening of nested JSON translation keys for easier token replacement. [1] [2] [3]
  • Introduced buildLocale function to generate site content for each locale, including localized HTML files, data files, and index pages. Locale-specific tokens and paths are handled throughout.
  • Implemented translation-aware token replacement and HTML generation, including localized support badges, navigation arrows, index cards, related cards, and social share sections. All relevant rendering functions now accept locale and strings parameters. [1] [2] [3] [4] [5]

Content translation and fallback:

  • Added resolveSnippet to load translated content for snippets, falling back to English and always using English code samples. This ensures consistency in code while allowing localized explanations and metadata.

HTML meta and UI enhancements for localization:

  • Added generation of hreflang meta tags for SEO and locale switching, locale picker dropdown HTML, and client-side i18n script block for dynamic UI translations.

Token replacement improvements:

  • Enhanced the token replacement logic to handle nested tokens and dot-separated keys, supporting dynamic insertion of localized strings throughout templates. [1] [2]

brunoborges and others added 3 commits February 25, 2026 18:06
- Add two-layer i18n: UI strings (translations/strings/) and content
  translations (translations/content/)
- Extract all hard-coded English from templates into en.json
- Add complete pt-BR UI string translations
- Add 3 pt-BR content translations as proof of concept
- Extend generate.java to iterate locales, merge strings with fallback,
  generate locale-specific output under site/{locale}/
- Add hreflang alternate links, locale picker dropdown, window.i18n
  script injection
- Make app.js locale-aware: path detection, correct snippets.json
  loading, locale picker behavior, i18n string usage
- Add locale picker and untranslated-notice CSS
- Use hash links (#category) for breadcrumb category filtering
- Scroll to filter section when index loads with hash

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Detect user's browser language via navigator.languages and auto-redirect
to matching locale (e.g. pt-BR) on first visit. Respects explicit user
choice stored in localStorage from the locale picker. Adds
availableLocales array to window.i18n injected by the generator.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Generated locale directories (site/pt-BR/) should not be committed;
they are built by html-generators/generate.java at deploy time.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@brunoborges brunoborges merged commit a5bf2a8 into main Feb 25, 2026
@brunoborges brunoborges deleted the i18n branch February 26, 2026 01:29
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.

1 participant