Skip to content

feat: propagate locale setting to plugins via DR_LOCALE#407

Open
miyamamoto wants to merge 2 commits intodatarobot-oss:mainfrom
miyamamoto:feature/propagate-locale-to-plugins
Open

feat: propagate locale setting to plugins via DR_LOCALE#407
miyamamoto wants to merge 2 commits intodatarobot-oss:mainfrom
miyamamoto:feature/propagate-locale-to-plugins

Conversation

@miyamamoto
Copy link
Copy Markdown
Contributor

@miyamamoto miyamamoto commented Mar 25, 2026

Summary

  • Add --locale persistent flag and locale config key to the CLI
  • Propagate DR_LOCALE environment variable to all plugins when explicitly configured
  • Only set when user explicitly specifies locale (via drconfig.yaml, --locale flag, or DATAROBOT_CLI_LOCALE env var), preserving each plugin's existing fallback behavior

Motivation

Currently, the assist plugin implements its own locale detection independently. This makes it difficult for users to set a unified locale across plugins. By propagating DR_LOCALE from the CLI config, users can configure locale once and have it apply to all plugins.

How plugins can adopt this

Plugins should check DR_LOCALE as the highest-priority locale source:

agent-assist (Python): DR_LOCALE > AGENT_ASSIST_LANG > config.yaml > "en"

Configuration methods

# ~/.config/datarobot/drconfig.yaml
locale: ja
dr --locale ja assist    # CLI flag
DATAROBOT_CLI_LOCALE=ja dr assist  # env var

Test plan

  • TestBuildPluginEnvLocale - verifies DR_LOCALE is set/unset correctly (4 patterns)
  • TestBuildPluginEnvAlwaysSetsPluginMode - verifies DR_PLUGIN_MODE always present
  • TestBuildPluginEnvSetsPluginPath - verifies DR_PLUGIN_PATH set correctly
  • task lint passes
  • go test ./internal/plugin/ passes

🤖 Generated with Claude Code


Note

Low Risk
Low risk: adds an optional --locale/locale config value and forwards it as DR_LOCALE to plugin subprocesses, with docs/tests updates and minimal impact when unset.

Overview
Adds a new global --locale flag (and locale config key / DATAROBOT_CLI_LOCALE env override via Viper) and propagates it to all plugin executions as DR_LOCALE when explicitly set.

Updates plugin execution tests to cover locale env propagation (and a couple of baseline env invariants), and refreshes user/developer docs to document the new flag/config/env behavior.

Written by Cursor Bugbot for commit 358636a. This will update automatically on new commits. Configure here.

Mitsuo Yamamoto added 2 commits March 25, 2026 11:14
Add --locale flag and config key so plugins can receive a unified
locale from the CLI. DR_LOCALE is only set when the user explicitly
configures it (drconfig.yaml, --locale flag, or DATAROBOT_CLI_LOCALE
env var), preserving each plugin's existing fallback behaviour.
Copy link
Copy Markdown
Contributor

@ajalon1 ajalon1 left a comment

Choose a reason for hiding this comment

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

Very comprehensive design, thanks. Per Slack, though, I think we need to be very explicit about what this feature is and what the expectations are of the CLI and of plugins. You do some already in the user guide, but I think it could be clearer.

I will request changes primarily because I think DATAROBOT_CLI_LOCALE is too ambiguous and feels like it should interact with the locale env vars in Linux-based systems...

╰─ ❯ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

or with Get-WinSystemLocale in Windows.

If we rename the flag itself to plugin-locale, with DATAROBOT_CLI_PLUGIN_LOCALE being the associated env var, I think this becomes clearer. But let's chat with Shreya some more.

const (
DataRobotURL = "endpoint"
DataRobotAPIKey = "token"
DataRobotLocale = "locale"
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.

I wonder if we need validation here. If we don't, we should be very explicit about that and this is just passed through.

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