Logo Dust I18n

Dust I18n

Tổ chứcPhổ biến
dust-tt
dust-i18n

Giúp các chuỗi giao diện trong front và sparkle có thể dịch bằng Lingui. Dùng khi thêm hoặc chỉnh sửa văn bản hiển thị cho người dùng trong mã React thuộc `front/components`, `front/hooks` hoặc `front/lib`, trong các component thuộc `sparkle/src`, khi bọc chuỗi hiện có để dịch hoặc khi đánh giá thay đổi văn bản giao diện.

Add to TypingMind

Tổng quan

Nhà phát hànhdust-tt
Kho mãdust
Tên kỹ năngdust-i18n
Sao
1.5K
Bản fork
370
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được dust-tt công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Dust I18n trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/dust-tt/dust/tree/main/.claude/skills/dust-i18n
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dust-tt/dust.git /tmp/dust
mkdir -p .claude/skills
cp -r /tmp/dust/.claude/skills/dust-i18n .claude/skills/dust-i18n
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Dust I18n trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Dust I18n ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Dust I18n với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Translatable UI strings (Lingui)

The product UI is localised with Lingui. The English text is the message: there are no hand-written ids. The supported locales are SUPPORTED_LOCALES in front/types/locale.ts. Each source directory using Lingui has its own catalog per CATALOG_LOCALES entry, at front/locales/{locale}/<directory relative to front>/messages.po, holding the messages of the files directly in that directory (en-GB uses the en-US messages with British date and number formatting). Code imports front/locales/{locale}.catalog, which compiles to all of the locale's catalogs merged together.

A file that already uses Lingui MUST keep every user-visible string translated. New UI code SHOULD be written translated. After changing strings, follow Workflow and translate with the dust-translate skill in the same PR.

Which macro

Where the text isUseImport
JSX children<Trans>Save changes</Trans>import { Trans } from "@lingui/react/macro"
String props, toasts, aria-label, placeholderconst { t } = useLingui(); then t`Search agents` import { useLingui } from "@lingui/react/macro"
Module-level constants (labels maps, option lists)msg`Admin` at module level, t(LABELS[role]) at renderimport { msg } from "@lingui/core/macro"
Countst`${count} ${plural(count, { one: "agent", other: "agents" })}` or <Plural>@lingui/core/macro / @lingui/react/macro
Zod schema messagesgetXSchema(t) factory, see Zod schemasimport { msg } from "@lingui/core/macro"
Short ambiguous wordst({ message: "Open", context: "verb, button label" })

Rules:

  • One message per sentence. Inline markup stays inside one <Trans>: <Trans>Invite <strong>{name}</strong> to the <Link to={url}>workspace</Link>.</Trans>.
  • Interpolate with placeholders, never concatenate: t`Delete ${name}?` not "Delete " + name + "?".
  • Placeholders must be simple identifiers (${name}, not ${user.name}), so translators see a meaningful name: hoist expressions into a const first.
  • No pluralize(), (s) suffixes or ternaries between English words: use plural/select.
  • t from useLingui() only works inside components and hooks. Module-level code uses msg.
  • Translate descriptors with t(descriptor), not i18n._(descriptor): i18n keeps the same reference when the locale changes, so memos depending on it would not recompute.
  • Write English in sentence case. Do not apply CSS uppercase/capitalize to translated text.
  • Format dates and numbers with the active locale (i18n.locale), never a hardcoded "en-US".

Zod schemas

A schema with translated messages is a plain factory taking t. Write messages as t(msg`...`) (the t`...` shorthand only works inside components and hooks), and memoize at the call site so the schema is rebuilt only when the locale changes:

ts
export function getXFormSchema(t: (descriptor: MessageDescriptor) => string) {
  return z.object({ name: z.string().min(1, t(msg`Name is required.`)) });
}
export type XFormValues = z.infer<ReturnType<typeof getXFormSchema>>;

// In the component:
const { t } = useLingui();
const schema = useMemo(() => getXFormSchema(t), [t]);

Compose factories by passing t down (getParentSchema(t) calls getChildSchema(t)). Do not wrap a schema in a useXSchema() hook, and do not pass pre-translated message objects. Tests call the factory directly with (descriptor) => i18n._(descriptor).

Never translate

  • Text sent to models: front/lib/actions/**, MCP tool and server descriptions, skill and agent definitions, zod .describe().
  • Server code (front-api/**, front/lib/api/**, front/temporal/**): Lingui imports there fail lint (noClientImportsInServer). Servers return error codes; the UI translates them.
  • Poke (front/components/poke/**), logs, analytics event names, keyboard symbols (⌘, ↵), product and brand names on their own (Dust, Slack), user-generated content.

Where translated components can render

Lingui components need an I18nProvider. Every front-spa entry mounts one at its root (e.g. front-spa/src/app/App.tsx); the poke, share, oauth and email entries render in en-US. The browser extension (extension/) mounts one in each platform app and compiles the macros in its webpack build (extension/config/webpack_lingui.ts). It always renders en-US.

In front tests, render and renderHook from @testing-library/react already wrap the tree in an I18nProvider (see front/vite.i18nSetup.ts), around any wrapper the test passes, and the locale is reset to en-US after each test. Do not add an I18nProvider in tests. To assert a translation, activate the locale inside act:

tsx
import { i18n, loadCatalog } from "@app/lib/i18n/i18n";

const messages = await loadCatalog("fr-FR");
act(() => i18n.loadAndActivate({ locale: "fr-FR", messages }));
render(<MyComponent />);

Sparkle components

Sparkle (@dust-tt/sparkle) is translated with the same macros and rules, but has its own Lingui setup, independent of front's (contracts in sparkle/src/CONTRACTS):

  • sparkle/lingui.config.ts resolves the macros to sparkle's own useLingui and Trans (sparkle/src/lib/i18n/), which read sparkle's context, not the consumer's. Outside sparkle/src/lib/i18n/, never import useLingui, Trans, I18nProvider or i18n from @lingui/react or @lingui/core: they would read front's instance, which has no sparkle messages.
  • Sparkle has one catalog per locale, sparkle/src/locales/{locale}/messages.po, and stories (sparkle/src/stories/) are not extracted: do not translate them.
  • For text a consumer may override, make the prop optional with no default and fall back at render: {label ?? t`Load more`}. A destructuring default cannot call t.
  • The locale comes from SparkleI18nProvider. Without it, sparkle renders en-US (marketing, viz, the extension). Front mounts SparkleLocaleProvider (front/components/app/) at every app root that mounts UserLocaleSync, and front tests already wrap in it. Sparkle's locale is a catalog locale (en-GB renders as en-US).
  • SPARKLE_CATALOG_LOCALES (sparkle/src/lib/i18n/locales.ts) must contain every front CATALOG_LOCALES entry: adding a catalog locale to front means adding it to sparkle too.

Slack bot (connectors)

The Slack bot (connectors/src/connectors/slack) has its own catalog in connectors/locales/{locale}/messages.po, extracted by the same lingui.config.ts. Connectors runs under tsx, which cannot compile Lingui macros, so the rules differ from front:

  • Never import @lingui/*/macro. Write i18n._("Answered by *{agentName}*", { agentName }): the English text is the message id, and lingui extract only collects a string literal passed to a callee named i18n._.
  • i18n is the I18n of the recipient, from getSlackI18nForUser (or …ForUserId, …ForTeamUser) in connectors/src/connectors/slack/lib/user_locale.ts, passed down as a parameter. It resolves the locale chosen in Dust, then the Slack locale, then the workspace locale (en-US while the localisation flag is off). Never use the global i18n of @lingui/core: the bot answers users with different locales concurrently.
  • The locales are a copy of front/types/locale.ts in connectors/src/types/locale.ts: edit both (i18n:check fails when they differ).
  • Same never-translate rules as front: text sent to the Dust API or to models (content fragments, message content), logs, agent-authored content.

See connectors/src/connectors/slack/CONTRACTS.

Workflow

  1. Wrap the strings with the macros above.
  2. From the repository root (or sparkle/ for sparkle code), run npm run i18n:extract: it updates every catalog and removes obsolete messages.
  3. Fill the new empty msgstr entries with the dust-translate skill.
  4. Run npm run i18n:check from the same directory (also run in CI): it fails on stale catalogs and missing translations.
  5. Commit the code and the catalogs together.

Câu hỏi thường gặp

Kỹ năng AI Dust I18n làm được gì?

Giúp các chuỗi giao diện trong front và sparkle có thể dịch bằng Lingui. Dùng khi thêm hoặc chỉnh sửa văn bản hiển thị cho người dùng trong mã React thuộc `front/components`, `front/hooks` hoặc `front/lib`, trong các component thuộc `sparkle/src`, khi bọc chuỗi hiện có để dịch hoặc khi đánh giá thay đổi văn bản giao diện.

Vì sao nên dùng Dust I18n trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Dust I18n là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Dust I18n trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/dust-tt/dust/tree/main/.claude/skills/dust-i18n. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Dust I18n?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Dust I18n với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Dust I18n với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Dust I18n có miễn phí không?

Có. Kỹ năng này được dust-tt phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇