mcpField
L
localization-testing

localization-testing

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

关于 localization-testing

用于测试多语言和国际化支持的技能,涵盖翻译覆盖率、区域格式、从右向左布局、Unicode 和浏览器视觉检查。

主要功能

  1. 01检查翻译覆盖率
  2. 02验证区域格式
  3. 03测试从右向左布局
  4. 04验证 Unicode 处理
  5. 05比较浏览器截图

适用场景

  1. 01为产品进入新市场做准备
  2. 02发布前测试语言支持
  3. 03界面变更后检查区域行为

安装

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

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

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

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

evals/
localization-testing.yaml
schemas/
output.json
scripts/
validate-config.json

详细介绍

本地化与国际化测试

浏览器引擎

由浏览器驱动的区域设置检查(RTL 布局差异、语言切换流程、特定区域设置的屏幕截图)应使用 qe-browser fleet 技能。例如:

vibium go "$BASE_URL?lang=ar"  # Arabic, RTL
vibium wait load
node .claude/skills/qe-browser/scripts/visual-diff.js --name homepage-ar-rtl
vibium go "$BASE_URL?lang=ja"  # Japanese, CJK text expansion
node .claude/skills/qe-browser/scripts/visual-diff.js --name homepage-ja

完整参考请参阅 .claude/skills/qe-browser/SKILL.md。

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

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

i18n 快速检查清单:

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

成功关键因素:

  • 不要硬编码字符串——将所有字符串外置
  • 使用母语人士进行测试,而不只是检查翻译文件
  • RTL 需要镜像翻转 UI 布局 </default_to_action>

快速参考卡

适用场景
  • 进入新市场
  • 添加语言支持
  • 国际版发布前
  • UI 更改后

翻译覆盖率测试

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