Chuyển đến nội dung
Skillpedia
Viết lách48k · #4917

i18n-localization

Skill này làm gì

Công cụ này giúp chuẩn bị ứng dụng để dịch sang các ngôn ngữ khác. Nó kiểm tra văn bản viết cứng trong mã cần được dịch và sắp xếp các file bản dịch.

Khi nào nên dùng

  • ✓Khi bạn muốn website hoặc ứng dụng được dùng ở các quốc gia khác.
  • ✓Khi bạn tạo một ứng dụng có thể cần bản dịch trong tương lai.
  • ✓Khi bạn cần sắp xếp bản dịch cho một ứng dụng đã có sẵn.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/i18n-localization/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/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/i18n-localization/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

“Kiểm tra mã của tôi xem có văn bản chưa được dịch không, và giúp tôi sắp xếp chúng vào các file bản dịch.”

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

Cách hoạt động

Công cụ tìm văn bản được viết trực tiếp trong mã, lẽ ra phải nằm trong các file riêng. Nó gợi ý cách sắp xếp để việc dịch dễ dàng hơn.

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.

i18n & Localization

Internationalization (i18n) and Localization (L10n) best practices.


1. Core Concepts

Term Meaning
i18n Internationalization - making app translatable
L10n Localization - actual translations
Locale Language + Region (en-US, tr-TR)
RTL Right-to-left languages (Arabic, Hebrew)

2. When to Use i18n

Project Type i18n Needed?
Public web app ✅ Yes
SaaS product ✅ Yes
Internal tool ⚠️ Maybe
Single-region app ⚠️ Consider future
Personal project ❌ Optional

3. Implementation Patterns

React (react-i18next)

import { useTranslation } from 'react-i18next';

function Welcome() {
  const { t } = useTranslation();
  return <h1>{t('welcome.title')}</h1>;
}

Next.js (next-intl)

import { useTranslations } from 'next-intl';

export default function Page() {
  const t = useTranslations('Home');
  return <h1>{t('title')}</h1>;
}

Python (gettext)

from gettext import gettext as _

print(_("Welcome to our app"))

4. File Structure

locales/
├── en/
│   ├── common.json
│   ├── auth.json
│   └── errors.json
├── tr/
│   ├── common.json
│   ├── auth.json
│   └── errors.json
└── ar/          # RTL
    └── ...

5. Best Practices

DO ✅

  • Use translation keys, not raw text
  • Namespace translations by feature
  • Support pluralization
  • Handle date/number formats per locale
  • Plan for RTL from the start
  • Use ICU message format for complex strings

DON'T ❌

  • Hardcode strings in components
  • Concatenate translated strings
  • Assume text length (German is 30% longer)
  • Forget about RTL layout
  • Mix languages in same file

6. Common Issues

Issue Solution
Missing translation Fallback to default language
Hardcoded strings Use linter/checker script
Date format Use Intl.DateTimeFormat
Number format Use Intl.NumberFormat
Pluralization Use ICU message format

7. RTL Support

/* CSS Logical Properties */
.container {
  margin-inline-start: 1rem;  /* Not margin-left */
  padding-inline-end: 1rem;   /* Not padding-right */
}

[dir="rtl"] .icon {
  transform: scaleX(-1);
}

8. Checklist

Before shipping:

  • All user-facing strings use translation keys
  • Locale files exist for all supported languages
  • Date/number formatting uses Intl API
  • RTL layout tested (if applicable)
  • Fallback language configured
  • No hardcoded strings in components

Script

Script Purpose Command
scripts/i18n_checker.py Detect hardcoded strings & missing translations python scripts/i18n_checker.py <project_path>

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Câu hỏi thường gặp

“i18n” và “L10n” là gì?

“i18n” (Internationalization) là việc chuẩn bị ứng dụng để có thể dịch. “L10n” (Localization) là quá trình dịch thực tế và điều chỉnh cho phù hợp với từng khu vực.

“Locale” là gì?

Đó là sự kết hợp giữa ngôn ngữ và khu vực, ví dụ “en-US” cho tiếng Anh Mỹ hoặc “pt-BR” cho tiếng Bồ Đào Nha ở Brazil.

Tại sao không nên viết văn bản trực tiếp trong mã?

Viết văn bản trực tiếp khiến việc dịch trở nên khó khăn. Dùng khóa dịch trong các file riêng giúp quản lý và cập nhật bản dịch dễ dàng mà không phải sửa mã chính.

Chi tiết

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

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4917
Giấy phép
MIT
Cập nhật
15/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ự