@eigenpal/docx-editor-i18n

中文文档
1.9.0发布于 2026/06/21Apache-2.0TypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 20.5万

Shared UI locale strings and types for the @eigenpal docx-editor adapters (React and Vue).

此软件包已被标记为弃用

deprecated

原始使用文档
文档目录8 节
  1. Quick Start
  2. Packages
  3. Available locales
  4. Per-locale subpaths
  5. Types
  6. Non-React/Vue hosts
  7. Contributing
  8. Commercial Support

DOCX Editor — .docx in, .docx out. Open source, agent ready, client-side.

npm version npm downloads license Demo Documentation

@eigenpal/docx-editor-i18n

Shared locale strings, types, and runtime helpers for the docx-editor adapters. One source of truth for translations consumed by @eigenpal/docx-editor-react and @eigenpal/docx-editor-vue.

Quick Start

npm install @eigenpal/docx-editor-i18n

Pass a typed locale to the editor's i18n prop:

// React
import { de } from '@eigenpal/docx-editor-i18n';
<DocxEditor documentBuffer={file} i18n={de} />

// Vue
import { de } from '@eigenpal/docx-editor-i18n';
<DocxEditor :document-buffer="file" :i18n="de" />

Mix a community locale with custom overrides:

import { de } from '@eigenpal/docx-editor-i18n';

const myLocale = {
  ...de,
  toolbar: { ...de.toolbar, bold: 'Fettdruck' },
};

Keys set to null in any locale fall back to English.

Packages

PackageDescription
@eigenpal/docx-editor-react   React adapter. Toolbar, paged editor, plugins.
@eigenpal/docx-editor-vue   Vue 3 adapter. Toolbar, paged editor, plugins.
@eigenpal/docx-editor-coreFramework-agnostic core: OOXML parser, serializer, layout engine, ProseMirror schema. Depend on this if you fork the React or Vue adapter.
@eigenpal/docx-editor-i18nShared locale strings and types consumed by both adapters.
@eigenpal/docx-editor-agentsAgent SDK and chat UI: framework-agnostic bridge, MCP server, AI SDK adapters, plus React UI.

Forking the adapter? Keep your fork thin. Depend on @eigenpal/docx-editor-core directly so parser, serializer, and rendering fixes land in your build automatically, without backporting each upstream change by hand.

Available locales

CodeExportLanguage
enenEnglish (source)
dedeGerman
heheHebrew
plplPolish
pt-BRptBRPortuguese (Brazil)
trtrTurkish
zh-CNzhCNSimplified Chinese

BCP-47 codes (pt-BR, zh-CN) use camelCase JS identifiers (ptBR, zhCN). For runtime lookup by tag:

import { locales } from '@eigenpal/docx-editor-i18n';
<DocxEditor i18n={locales[userPreferredLocale]} />

Importing locales pulls every locale into your bundle. For a smaller bundle, import only the ones you need by name; sideEffects: false lets the rest tree-shake.

Per-locale subpaths

For apps that pick the locale at runtime, the named exports above don't tree-shake — the bundler can't know which locale wins, so it ships them all. Use the per-locale subpaths instead. Each one bundles a single locale (~30KB) and code-splits cleanly:

// Static — bundler ships only this locale's strings
import pl from '@eigenpal/docx-editor-i18n/pl';

// Dynamic — splits into its own chunk, loaded on demand
const pl = (await import('@eigenpal/docx-editor-i18n/pl')).default;

Subpaths ship for every locale: /en, /de, /he, /pl, /pt-BR, /tr, /zh-CN. Each also exports its locale as a named binding (import { pl } from '@eigenpal/docx-editor-i18n/pl') for callers that prefer non-default imports.

Types

import type {
  LocaleStrings, // shape of `en`, the full source of truth
  PartialLocaleStrings, // shape of a community partial (null falls back)
  Translations, // alias for PartialLocaleStrings
  TranslationKey, // 'toolbar.bold' | 'dialogs.findReplace.title' | ...
  LocaleCode, // 'en' | 'de' | 'pt-BR' | ...
  TFunction, // signature of the `t()` callback
} from '@eigenpal/docx-editor-i18n';

Non-React/Vue hosts

Build a typed t() outside the adapter packages:

import { createT, deepMerge, en, de, type LocaleStrings } from '@eigenpal/docx-editor-i18n';

const merged = deepMerge(en, de) as LocaleStrings;
const t = createT(merged, 'de');
t('toolbar.bold'); // 'Fett'
t('dialogs.findReplace.matchCount', { current: 3, total: 15 }); // ICU plurals

en.json is the source of truth. Add keys there, then run bun run i18n:fix from the repo root to sync community locales (new keys land as null). Full guide: docs/i18n.md.

Contributing

Contributions welcome. See CONTRIBUTING.md for setup, tests, and the one-time CLA signature.

Commercial Support

[!TIP] Questions or custom features? Email [email protected].

版本与发布记录

@eigenpal/docx-editor-i18n 共发布 23 个版本,首次发布于 2026/05/19;过去 12 个月发布了 23 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.9.0latest2026/06/214 个月前
1.8.32026/06/204 个月前
1.8.22026/06/194 个月前
1.8.12026/06/194 个月前
1.8.02026/06/194 个月前
1.7.02026/06/184 个月前

关于 @eigenpal/docx-editor-i18n 的常见问题

@eigenpal/docx-editor-i18n 是什么?

Shared UI locale strings and types for the @eigenpal docx-editor adapters (React and Vue).注意:该包已被作者标记为弃用——deprecated

如何安装 @eigenpal/docx-editor-i18n?

在项目目录运行 npm install @eigenpal/docx-editor-i18n,或使用 pnpm add / yarn add / bun add。

@eigenpal/docx-editor-i18n 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eigenpal/docx-editor-i18n 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@eigenpal/docx-editor-i18n 可以商用吗?

@eigenpal/docx-editor-i18n 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@eigenpal/docx-editor-i18n 的下载量有多少?

根据 npm 官方下载统计,@eigenpal/docx-editor-i18n 在 2026/10/13 – 2026/11/11 这 30 天内被下载 204,838 次,日均约 6,828 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eigenpal/docx-editor-i18n 还在维护吗?

最新版本 1.9.0 发布于 2026/06/21(4 个月前);至今共发布 23 个版本,其中过去 12 个月发布了 23 个;首次发布于 2026/05/19。作者已将其标记为弃用,新项目建议寻找替代方案。