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

currency-formatting

Skill này làm gì

Skill này kiểm tra cách website hiển thị tiền, số và ngày cho người ở các nước khác nhau. Skill dành cho lập trình viên xây website phục vụ nhiều khu vực.

Khi nào nên dùng

  • ✓Khi giá của bạn hiện sai ký hiệu tiền hoặc dấu phân cách với một quốc gia.
  • ✓Khi ngày tháng hiện theo định dạng khiến người ở nước ngoài bối rối.
  • ✓Khi bạn thêm ngôn ngữ hoặc khu vực mới cho website.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/currency-formatting/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/currency-formatting/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

“Bạn có thể kiểm tra xem giá trên website của tôi có hiển thị đúng cho người ở nước khác không?”

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

Cách hoạt động

Agent tìm những chỗ số, giá hoặc ngày được viết tay. Sau đó gợi ý dùng công cụ định dạng có sẵn của trình duyệt với ngôn ngữ của người xem.

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.

Use Intl APIs for currency, number, and date formatting

Number and currency formatting rules differ significantly across locales — a value formatted as "$1,234.56" in the US is written "1.234,56 $" in Germany and "¥1,235" in Japan. Hardcoded formatting causes incorrect display for international users and is expensive to maintain manually as you add locales.

Quick Reference

  • Never hardcode currency symbols or thousand separators like $ or comma
  • Use Intl.NumberFormat with the currency style for monetary values
  • Use Intl.DateTimeFormat for locale-aware date and time display
  • Pass the user locale explicitly rather than relying on the browser default
  • Use Intl.Collator and locale fallback chains for sorting and searching

Check

Identify all places in this codebase where numbers, currencies, or dates are formatted manually instead of using Intl.NumberFormat or Intl.DateTimeFormat. Also flag locale-sensitive sorting that uses plain string comparison instead of Intl.Collator and any formatter that lacks a fallback locale.

Fix

Replace manual number and currency formatting with Intl.NumberFormat and replace manual date formatting with Intl.DateTimeFormat, passing the user locale explicitly. Use Intl.Collator for locale-aware sorting and resolve a supported fallback locale when the requested locale is unavailable.

Explain

Explain why locale-aware formatting with Intl APIs is required for international applications, what goes wrong when formatting is hardcoded, and why sorting/searching should also use locale-aware comparison.

Code Review

Review utility functions and components that render numbers, prices, percentages, or dates. Flag any hardcoded currency symbols, separators, or date format strings, and show Intl-based alternatives.


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

Rule page: https://frontendchecklist.io/rules/i18n/currency-formatting

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

Vì sao giá trông khác ở các nước?

Mỗi nước dùng ký hiệu tiền tệ, dấu thập phân và dấu phân cách khác nhau. Cùng một số tiền có thể được viết theo những cách khá khác nhau.

Skill dùng công cụ định dạng nào của trình duyệt?

Skill gợi ý dùng các công cụ Intl mà trình duyệt hiện đại có sẵn cho số, tiền tệ, ngày và sắp xếp.

Có nên đặt ngôn ngữ trong code không?

Skill khuyên truyền rõ locale của người dùng thay vì dựa vào mặc định của trình duyệt.

Chi tiết

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

Use when reviewing utility functions, component props, or template strings that format numbers, prices, or dates to check whether Intl APIs are used correctly.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2805
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ự