i18n-usage

star 348

Code examples and patterns for using i18n translations in sfdx-hardis source code (uxLog, uxLogTable, prompts, markers). Use when adding or modifying user-visible strings.

hardisgroupcom By hardisgroupcom schedule Updated 5/10/2026

name: i18n-usage description: Code examples and patterns for using i18n translations in sfdx-hardis source code (uxLog, uxLogTable, prompts, markers). Use when adding or modifying user-visible strings. user-invocable: false

i18n Usage Patterns

Import

import { t } from "../../../common/utils/i18n.js";

uxLog

For picking the right level (action, log, warning, error, success, other) and its matching chalk color, see the uxlog-usage skill.

// Correct
uxLog("action", this, c.cyan(t("deployingMetadata", { metadata: name })));

// Wrong - hardcoded English string
uxLog("action", this, c.cyan(`Deploying metadata ${name}...`));

uxLogTable

import { uxLogTable } from "../../../common/utils/index.js";

uxLogTable(
  this,
  [{ name: "My Flow", type: "Flow", status: "Active" }],
  [
    { key: "name", label: t("name") },
    { key: "type", label: t("type") },
    { key: "status", label: t("status") },
  ]
);

prompts()

const res = await prompts({
  type: "select",
  name: "value",
  message: t("selectEnvironment"),
  description: t("selectEnvironmentDescription"),
  choices: [
    { title: t("choiceProduction"), value: "prod" },
    { title: t("choiceSandbox"), value: "sandbox" },
  ],
});

sendReportFileMessage

WebSocketClient.sendReportFileMessage(url, t("slackIntegration"), "docUrl");

sendProgressStartMessage

WebSocketClient.sendProgressStartMessage(t("collectingData"), items.length);

Markdown Table Headers

Translate column names individually, not the whole header:

const header = `| ${t("name")} | ${t("type")} | ${t("description")} |`;

Markers

Do NOT translate [] markers. Keep them as hardcoded literals and concatenate:

uxLog("action", this, c.cyan("[MyMarker] " + t("someMessage")));
Install via CLI
npx skills add https://github.com/hardisgroupcom/sfdx-hardis --skill i18n-usage
Repository Details
star Stars 348
call_split Forks 97
navigation Branch main
article Path SKILL.md
More from Creator
hardisgroupcom
hardisgroupcom Explore all skills →