Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)75k · #3062

translation-strings

Skill này làm gì

Skill này kiểm tra cách văn bản được chuẩn bị để dịch trong một dự án phần mềm. Skill dành cho lập trình viên đang làm cho ứng dụng sẵn sàng cho nhiều ngôn ngữ.

Khi nào nên dùng

  • ✓Khi một dự án ghép văn bản và số lại với nhau để tạo câu đã dịch.
  • ✓Khi thiết lập một thư viện dịch cho một app mới.
  • ✓Khi chuẩn bị văn bản hiển thị cho người dùng trong mã nguồn để đưa sang một ngôn ngữ mới.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/translation-strings/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/translation-strings/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“App của tôi tạo câu trong mã như 'Found ' + count + ' results'. Làm sao để biến chúng thành văn bản có thể dịch?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent tìm các câu được ghép từ nhiều mảnh văn bản và thay bằng một thông điệp duy nhất có placeholder được đặt tên. Các dạng số nhiều sau đó được thư viện dịch xử lý.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Write internationalisation-friendly translation strings

Naive string concatenation produces untranslatable sentences because word order varies dramatically across languages. A pattern like "Found " + count + " results" cannot be translated correctly into languages where the number appears in a different position or where the noun form changes depending on the count. Bad i18n strings force translators to work around developer mistakes — or simply leave content untranslated.

Quick Reference

  • Never concatenate translated strings with variables — use named placeholders
  • Use ICU MessageFormat for pluralisation, gender, and select patterns
  • Keep translation keys descriptive and scoped to their feature context
  • Extract all user-visible strings — do not hardcode any copy in components

Check

Check whether translation strings use proper message formatting with placeholders rather than string concatenation.

Fix

Replace concatenated translation strings with ICU message format patterns and ensure pluralisation is handled via the library, not conditionals.

Explain

Explain why string concatenation breaks translations and how ICU MessageFormat handles variable word order, pluralisation, and gender.

Code Review

Review components and utility functions for hardcoded user-visible strings, string concatenation involving translated text, and missing plural forms.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/javascript/translation-strings

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

ICU MessageFormat là gì?

Đó là cách chuẩn để viết các thông điệp có thể dịch, bao gồm số, dạng số nhiều và giới tính.

Vì sao không ghép các mảnh văn bản lại với nhau?

Trật tự từ khác nhau giữa các ngôn ngữ, nên các mảnh ghép thường không thể dịch đúng.

Còn văn bản viết trực tiếp trong component thì sao?

Skill nói rằng mọi văn bản hiển thị cho người dùng nên được đưa ra các file dịch, thay vì viết thẳng trong component.

Chi tiết

Mô tả gốc của tác giả

Use when reviewing a codebase for internationalisation readiness, setting up an i18n library, or preparing strings for a new locale.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#3062
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự