Skip to content

Add internationalization (i18n) support to Gemini CLI#6832

Closed
hoteye wants to merge 48 commits intogoogle-gemini:mainfrom
hoteye:feature/i18n-internationalization
Closed

Add internationalization (i18n) support to Gemini CLI#6832
hoteye wants to merge 48 commits intogoogle-gemini:mainfrom
hoteye:feature/i18n-internationalization

Conversation

@hoteye
Copy link
Copy Markdown
Contributor

@hoteye hoteye commented Aug 22, 2025

Overview

This PR implements comprehensive internationalization support for Gemini CLI, enabling users worldwide to interact with the tool in their native language.

Related to: #6525

Features Implemented

Language Support

  • 4 Languages: English (en), Chinese (zh), French (fr), Spanish (es)
  • Runtime switching: /lang zh command for dynamic language changes
  • Environment variable: GEMINI_LANG=zh for startup language setting
  • Automatic detection: Falls back to system language or English

Internationalized Components

Core UI Elements

  • Confirmation buttons: Yes/No → 是/否 → Oui/Non → Sí/No
  • Tool confirmation dialogs: Complete localization of permission prompts
  • IDE integration prompts: Multi-language setup guidance

Commands & Messages

  • Help system (/help): Fully localized help content
  • Language command (/lang): Multi-language switching interface
  • Chat commands (/chat): Error messages and status feedback
  • Copy command (/copy): Operation feedback messages
  • Memory commands (/memory): Status and error messages
  • Stats command (/stats): Session information display

Error Handling

  • User-facing errors with appropriate localization
  • Graceful fallback to English when translations are missing

Technical Implementation

Dependencies

  • react-i18next: React integration for i18next
  • i18next: Core internationalization framework
  • Minimal impact: ~20KB additional bundle size

Architecture

packages/cli/src/i18n/
├── index.ts                 # Core i18n configuration
└── locales/
    ├── en/                  # English translations
    ├── zh/                  # Chinese translations  
    ├── fr/                  # French translations
    └── es/                  # Spanish translations
        ├── commands.json    # Command descriptions
        ├── dialogs.json     # Dialog text
        ├── help.json        # Help content
        ├── ui.json          # UI elements
        ├── errors.json      # Error messages
        ├── feedback.json    # Success/status messages
        ├── messages.json    # System messages
        ├── tools.json       # Tool-related text
        └── validation.json  # Form validation messages

Key Features

  • Namespace organization: Logical separation of translation categories
  • Type safety: Full TypeScript integration
  • Variable interpolation: Support for dynamic content ({{variable}})
  • Lazy loading: Efficient resource management
  • Backward compatibility: No breaking changes to existing APIs

Testing

44 new test cases across 4 core components with 100% success rate:

  • ContextSummaryDisplay (5 tests): Bilingual display and translation key resolution
  • Footer (10 tests): Multi-language sandbox status and UI elements
  • Language Command (20 tests): Complete /lang command coverage across all 4 languages
  • Translation Integrity (9 tests): Cross-language consistency and file structure validation

Infrastructure:

  • Multi-language component rendering tests
  • Translation integrity validation and fallback testing
  • All 1674/1674 tests passing in CLI package
  • Full TypeScript compilation with no errors

Implementation Status

Current Coverage:

  • 22 of 45 UI components (49%) fully internationalized
  • All core user interactions completed: dialogs, help system, commands, and major UI elements
  • 15 components remaining for future work: primarily status indicators and helper text
  • 8 components require no i18n (layout/logic only)

Foundation established for seamless expansion to remaining components.

Future Enhancement - Visual Testing Framework

Planned for follow-up PR: Professional-grade visual testing toolkit for i18n validation.

Key Features:

  • Side-by-side rendering comparison across all 4 languages
  • Interactive HTML reports similar to Storybook/Percy
  • Automated translation consistency validation
  • 80% reduction in manual testing time

This framework leverages the robust i18n infrastructure established in this PR to ensure long-term translation quality.

Bug Fixes

  • Fixed langCommand parameter handling: Corrected args parameter from array to string for consistency with other commands
  • Resolved TypeScript compilation errors: All parameter type mismatches resolved
  • Test suite fixes: All 20 langCommand tests now pass successfully

Looking forward to your feedback and guidance!

hoteye added 8 commits August 21, 2025 00:43
… CLI

Implement complete internationalization (i18n) infrastructure with English and Chinese language support, enabling global accessibility for non-English users.

- 🌐 Dynamic language switching via /lang command and GEMINI_LANG environment variable
- 🔧 Comprehensive translation system with namespaced resource files
- 🎨 Internationalized UI components including help system, context displays, and loading phrases
- 🧪 Updated test suite with proper i18n mocking
- 📚 Complete translation coverage for commands, UI elements, and user interactions

- Added react-i18next framework with custom useTranslation hook
- Implemented translation namespaces (ui, commands, help, dialogs, errors)
- Created HelpI18n component with intelligent command description mapping
- Internationalized 129 loading phrases in usePhraseCycler
- Added Chinese translations for all user-facing text
- Updated context displays to show natural language expressions

- packages/cli/src/i18n/ - Complete i18n infrastructure
- packages/cli/src/ui/commands/langCommand.ts - Language switching command
- packages/cli/src/ui/components/HelpI18n.tsx - Internationalized help system

- Core UI components: App.tsx, ContextSummaryDisplay.tsx, ContextUsageDisplay.tsx
- Loading system: usePhraseCycler.ts with translated phrases
- Help system: helpCommand.ts with language-aware rendering
- Test files: Added i18n mocking for ContextSummaryDisplay, Footer, HistoryItemDisplay

- English (en) - Complete coverage
- Chinese (zh) - Complete coverage
- Extensible architecture for additional languages

Addresses GitHub Issue google-gemini#6525 for Gemini CLI internationalization.
## Progress Update
Continue internationalization implementation with additional UI components
and utility functions for comprehensive language support.

## New Components Added
- AuthDialogI18n.tsx - Internationalized authentication dialog (WIP)
- SettingsDialogI18n.tsx - Internationalized settings dialog (WIP)
- I18N_IMPLEMENTATION_SUMMARY.md - Complete analysis of remaining i18n work

## Enhanced Components
- AboutBox.tsx - Added i18n support for version display
- Footer.tsx - Enhanced with translation support
- SessionSummaryDisplay.tsx - Internationalized session summaries
- StatsDisplay.tsx - Added i18n for statistics display
- Tips.tsx - Internationalized getting started tips

## Utility Functions
- packages/cli/src/ui/utils/getCommandDescription.ts - Command description helper
- packages/cli/src/ui/utils/getErrorMessage.ts - Error message localization
- packages/core/src/utils/i18nInterface.ts - Core i18n interface

## Updated Hooks and Services
- useSlashCompletion.ts - Enhanced with i18n support
- useGeminiStream.ts - Added translation hooks
- slashCommandProcessor.ts - Internationalized command processing
- loopDetectionService.ts - Added i18n error messages
- errorParsing.ts - Enhanced error localization

## Progress Status
- ✅ Core i18n infrastructure: Complete
- ✅ Help system: Complete
- ✅ Context displays: Complete
- ✅ Loading phrases: Complete
- 🔄 Dialog systems: In Progress (AuthDialog, SettingsDialog)
- 📋 Remaining: ~35 high-priority strings in key dialogs

This commit represents significant progress toward comprehensive internationalization
of the Gemini CLI interface, with focus on user-facing components and error handling.
Add comprehensive French language support to Gemini CLI with:
- Complete French translations for all UI components, commands, dialogs, errors, and help content
- Enhanced language switching command supporting en/zh/fr with /lang fr
- Improved code style consistency by removing emoji icons from language messages
- Updated i18n configuration to include French (fr) locale
- Extended all internationalized components to support three languages

This builds upon the existing internationalization framework to provide
complete trilingual support (English, Chinese, French) for global users.

All features tested and verified:
- Translation completeness: 100% coverage
- Language switching: Fully functional
- Build integration: All translation files included in distribution
- Code style: Consistent with project conventions
- Add react-i18next integration with 4 languages (en, zh, fr, es)
- Implement namespace-based translation organization
- Add runtime language switching via /lang command
- Support GEMINI_LANG environment variable
- Internationalize core UI components:
  - Confirmation buttons and dialogs
  - Help system (/help command)
  - Tool confirmation messages
  - Chat, copy, memory, and stats commands
- Maintain full backward compatibility
- Add comprehensive error handling with fallbacks

Related to google-gemini#6525
…tion support

This commit extends the internationalization implementation to additional UI components,
focusing on user-facing text and improved accessibility for global users.

Key changes:
- Enhanced UI components in directories, restore, and GitHub setup commands
- Improved internationalization for privacy notices across all service types
- Updated DiffRenderer and MarkdownDisplay components with i18n support

This builds upon the existing i18n infrastructure to provide a more complete
multilingual experience. All changes maintain backward compatibility and
follow established i18n patterns.

Addresses: google-gemini#6525
…-language testing

- Add react-i18next integration with dynamic language switching
- Implement /lang command for runtime language switching (en/zh/fr/es)
- Add HelpI18n component with complete bilingual help interface
- Create multi-language test framework for UI components
- Add translation integrity validation system
- Fix translation key resolution in test environment
- Reduce test failures from 68 to 5 (92.6% improvement)

Testing Coverage:
- ContextSummaryDisplay: 5 multi-language tests
- Footer: 10 multi-language tests
- Language switching: 20 comprehensive tests
- Translation integrity: 9 system validation tests

Technical Implementation:
- Framework: react-i18next (React+Ink compatible)
- Package size: +20KB (acceptable)
- Performance impact: <5ms startup (negligible)
- Backward compatibility: 100% maintained

Addresses: Issue google-gemini#6525 - Add internationalization (i18n) support
- Add complete i18n framework with react-i18next
- Support 4 languages: English, Chinese, French, Spanish
- Add /lang command for runtime language switching
- Support GEMINI_LANG environment variable
- Internationalize 22 core UI components
- Add 44 comprehensive test cases
- Fix langCommand parameter handling bug
- Maintain full backward compatibility

Related to: google-gemini#6525
@hoteye hoteye requested a review from a team as a code owner August 22, 2025 16:04
@gemini-cli gemini-cli bot added kind/enhancement priority/p2 Important but can be addressed in a future release. labels Aug 22, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @hoteye, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces comprehensive internationalization (i18n) support to the Gemini CLI, enabling a global user base to interact with the tool in their preferred language. The changes involve integrating react-i18next and i18next to manage translations for UI elements, commands, and messages across English, Chinese, French, and Spanish. It provides flexible language switching options via a new /lang command and environment variables, ensuring a seamless localized experience. The implementation includes a robust cross-package translation interface and is backed by extensive new test cases to guarantee translation integrity and functionality.

Highlights

  • Comprehensive Internationalization (i18n): The Gemini CLI now supports multiple languages, including English, Chinese, French, and Spanish, allowing users worldwide to interact with the tool in their native language. This is achieved through the integration of react-i18next and i18next.
  • Dynamic Language Switching: Users can dynamically switch the interface language using the new /lang command (e.g., /lang zh for Chinese). The CLI also supports setting the language via the GEMINI_LANG environment variable and automatically falls back to system language or English if a preferred language is not found.
  • Localized User Interface and Commands: Key UI elements such as confirmation buttons, tool confirmation dialogs, and IDE integration prompts have been fully localized. Core commands like /help, /chat, /copy, /memory, and /stats, along with user-facing error messages, now display in the selected language.
  • Cross-Package Translation Mechanism: A robust cross-package translation mechanism has been implemented, allowing the packages/core module to leverage the CLI's i18n capabilities for error messages and other shared strings, ensuring consistent localization throughout the application.
  • Extensive Testing and Quality Assurance: The PR includes 44 new test cases covering bilingual display, translation key resolution, and comprehensive testing of the /lang command across all supported languages, ensuring the stability and correctness of the i18n implementation.
  • Bug Fixes and Code Improvements: Several bugs were addressed, including correcting the langCommand parameter handling from an array to a string for consistency and resolving various TypeScript compilation errors, improving overall code quality and reliability.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive internationalization (i18n) framework to the Gemini CLI, adding support for English, Chinese, French, and Spanish. The implementation is well-structured, using i18next and a clean architecture with JSON translation files. My review identified a critical initialization issue where the error message translator for the core package is not being set up, and a high-severity issue related to an unhandled promise rejection in the Help component. Addressing these will ensure the i18n system is robust and fully functional.

hoteye added 2 commits August 23, 2025 06:38
- Add setErrorTranslator function for core package integration
- Add Promise error handling in Help component changeLanguage call
- Address automated code review feedback

Fixes bot-identified issues:
- Critical: Initialize error translation mechanism for core package
- High: Handle unhandled promise rejection in Help component
- Replace setErrorTranslator function with simpler export approach
- Export i18n instance as errorTranslator for core package integration
- Maintain bot feedback compliance with cleaner implementation
@hoteye hoteye force-pushed the feature/i18n-internationalization branch 4 times, most recently from 5c99dc8 to 1710683 Compare August 23, 2025 00:12
- Remove .vscode/settings.json (personal IDE configuration)
- Remove I18N_IMPLEMENTATION_SUMMARY.md (project documentation)
- Remove i18n-implementation-plan.md (project documentation)
@hoteye
Copy link
Copy Markdown
Contributor Author

hoteye commented Aug 27, 2025

@jacob314 Hi! I've implemented the core i18n support as discussed in issue #6525:

1, 4 languages (EN/ZH/FR/ES) with /lang command switching
2, 22 key UI components internationalized
3, 44 test cases + type-safe translation system

This covers the main functionality with more components to follow. Ready for your review when convenient - would appreciate your feedback on the current approach!

Copy link
Copy Markdown
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm incredibly impressed by this work. I'd like to help you land this as soon as possible as this will get hit by a lot of merge conflicts.

I'm glad the i18n code barely touched the core package. if we could make tweaks to fully separate it from core that would be nice for simiplicty but I am ok with landing that as is and then cleaning up later.

`\nPossible quota limitations in place or slow response times detected. Switching to the ${fallbackModel} model for the rest of this session.`;
getTranslatedErrorMessage(
'quota.rateLimitDetected',
`\nPossible quota limitations in place or slow response times detected. Switching to the ${fallbackModel} model for the rest of this session.`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems we need a more advanced way to translate these so that this message remains internationalized if new models are released and fallback models change.

Copy link
Copy Markdown
Contributor Author

@hoteye hoteye Aug 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Jacob314,

You've identified a crucial pain point. After implementing i18n, I've experienced firsthand how it impacts developer productivity.

After i18n (5+ places to update):

  • Code: Add i18n key
  • 4 translation files: en, zh, es, fr
  • Maintain synchronization across all files
  • Test multiple languages

I'm committed to finding a solution that doesn't slow down Gemini CLI's development velocity.

should I consider migrating to an automated string extraction approach? This would involve build tools scanning code for t() calls to auto-generate translation files, export to industry-standard XLIFF format for professional translators using CAT tools like Trados/MemoQ, and provide translation memory + terminology management - significantly better for enterprise-scale localization. Worth the trade-off for professional translation workflows?

Looking forward to your guidance.

`\nYou have reached your daily ${currentModel} quota limit. You will be switched to the ${fallbackModel} model for the rest of this session. To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`;
getTranslatedErrorMessage(
'quota.modelQuotaReached',
`\nYou have reached your daily ${currentModel} quota limit. You will be switched to the ${fallbackModel} model for the rest of this session. To increase your limits, upgrade to a Gemini Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist, or use /auth to switch to using a paid API key from AI Studio at https://aistudio.google.com/apikey`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems we need a more advanced way to translate these so that this message remains internationalized if new models are released and fallback models change.

hoteye added 5 commits August 29, 2025 12:22
- Restore VS Code workspace settings for project consistency
- Includes TypeScript diagnostics and Prettier formatter configuration
- Addresses maintainer feedback from PR review
- Replace hardcoded `debug: false` with `debug: \!\!process.env.DEBUG`
- Follows project standard pattern from sandbox.ts
- Enables dynamic debug control via DEBUG environment variable
- Addresses maintainer feedback from PR review
- Format function parameters and return types
- Improve array and object formatting consistency
- Clean up chain method call formatting
- Addresses maintainer feedback for consistent code style
- Applied Prettier formatting to all i18n related files
- Improved code consistency and readability across:
  * Core i18n modules (useTranslation, translationIntegrity)
  * Language commands and tests
  * Internationalized components (AuthDialog, Help, Settings)
  * Commands using i18n (chat, memory)
- Addresses maintainer feedback for consistent code formatting

9 files changed, 422 insertions(+), 297 deletions(-)
- Removed `typeof window \!== 'undefined'` browser detection
- Removed `localStorage.setItem()` browser storage API calls
- Replaced with CLI-appropriate placeholder implementation
- Language switching should use GEMINI_LANG env var, config files, or CLI args
- Addresses maintainer feedback about inappropriate browser code in CLI tool

This fixes the browser-specific code that doesn't belong in a Node.js CLI environment.
- Add GEMINI_LANG and LANG/LC_ALL environment variable support
- Add 'Use GEMINI_LANG (Environment Variable)' option in settings
- Fix translation test warnings instead of failures for missing keys
- Enhance coverage report with Markdown format output
- Update documentation for environment variable usage

Addresses @cornmander feedback:
- Missing translations now show warnings, not test failures
- Coverage reports generated with --coverage flag
- Unix standard environment variables (LANG/LC_ALL) supported
- GEMINI_LANG takes precedence for Gemini-specific language setting

Changes:
- Modified initializeI18nWithSettings() to detect environment variables
- Added language priority: settings > GEMINI_LANG > LANG > default
- Updated settingsSchema to include environment variable option
- Enhanced find-unused-translations.ts with Markdown coverage reports
- Fixed translationIntegrity tests for incremental language support
- Added comprehensive documentation in docs/cli/
- Add GEMINI_LANG and LANG/LC_ALL environment variable documentation
- Document automatic language detection features
- Add development tools section with coverage report usage
- Update language setting priority order documentation
Remove remaining personal editor preferences as requested by @cornmander
Fix hardcoded English strings in Vertex AI error messages by:
- Add vertexOption1 and vertexOption2 translation keys
- Replace hardcoded strings with proper translation calls
- Add translations for all supported languages (en, zh, es, fr)
- Complete missing config.json translations for consistency

Addresses @cornmander feedback about multi-line message handling.

Before: Mixed translated + hardcoded English text
After: Fully translated multi-line messages
Remove test snapshot files that were inadvertently committed.
These files are already ignored by .gitignore (__snapshots__/)
and should be generated locally during testing.

Addresses @cornmander feedback about cleaning up snapshot files.
- Add missing terminal.json for Chinese (zh)
- Add missing translation files for Spanish (es): auth.json, sandbox.json, setupGithub.json, status.json, terminal.json
- Add missing translation files for French (fr): auth.json, sandbox.json, setupGithub.json, status.json, terminal.json
- Translation coverage now: Chinese 100.1%, Spanish 98.4%, French 98.4%
- Reduced missing keys from 76 total to only 33 total across all languages
- Updated translation coverage report with latest statistics
- EnumSelector remains a generic component with no internal sorting
- SettingsDialog implements language-specific sorting logic
- Environment variable option (empty string) prioritized for language settings
- Other enum settings remain unaffected (no custom sorting)
- Add getSortedOptions function to handle setting-specific requirements
- Export detectLanguageFromEnv for switchLanguage empty string handling
- Update switchLanguage to properly handle environment variable selection
…variable option

- Change environment variable option value from '' to '__ENV__'
- Update SettingsDialog sorting logic to prioritize '__ENV__'
- Update switchLanguage to handle '__ENV__' identifier
- Update i18n initialization to recognize '__ENV__' as environment trigger
- This eliminates all falsy value issues and provides clear semantic meaning
- __ENV__ is more explicit than empty string and easier to debug
…ment variables

Remove GEMINI_LANG environment variable support per @cornmander feedback.
Now only supports standard UNIX environment variables (LANG, LC_ALL).

Changes:
- Remove GEMINI_LANG detection from detectLanguageFromEnv()
- Update priority order: Settings → LANG/LC_ALL → Default
- Simplify settings label from "By Environment Variables" to "By ENV"
- Update all translation files with shorter text
- Remove GEMINI_LANG from documentation
- Update debug logging to exclude GEMINI_LANG

This simplifies language detection and follows standard UNIX conventions.
- Revert .vscode/settings.json to match upstream main branch
- Improve EnumSelector robustness with proper React hooks usage
- Add guard clauses for empty options array
- Fix UI state consistency in useEffect

These changes address @cornmander's feedback on google-gemini#6832.
@cornmander
Copy link
Copy Markdown
Contributor

Thank you for creating #7774.

This PR is heading in the right direction and I think we can start merging parts in, one at a time. It would not be a good idea to merge in the entire change in a single large PR for a few reasons:

  • The change touches huge parts of the code all at once so the chance of introducing many bugs at once is high
  • We won't be able to bisect bugs to specific code commits
  • You will constantly be fighting merge conflicts as we keep reviewing

I think we should aim to get this in in the following sequence. It's just my initial proposal, so if you have other ideas, we can consider them as well:

  1. Extract strings from the UI using i18next and introduce the en locale. There should be no user-facing changes in behavior.
  2. Introduce the locale picker and related settings. There will only be one selectable locale.
  3. Introduce each new locale one at a time.

What do you think?

@hoteye
Copy link
Copy Markdown
Contributor Author

hoteye commented Sep 5, 2025

Hi @cornmander,

Thank you so much for the detailed feedback! I completely agree with your 3-phase approach.

Phase 1: Extract strings + i18next foundation

  • Set up i18next infrastructure
  • Extract UI strings using t() function
  • Introduce only en locale (no user-facing changes)
  • Focus on core components like Help, Auth, Settings dialogs
  • Goal: Zero behavioral changes, pure refactoring for reviewability

Phase 2: Locale picker infrastructure

  • Add Language option to SettingsDialog
  • Implement locale switching logic
  • Still only English available (single option)
  • Goal: Settings UI ready, but no actual language switching yet

Phase 3: Add locales incrementally

  • Add Chinese (zh) translations
  • Then Spanish (es)
  • Then French (fr)
  • One language per PR for easy review

Questions for Phase 1:

  1. Scope: Should I focus on ~5 core components (Help, Auth, Settings, Error messages) or go broader?

  2. File structure: Is this organization acceptable?

    src/i18n/
    ├── index.ts
    ├── locales/en/
    │   ├── common.json
    │   ├── help.json
    │   └── dialogs.json
    └── useTranslation.ts
    
  3. Testing: Include basic i18n tests in Phase 1, or save for Phase 2?

I'll close this current PR and create a focused Phase 1 PR following your guidance. This approach will make the review process much smoother and reduce integration risks.

Thanks again for the thoughtful feedback!

…EnumSelector

- Replace `◀ ▶` (asymmetric triangle arrows) with `← →` (symmetric left-right arrows)
- Fix spacing inconsistency where left arrow had extra space but right arrow didn't
- Improve visual clarity: left-right arrows are more intuitive for navigation

The triangle arrows had rendering width inconsistencies in terminals, causing
|◀  English ▶ | (uneven spacing). The new arrows provide perfect symmetry:
|← English →| with consistent spacing on both sides.

This change improves the user experience for language selection and other
enum selectors in the i18n settings interface.
@cornmander
Copy link
Copy Markdown
Contributor

Hi @cornmander,

Thank you so much for the detailed feedback! I completely agree with your 3-phase approach.

Phase 1: Extract strings + i18next foundation

  • Set up i18next infrastructure
  • Extract UI strings using t() function
  • Introduce only en locale (no user-facing changes)
  • Focus on core components like Help, Auth, Settings dialogs
  • Goal: Zero behavioral changes, pure refactoring for reviewability

Phase 2: Locale picker infrastructure

  • Add Language option to SettingsDialog
  • Implement locale switching logic
  • Still only English available (single option)
  • Goal: Settings UI ready, but no actual language switching yet

Phase 3: Add locales incrementally

  • Add Chinese (zh) translations
  • Then Spanish (es)
  • Then French (fr)
  • One language per PR for easy review

Questions for Phase 1:

  1. Scope: Should I focus on ~5 core components (Help, Auth, Settings, Error messages) or go broader?
  2. File structure: Is this organization acceptable?
    src/i18n/
    ├── index.ts
    ├── locales/en/
    │   ├── common.json
    │   ├── help.json
    │   └── dialogs.json
    └── useTranslation.ts
    
  3. Testing: Include basic i18n tests in Phase 1, or save for Phase 2?

I'll close this current PR and create a focused Phase 1 PR following your guidance. This approach will make the review process much smoother and reduce integration risks.

Thanks again for the thoughtful feedback!

Reply to questions:

  1. I think the three components you have listed are fine. Once we do reporting about completeness we can be more thorough.
  2. LGTM
  3. You should include them in phase 1.

@cornmander
Copy link
Copy Markdown
Contributor

I will close this PR as discussed above.

@cornmander cornmander closed this Sep 8, 2025
@hoteye
Copy link
Copy Markdown
Contributor Author

hoteye commented Sep 8, 2025

Hi @cornmander ,

​Thank you again for your thorough feedback and guidance on the PR! I completely agree with the proposed 3-phase approach. For the next step, I'll focus on creating a dedicated Phase 1 PR. This will include setting up the i18n foundation, refactoring the core components (Help, Auth, and Settings), and ensuring there are no user-facing changes in this phase.

​I'll prioritize making the review process as smooth as possible. Please let me know if there's anything else you'd like me to consider before I proceed.

​Best regards,

Dylan liu

github-merge-queue bot pushed a commit that referenced this pull request Sep 9, 2025
Co-authored-by: hoteye <hoteye@users.noreply.github.com>
Co-authored-by: cornmander <shikhman@google.com>
lifefloating pushed a commit to lifefloating/gemini-cli that referenced this pull request Sep 10, 2025
…i#6832) (google-gemini#7774)

Co-authored-by: hoteye <hoteye@users.noreply.github.com>
Co-authored-by: cornmander <shikhman@google.com>
SandyTao520 pushed a commit that referenced this pull request Sep 10, 2025
Co-authored-by: hoteye <hoteye@users.noreply.github.com>
Co-authored-by: cornmander <shikhman@google.com>
hoteye added a commit to hoteye/gemini-cli that referenced this pull request Sep 13, 2025
Following Jacob's feedback on Issue google-gemini#6832, replace partial assertion
testing with comprehensive JSON component snapshots for styledText utility.

Changes:
- Replace fragmented assertions with complete component JSON snapshots
- Add comprehensive golden test suite covering multiple scenarios
- Include error handling golden tests with detailed error structure capture
- Fix TypeScript error handling in catch blocks
- Update i18n documentation to emphasize JSON snapshot testing methodology

Test coverage:
- Simple single placeholder scenarios
- Complex multi-placeholder with different styles
- Nested styling and special characters
- Text with no placeholders
- Only placeholders with no surrounding text
- Missing mapping error scenarios
- Unused mapping error scenarios

This approach provides "golden test of the full component stringify"
as requested, making it clear exactly what changes impact the UI.

8 JSON snapshots generated covering all component scenarios.
giraffe-tree pushed a commit to giraffe-tree/gemini-cli that referenced this pull request Oct 10, 2025
…i#6832) (google-gemini#7774)

Co-authored-by: hoteye <hoteye@users.noreply.github.com>
Co-authored-by: cornmander <shikhman@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants