- getStrings().copied now returns template key "Copied %1 to clipboard" (interpolation at QML call site via .arg) - Removed unused clearExitNode/setExitNode from getStrings (were dead code) - Tests updated for new shape while preserving coverage - New tailscalectl/i18n/ with README + en.json for future-proofing (per dms-plugin-dev best practice) - Exact behavior preserved; no logic changes Written by AI agent working for @jtmorris. Model: grok-build-0.1.
1.8 KiB
1.8 KiB
I18n for tailscalectl
This plugin is fully instrumented with I18n.tr(...) (from qs.Common) for all user-facing strings.
- Source keys are the American English strings defined in
lib.js(returned bygetStrings(), plus bases fromerrorMessage()/formatError()). - Call sites in
TailscaleWidget.qmlwrap them:I18n.tr(TailscaleLib.getStrings().foo)orI18n.tr(TailscaleLib.getStrings().copied).arg(text). - Today: falls back to the key (perfect en-US).
- Future: Drop additional
xx.jsonhere (or contribute keys to DMS core translations) when a loader or extraction process supports per-plugin locales.
Current keys (source of truth)
See getStrings() and errorMessage() in lib.js for the canonical list.
Example en.json (for documentation / future tools):
{
"Tailscale": "Tailscale",
"Connected": "Connected",
"Disconnected": "Disconnected",
"Exit node: ": "Exit node: ",
"None": "None",
"Copied %1 to clipboard": "Copied %1 to clipboard",
"Invalid exit node hostname": "Invalid exit node hostname",
"Failed to connect to Tailscale": "Failed to connect to Tailscale",
"Failed to disconnect from Tailscale": "Failed to disconnect from Tailscale",
"Failed to set exit node": "Failed to set exit node",
"Failed to read Tailscale status": "Failed to read Tailscale status",
"Error copying to clipboard": "Error copying to clipboard",
"Tailscale command failed": "Tailscale command failed"
}
Notes
- Symbols/glyphs ("×", "↗", "—") are intentionally left as literals in the UI (not run through I18n as they are not linguistic content).
- Plugin name/description in
plugin.jsonand technical IDs ("tailscalectl") remain English. - This follows DMS
dms-plugin-devbest practice for future-proofing even when only en is shipped.
Written by AI agent working for @jtmorris. Model: grok-build-0.1.