feat: propagate locale setting to plugins via DR_LOCALE#407
feat: propagate locale setting to plugins via DR_LOCALE#407miyamamoto wants to merge 2 commits intodatarobot-oss:mainfrom
Conversation
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.
ajalon1
left a comment
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
I wonder if we need validation here. If we don't, we should be very explicit about that and this is just passed through.
Summary
--localepersistent flag andlocaleconfig key to the CLIDR_LOCALEenvironment variable to all plugins when explicitly configureddrconfig.yaml,--localeflag, orDATAROBOT_CLI_LOCALEenv var), preserving each plugin's existing fallback behaviorMotivation
Currently, the
assistplugin implements its own locale detection independently. This makes it difficult for users to set a unified locale across plugins. By propagatingDR_LOCALEfrom the CLI config, users can configure locale once and have it apply to all plugins.How plugins can adopt this
Plugins should check
DR_LOCALEas the highest-priority locale source:agent-assist (Python):
DR_LOCALE>AGENT_ASSIST_LANG>config.yaml>"en"Configuration methods
Test plan
TestBuildPluginEnvLocale- verifies DR_LOCALE is set/unset correctly (4 patterns)TestBuildPluginEnvAlwaysSetsPluginMode- verifies DR_PLUGIN_MODE always presentTestBuildPluginEnvSetsPluginPath- verifies DR_PLUGIN_PATH set correctlytask lintpassesgo test ./internal/plugin/passes🤖 Generated with Claude Code
Note
Low Risk
Low risk: adds an optional
--locale/localeconfig value and forwards it asDR_LOCALEto plugin subprocesses, with docs/tests updates and minimal impact when unset.Overview
Adds a new global
--localeflag (andlocaleconfig key /DATAROBOT_CLI_LOCALEenv override via Viper) and propagates it to all plugin executions asDR_LOCALEwhen 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.