Skip to content

feat: i18n support with English and Spanish locale switching#111

Merged
eclectic-coding merged 3 commits into
mainfrom
feat/i18n-support
Jun 6, 2026
Merged

feat: i18n support with English and Spanish locale switching#111
eclectic-coding merged 3 commits into
mainfrom
feat/i18n-support

Conversation

@eclectic-coding

Copy link
Copy Markdown
Owner

Summary

  • Extract all hardcoded UI strings (~250 keys) into locale YAML files (config/locales/en.yml and config/locales/es.yml), covering page titles, table headers, button labels, empty states, flash messages (with pluralization), and sparkline tooltips
  • Add a language selector dropdown in the dashboard header that switches locales at runtime; locale is stored in the session and persists across requests; the switcher auto-hides when only one locale is configured
  • Add config.available_locales configuration option (default [:en, :es]) so host apps can restrict or extend the available locales; additional locales can be added via the host app's own config/locales/ directory
  • Use I18n.with_locale inside an around_action for thread-safe locale switching; ?locale= URL param takes precedence over session, and the locale form preserves all other query params (filters, sort, pagination)

Test plan

  • Run bundle exec rake — full suite (RuboCop + RSpec) passes with 100% coverage
  • Start dummy app (cd spec/dummy && bin/rails server) and verify dashboard renders in English by default
  • Switch to Spanish via the header dropdown; verify all labels, flash messages, and empty states render in Spanish
  • Verify locale persists across page navigation (session-backed)
  • Set config.available_locales = [:en] in dummy initializer; verify the language selector disappears
  • Discard a job and verify pluralized flash ("1 job discarded." vs "N jobs discarded.") in both locales

🤖 Generated with Claude Code

eclectic-coding and others added 3 commits June 6, 2026 15:07
Extract all UI strings to locale YAML files and ship English (en) and
Spanish (es) translations. Add a session-backed locale switcher in the
header that persists the user's choice across requests.

Key changes:
- config/locales/en.yml and es.yml with every label, flash message,
  table header, empty state, confirmation dialog, and sparkline tooltip
- ApplicationController#with_locale around_action picks locale from
  params[:locale] → session → I18n.default_locale
- SolidStackWeb.available_locales config (default [:en, :es]); switcher
  is hidden when only one locale is configured
- Engine loads engine locale files ahead of the host app's
- All 25 views, 12 controllers, and the helper updated to use t()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add i18n/locale switching to README feature list and available_locales
config docs. Remove completed i18n item from ROADMAP v2.0 milestone.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@eclectic-coding eclectic-coding merged commit 93bc561 into main Jun 6, 2026
5 checks passed
@eclectic-coding eclectic-coding deleted the feat/i18n-support branch June 6, 2026 19:11
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