mcpField
Q
qe-localization-testing

qe-localization-testing

github.com/proffesor-for-testing测试与质量51985 次安装今天更新
代码仓库

关于 qe-localization-testing

用于检查多语言软件国际化与本地化的测试技能,面向开发和测试团队。它通过清单和示例覆盖翻译、地区格式、从右向左布局、Unicode 及文化适切性。

主要功能

  1. 01翻译覆盖率检查
  2. 02地区化日期和数字格式
  3. 03从右向左布局验证
  4. 04Unicode 字符支持检查
  5. 05文化适切性审查

适用场景

  1. 01为产品进入新市场做准备
  2. 02添加语言支持
  3. 03检查国际版本发布
  4. 04验证不同地区的界面更改

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/proffesor-for-testing/agentic-qe --skill qe-localization-testing

安装后在 Claude Code 中输入/qe-localization-testing确认已加载。

详细介绍

本地化与国际化测试

<default_to_action> 测试多语言/地区支持时:

  1. 验证翻译覆盖率(所有字符串均已翻译)
  2. 测试地区特定格式(日期、时间、货币、数字)
  3. 验证 RTL 布局(阿拉伯语、希伯来语)
  4. 检查字符编码(UTF-8、Unicode)
  5. 确认文化适宜性(图标、颜色、内容)

i18n 快速检查清单:

  • 将所有面向用户的字符串外置
  • 代码中没有硬编码文本
  • 日期/时间/货币按地区格式显示
  • RTL 语言的布局正确翻转
  • Unicode 字符显示正常

关键成功因素:

  • 不要硬编码字符串——将所有内容外置
  • 与真实使用者测试,而不只是检查翻译文件
  • RTL 需要镜像翻转 UI 布局 </default_to_action>

快速参考卡

适用场景
  • 进入新市场
  • 添加语言支持
  • 国际版本发布前
  • UI 变更后
i18n 与 l10n
术语全称重点
i18n国际化为本地化构建
l10n本地化针对特定地区进行适配
常见地区格式
类型美国 (en-US)英国 (en-GB)日本 (ja-JP)
日期10/24/202524/10/20252025/10/24
货币$1,234.56£1,234.56¥1,235
数字1,234.561,234.561,234.56

翻译覆盖率测试

test('all strings are translated', () => {
  const enKeys = Object.keys(translations.en);
  const frKeys = Object.keys(translations.fr);
  const esKeys = Object.keys(translations.es);

  // All locales have same keys
  expect(frKeys).toEqual(enKeys);
  expect(esKeys).toEqual(enKeys);
});

test('no missing translation placeholders', async ({ page }) => {
  await page.goto('/?lang=fr');
  const text = await page.textContent('body');

  // Should not see placeholder keys
  expect(text).not.toContain('translation.missing');
  expect(text).not.toMatch(/\{\{.*\}\}/); // {{key}} format
});

日期/时间/货币格式

test('date formats by locale', () => {
  const date = new Date('2025-10-24');

  expect(formatDate(date, 'en-US')).toBe('10/24/2025');
  expect(formatDate(date, 'en-GB')).toBe('24/10/2025');
  expect(formatDate(date, 'ja-JP')).toBe('2025/10/24');
});

test('currency formats by locale', () => {
  const amount = 1234.56;

  expect(formatCurrency(amount, 'en-US', 'USD')).toBe('$1,234.56');
  expect(formatCurrency(amount, 'de-DE', 'EUR')).toBe('1.234,56 €');
  expect(formatCurrency(amount, 'ja-JP', 'JPY')).toBe('¥1,235');
});

RTL(从右到左)测试

test('layout flips for RTL languages', async ({ page }) => {
  await page.goto('/?lang=ar'); // Arabic

  const dir = await page.locator('html').getAttribute('dir');
  expect(dir).toBe('rtl');

  // Navigation should be on right
  const nav = await page.locator('nav');
  const styles = await nav.evaluate(el =>
    window.getComputedStyle(el)
  );
  expect(styles.direction).toBe('rtl');
});

test('icons/images appropriate for RTL', async ({ page }) => {
  await page.goto('/?lang=he'); // Hebrew

  // Back arrow should point right in RTL
  const backIcon = await page.locator('.back-icon');
  expect(await backIcon.getAttribute('class')).toContain('rtl-flipped');
});

Unicode 字符支持

test('supports unicode characters', async ({ page }) => {
  // Japanese
  await page.fill('#name', '山田太郎');
  await page.click('#submit');

  const saved = await db.users.findOne({ /* ... */ });
  expect(saved.name).toBe('山田太郎');

  // Arabic
  await page.fill('#name', 'محمد');
  // Emoji
  await page.fill('#bio', '👋🌍');

  expect(saved.bio).toBe('👋🌍');
});

Agent 驱动的本地化测试

// Comprehensive localization validation
await Task("Localization Testing", {
  url: 'https://example.com',
  locales: ['en-US', 'fr-FR', 'de-DE', 'ja-JP', 'ar-SA'],
  checks: ['translations', 'formats', 'rtl', 'unicode'],
  detectHardcodedStrings: true
}, "qe-test-generator");

// Returns:
// {
//   locales: 5,
//   missingTranslations: 3,
//   formatIssues: 1,
//   rtlIssues: 0,
//   hardcodedStrings: ['button.submit', 'header.title']
// }

Agent 协作提示

记忆命名空间
aqe/localization-testing/
├── translations/*       - Translation coverage
├── formats/*            - Locale-specific formats
├── rtl-validation/*     - RTL layout checks
└── unicode/*            - Character encoding tests
Fleet 协作
const l10nFleet = await FleetManager.coordinate({
  strategy: 'localization-testing',
  agents: [
    'qe-test-generator',   // Generate l10n tests
    'qe-test-executor',    // Execute across locales
    'qe-visual-tester'     // RTL visual validation
  ],
  topology: 'parallel'
});

相关技能


请牢记

不要硬编码。将所有面向用户的字符串外置。 用户可见的每个字符串都必须来自翻译文件,而不是代码。

与母语使用者测试,而不只是检查翻译文件。 机器翻译和翻译文件可能存在语境问题,只有母语使用者才能发现。

使用 Agent: Agent 可验证翻译覆盖率、检测硬编码字符串、测试地区特定格式,并在所有受支持语言中自动验证 RTL 布局。

评论

支持 Markdown