Skip to content

#8060: i18n (3/4) - User Locales - #18184

Closed
jethac wants to merge 5 commits into
google-gemini:mainfrom
jethac:i18n-split-003
Closed

jethac wants to merge 5 commits into
google-gemini:mainfrom
jethac:i18n-split-003

Conversation

@jethac

@jethac jethac commented Feb 3, 2026 •

Copy link
Copy Markdown

Summary

This is the third of four pull requests to implement the i18n system for Gemini CLI. This PR enables users and contributors to load Work-In-Progress (WIP) translations from the ~/.gemini/locales directory at runtime.

Stacked on PR #18182

What's Included

  • External Locale Loading: The i18n system now scans ~/.gemini/locales and merges any found translations with the built-in ones. This allows translators to test their work immediately without rebuilding the CLI.
  • Test Isolation: Updated the test suite to ensure that local user translations do not interfere with unit test results.
  • Storage Integration: Refactored path resolution to use the centralized Storage service for consistency.

PR Stack

Pull Request Scope Status
PR #18171 Core Infrastructure & Foundation ✅
PR #18182 Settings Integration & Asset Discovery ✅
PR #18184 (This) User Locales (~/.gemini/locales) 🚀 Ready
pending UI Component Migrations & Japanese Locale 📋 Future

Testing

# Create a test locale
mkdir -p ~/.gemini/locales/fr
echo '{"displayName": "Français"}' > ~/.gemini/locales/fr/manifest.json
# Run CLI and check Settings
npm start

hoteye and others added 4 commits February 3, 2026 00:40
- Set up i18next and react-i18next infrastructure
- Extract UI strings from Help, Auth, and Settings components
- Add English locale files with proper structure
- Implement styledText utility for interpolation
- Convert Help tests to use snapshots per Jacob's feedback
- Add direct component styling verification

This is a pure refactoring with zero behavioral changes.
All tests pass and code functionality remains identical.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jethac, 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 significantly advances the internationalization capabilities of the Gemini CLI by enabling dynamic loading of user-specific translation files. It introduces a new experimental setting for language selection, backed by a robust system for detecting and managing locale packs. Furthermore, it includes a specialized utility for rendering styled text within translations, ensuring a rich and consistent user experience across different languages.

Highlights

  • User-loadable WIP Translations: The i18n system now supports loading work-in-progress translations from ~/.gemini/locales, allowing translators to test changes without rebuilding the CLI.
  • New Language Setting: An experimental.language setting has been introduced, enabling users to select the CLI interface language, with options dynamically detected from available locale packs.
  • Robust Styled Text Rendering: A new renderStyledText utility has been added to handle styled interpolations within translated strings, ensuring semantic context for translators and proper rendering in the terminal.
  • I18n System Integration: Core i18n dependencies (i18next, react-i18next) have been integrated, along with initial English locale files and comprehensive unit tests for the i18n foundation.
  • Storage Service for Locales: Path resolution for user locales now leverages the centralized Storage service for consistency.
Changelog
  • docs/cli/settings.md
    • Added documentation for the new experimental.language setting, including its description and default value.
  • docs/get-started/configuration.md
    • Detailed the experimental.language setting within the configuration guide, specifying its type, description, default, and possible values.
  • package-lock.json
    • Updated @babel/runtime and introduced new dependencies: html-parse-stringify, i18next, react-i18next, and void-elements to support i18n functionality.
  • packages/cli/package.json
    • Added i18next and react-i18next as direct dependencies.
  • packages/cli/src/config/settingsSchema.ts
    • Integrated the experimental.language setting into the CLI's settings schema, dynamically populating its options from detected languages.
  • packages/cli/src/gemini.tsx
    • Ensured the i18n system is initialized early in the application lifecycle, before any React components are rendered.
  • packages/cli/src/i18n/index.test.ts
    • Introduced a new test file to validate the core i18n functionality, including translation retrieval, fallback mechanisms, namespace handling, and completeness checks for key UI elements.
  • packages/cli/src/i18n/index.ts
    • Implemented the main i18n setup, featuring dynamic loading of built-in and user-provided locale files, synchronous detection of available languages, and a system for determining the effective language based on environment variables and user settings.
  • packages/cli/src/i18n/locales/en/common.json
    • Added a new file containing common English translations for buttons, loading states, and general messages.
  • packages/cli/src/i18n/locales/en/dialogs.json
    • Added a new file with English translations for various dialogs, including authentication and settings.
  • packages/cli/src/i18n/locales/en/help.json
    • Added a new file providing English translations for help sections, basic functionality descriptions, and keyboard shortcuts.
  • packages/cli/src/i18n/locales/en/manifest.json
    • Added a new manifest file for the English locale, specifying its display name.
  • packages/cli/src/ui/components/SettingsDialog.test.tsx
    • Updated mock settings to include autoAccept for tools, and adjusted tests to reflect changes in how settings with options are handled.
  • packages/cli/src/ui/components/SettingsDialog.tsx
    • Modified the settings dialog to correctly display and handle string settings that have predefined options, treating them as 'enum' types for UI interaction.
  • packages/cli/src/ui/utils/styledText.test.tsx
    • Added a new test file for the renderStyledText utility, verifying its ability to render styled text with interpolations, handle various placeholder patterns, and report mismatches.
  • packages/cli/src/ui/utils/styledText.tsx
    • Introduced a new utility function renderStyledText to facilitate rendering of translated strings that contain styled React components as placeholders, ensuring proper error handling for placeholder mismatches.
  • packages/cli/src/utils/settingsUtils.ts
    • Adjusted getDisplayValue to correctly retrieve and display the label for settings that have predefined options.
  • packages/cli/test-setup.ts
    • Modified the test setup to initialize the i18n system globally, ensuring translations are available for all tests.
  • schemas/settings.schema.json
    • Extended the settings JSON schema to include the new experimental.language property.
  • scripts/copy_bundle_assets.js
    • Added a new step to copy the i18n locale files from packages/cli/src/i18n/locales to the bundle directory during the asset bundling process.
  • scripts/tests/generate-settings-doc.test.ts
    • Updated the fs mock to correctly handle createWriteStream while allowing other fs functions to use their actual implementations.
  • scripts/tests/test-setup.ts
    • Added an environment variable GEMINI_SKIP_USER_LOCALES to prevent user-specific locales from interfering with test runs.
Activity
  • This pull request is the third in a series of four, focusing on the implementation of the i18n system for Gemini CLI.
  • It is currently marked as "Ready" for review, indicating it has completed its development phase and is awaiting feedback.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. ↩

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

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.

Code Review

This pull request is a well-executed step in internationalizing the Gemini CLI. The core change, enabling the loading of user-provided locales from ~/.gemini/locales, is implemented robustly. I appreciate the thoughtful additions, such as the use of GEMINI_SKIP_USER_LOCALES for test isolation and the clever workaround in getSavedLanguagePreference to avoid circular dependencies. The new renderStyledText utility is also a great, well-tested addition for handling styled text in translations. Overall, the code quality is high, and the changes are well-structured and documented. I have no major concerns.

@gemini-cli gemini-cli Bot added the priority/p2 Important but can be addressed in a future release. label Feb 3, 2026
@jethac jethac changed the title i18n (3/4): User Locales #8060: i18n (3/4) - User Locales Feb 3, 2026
@gemini-cli

gemini-cli Bot commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Hi there! Thank you for your contribution to Gemini CLI. We really appreciate the time and effort you've put into this pull request.

To keep our backlog manageable and ensure we're focusing on current priorities, we are closing pull requests that haven't seen maintainer activity for 30 days. Currently, the team is prioritizing work associated with 🔒 maintainer only or help wanted issues.

If you believe this change is still critical, please feel free to comment with updated details. Otherwise, we encourage contributors to focus on open issues labeled as help wanted. Thank you for your understanding!

@gemini-cli gemini-cli Bot closed this Mar 6, 2026
@sripasg sripasg added the size/xl An extra large PR label Jun 2, 2026
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. size/xl An extra large PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants