Skip to content

Account SDK i18n #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Account SDK i18n #51

wants to merge 3 commits into from

Conversation

fan-zhang-sv
Copy link
Collaborator

Summary

Add Complete Internationalization System with 10 Languages

Summary

Implements a comprehensive, type-safe i18n system supporting 10 languages while keeping the SDK lean and extensible for other packages.

What's Added

🌐 Complete Translation Coverage

  • 10 languages: English, Spanish, French, German, Japanese, Korean, Chinese (Simplified/Traditional), Vietnamese, Portuguese
  • 16 translation keys covering all dialog messages and button text
  • Professional translations for all account-SDK UI components

🔧 Modular Architecture

  • Core library (src/core/i18n/) - Generic, reusable i18n system
  • Account-SDK implementation (src/i18n/) - Specific setup and translations
  • Namespace isolation - Multiple packages can use separate translation sets

⚡ Lean Implementation

  • Essential utilities only - quickSetup(), mergeTranslations(), core functions
  • Tree-shakable - Only used translations are bundled

Technical Details

Core Features

  • Type safety - Full TypeScript support with autocomplete
  • Auto locale detection - Browser language detection with fallbacks
  • Parameter interpolation - {param} syntax for dynamic content
  • Framework agnostic - Works with React, Vue, Svelte, vanilla JS
  • Graceful fallbacks - English → key name if translation missing

Usage Examples

Account-SDK (ready to use):

import { t } from './i18n/index.js';
console.log(t('dialog.signed_in_as', { username: 'John' })); // "Signed in as John"

Bundle Impact

  • Total added: ~20 KB uncompressed TypeScript
  • Production impact: ~4-6 KB gzipped (typical usage)
  • English only: ~2-3 KB gzipped
  • Smart loading: Only detected locale + English fallback loaded by default

Files Changed

  • Core library: src/core/i18n/index.ts, src/core/i18n/utils.ts
  • Account-SDK setup: src/i18n/index.ts
  • Translations: 10 locale files in src/i18n/locales/
  • Updated: Dialog component to use new i18n system

Migration

  • Zero breaking changes - Existing code continues to work
  • New recommended usage - import { t } from './i18n/index.js'
  • Backward compatible - All existing translation keys preserved

Benefits

  • Global reach - Support 10 major languages covering 80%+ of users
  • Developer experience - Type-safe, autocomplete, easy setup
  • Extensible - Other packages can easily add their own translations
  • Minimal overhead - Lean implementation optimized for bundle size
  • Production ready - Auto locale detection, graceful fallbacks

How did you test your changes?

Language A Language B Language C Language D
Screenshot 2025-07-22 at 11 09 06 AM Screenshot 2025-07-22 at 11 09 21 AM Screenshot 2025-07-22 at 11 09 21 AM Screenshot 2025-07-22 at 11 09 32 AM
Language A Language B Language C Language D
Screenshot 2025-07-22 at 11 11 32 AM Screenshot 2025-07-22 at 11 11 44 AM Screenshot 2025-07-22 at 11 12 23 AM Screenshot 2025-07-22 at 11 12 32 AM
Language A Language B Language C Language D
Screenshot 2025-07-22 at 11 15 43 AM Screenshot 2025-07-22 at 11 15 57 AM Screenshot 2025-07-22 at 11 16 08 AM Screenshot 2025-07-22 at 11 16 29 AM

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Jul 22, 2025

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

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