docs: dịch 22 file Markdown còn lại sang tiếng Việt có dấu (TEC-2881)
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 18s
CI / E2E Tests (push) Has been skipped
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 2m15s
Deploy / Build API Image (push) Failing after 28s
Deploy / Build Web Image (push) Failing after 16s
Deploy / Build AI Services Image (push) Failing after 17s
E2E Tests / Playwright E2E (push) Failing after 31s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 3s
Security Scanning / Trivy Scan — API Image (push) Failing after 1m46s
Security Scanning / Trivy Scan — Web Image (push) Failing after 1m7s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 53s
Security Scanning / Trivy Filesystem Scan (push) Failing after 35s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Security Scanning / Security Gate (push) Failing after 0s
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 18s
CI / E2E Tests (push) Has been skipped
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 2m15s
Deploy / Build API Image (push) Failing after 28s
Deploy / Build Web Image (push) Failing after 16s
Deploy / Build AI Services Image (push) Failing after 17s
E2E Tests / Playwright E2E (push) Failing after 31s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 3s
Security Scanning / Trivy Scan — API Image (push) Failing after 1m46s
Security Scanning / Trivy Scan — Web Image (push) Failing after 1m7s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 53s
Security Scanning / Trivy Filesystem Scan (push) Failing after 35s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Security Scanning / Security Gate (push) Failing after 0s
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
Hoàn tất đợt cuối của nhiệm vụ chuyển toàn bộ tài liệu sang tiếng Việt. Đã dịch 22 file `.md` còn sót (~9.7k dòng) — gồm RUNBOOK, audits, docs/architecture, docs/load-testing, libs READMEs và các quick references. Giữ nguyên code blocks, đường dẫn, identifier kỹ thuật, URL và biến môi trường. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
# GoodGo Frontend: i18n + A11y Implementation Quick Reference
|
||||
# GoodGo Frontend: Tham chiếu nhanh triển khai i18n + A11y
|
||||
|
||||
## 🎯 Key Findings at a Glance
|
||||
## 🎯 Những phát hiện chính trong nháy mắt
|
||||
|
||||
### Current State
|
||||
- ✅ **Next.js 15** with App Router (well-structured)
|
||||
- ✅ **React 18** + TypeScript (type-safe)
|
||||
- ✅ **Tailwind CSS** with dark mode support (HSL-based theme)
|
||||
- ✅ **Good component library** (~35 components)
|
||||
- ✅ **Some A11y basics** in place (semantic HTML, ARIA labels, skip link)
|
||||
- ❌ **NO i18n setup** (everything hardcoded Vietnamese)
|
||||
- ❌ **A11y gaps** (focus management, some ARIA missing, color contrast TBD)
|
||||
### Trạng thái hiện tại
|
||||
- ✅ **Next.js 15** với App Router (cấu trúc tốt)
|
||||
- ✅ **React 18** + TypeScript (an toàn kiểu)
|
||||
- ✅ **Tailwind CSS** với hỗ trợ dark mode (theme dựa trên HSL)
|
||||
- ✅ **Thư viện component tốt** (~35 component)
|
||||
- ✅ **Một số kiến thức cơ bản về A11y** đã có (HTML ngữ nghĩa, ARIA labels, skip link)
|
||||
- ❌ **CHƯA thiết lập i18n** (tất cả tiếng Việt được hardcode)
|
||||
- ❌ **Thiếu sót A11y** (quản lý focus, một số ARIA còn thiếu, tương phản màu chưa xác định)
|
||||
|
||||
### Strategic Entry Points for Implementation
|
||||
### Điểm vào chiến lược cho việc triển khai
|
||||
|
||||
#### 1. **i18n Entry Points** (Priority 1)
|
||||
#### 1. **Điểm vào i18n** (Ưu tiên 1)
|
||||
```
|
||||
Files to modify for i18n:
|
||||
├── app/layout.tsx → Add i18n provider
|
||||
@@ -29,7 +29,7 @@ Files to modify for i18n:
|
||||
Total files to update: ~25-30 files with hardcoded strings
|
||||
```
|
||||
|
||||
#### 2. **A11y Critical Fixes** (Priority 1.5)
|
||||
#### 2. **Sửa lỗi A11y quan trọng** (Ưu tiên 1.5)
|
||||
```
|
||||
Components needing A11y updates:
|
||||
├── components/ui/dialog.tsx → Focus trapping + focus restoration
|
||||
@@ -46,7 +46,7 @@ Tasks:
|
||||
- Link form errors to inputs with aria-describedby
|
||||
```
|
||||
|
||||
#### 3. **Message File Structure for i18n**
|
||||
#### 3. **Cấu trúc file Message cho i18n**
|
||||
```
|
||||
public/locales/
|
||||
├── en.json
|
||||
@@ -64,142 +64,142 @@ public/locales/
|
||||
|
||||
---
|
||||
|
||||
## 📋 Implementation Checklist
|
||||
## 📋 Checklist triển khai
|
||||
|
||||
### Phase 1: Setup (2-3 hours)
|
||||
- [ ] Install `next-intl` package
|
||||
- [ ] Create message files (en.json, vi.json)
|
||||
- [ ] Update next.config.js for i18n routing
|
||||
- [ ] Create i18n config (config.ts)
|
||||
- [ ] Update middleware.ts for locale detection
|
||||
- [ ] Wrap root layout with i18n provider
|
||||
### Giai đoạn 1: Thiết lập (2-3 giờ)
|
||||
- [ ] Cài đặt gói `next-intl`
|
||||
- [ ] Tạo các file message (en.json, vi.json)
|
||||
- [ ] Cập nhật next.config.js cho routing i18n
|
||||
- [ ] Tạo cấu hình i18n (config.ts)
|
||||
- [ ] Cập nhật middleware.ts để phát hiện locale
|
||||
- [ ] Bao bọc root layout bằng provider i18n
|
||||
|
||||
### Phase 2: Core Refactoring (6-8 hours)
|
||||
- [ ] Update root layout & metadata
|
||||
- [ ] Refactor all validations (Zod) to use messages
|
||||
- [ ] Extract component strings to useTranslations()
|
||||
- [ ] Update all enums (TRANSACTION_TYPES, PROPERTY_TYPES, etc.) to use i18n
|
||||
- [ ] Update page layouts (public, auth, dashboard)
|
||||
- [ ] Update all page content
|
||||
### Giai đoạn 2: Tái cấu trúc cốt lõi (6-8 giờ)
|
||||
- [ ] Cập nhật root layout & metadata
|
||||
- [ ] Tái cấu trúc tất cả validation (Zod) để sử dụng messages
|
||||
- [ ] Trích xuất chuỗi component sang useTranslations()
|
||||
- [ ] Cập nhật tất cả các enum (TRANSACTION_TYPES, PROPERTY_TYPES, v.v.) để sử dụng i18n
|
||||
- [ ] Cập nhật các page layout (public, auth, dashboard)
|
||||
- [ ] Cập nhật toàn bộ nội dung trang
|
||||
|
||||
### Phase 3: Component Updates (4-6 hours)
|
||||
- [ ] Update all UI components
|
||||
- [ ] Update form components
|
||||
- [ ] Update navigation components
|
||||
- [ ] Update search/filter components
|
||||
- [ ] Update listing form
|
||||
### Giai đoạn 3: Cập nhật component (4-6 giờ)
|
||||
- [ ] Cập nhật tất cả các component UI
|
||||
- [ ] Cập nhật các component form
|
||||
- [ ] Cập nhật các component navigation
|
||||
- [ ] Cập nhật các component search/filter
|
||||
- [ ] Cập nhật form đăng tin (listing form)
|
||||
|
||||
### Phase 4: A11y Fixes (4-6 hours)
|
||||
- [ ] Fix focus management in dialogs
|
||||
- [ ] Add focus trapping
|
||||
- [ ] Update form error linking (aria-describedby)
|
||||
- [ ] Add aria-busy to loading states
|
||||
- [ ] Add aria-labels to icon buttons
|
||||
- [ ] Verify color contrast
|
||||
- [ ] Update test setup for i18n
|
||||
### Giai đoạn 4: Sửa lỗi A11y (4-6 giờ)
|
||||
- [ ] Sửa quản lý focus trong dialog
|
||||
- [ ] Thêm focus trapping
|
||||
- [ ] Cập nhật liên kết lỗi form (aria-describedby)
|
||||
- [ ] Thêm aria-busy cho trạng thái loading
|
||||
- [ ] Thêm aria-label cho các nút biểu tượng
|
||||
- [ ] Xác minh tương phản màu
|
||||
- [ ] Cập nhật thiết lập test cho i18n
|
||||
|
||||
### Phase 5: Testing & QA (3-4 hours)
|
||||
- [ ] Test both locales on all pages
|
||||
- [ ] Run axe DevTools accessibility audit
|
||||
- [ ] Test keyboard navigation
|
||||
- [ ] Test screen reader compatibility
|
||||
- [ ] Update unit tests for i18n
|
||||
### Giai đoạn 5: Test & QA (3-4 giờ)
|
||||
- [ ] Test cả hai locale trên tất cả các trang
|
||||
- [ ] Chạy kiểm tra khả năng tiếp cận bằng axe DevTools
|
||||
- [ ] Test điều hướng bằng bàn phím
|
||||
- [ ] Test tương thích screen reader
|
||||
- [ ] Cập nhật unit test cho i18n
|
||||
|
||||
---
|
||||
|
||||
## 🗣️ Text Content Inventory
|
||||
## 🗣️ Kiểm kê nội dung văn bản
|
||||
|
||||
### Navigation & Layout (~15 items)
|
||||
| Location | Text | Status |
|
||||
### Navigation & Layout (~15 mục)
|
||||
| Vị trí | Văn bản | Trạng thái |
|
||||
|----------|------|--------|
|
||||
| Public header | Trang chủ, Tìm kiếm, Đăng nhập, Đăng ký | ❌ Hardcoded |
|
||||
| Dashboard nav | 8 nav items | ❌ Hardcoded |
|
||||
| Footer | 4 sections | ❌ Hardcoded |
|
||||
| Dashboard nav | 8 mục nav | ❌ Hardcoded |
|
||||
| Footer | 4 phần | ❌ Hardcoded |
|
||||
|
||||
### Forms & Validation (~40+ items)
|
||||
| Location | Type | Count | Status |
|
||||
### Forms & Validation (~40+ mục)
|
||||
| Vị trí | Loại | Số lượng | Trạng thái |
|
||||
|----------|------|-------|--------|
|
||||
| Login form | Labels + errors | 8 | ❌ Hardcoded |
|
||||
| Register form | Labels + errors | 10 | ❌ Hardcoded |
|
||||
| Listing form | Multi-step labels | 25+ | ❌ Hardcoded |
|
||||
| Search filters | Option labels | 30+ | ❌ Hardcoded |
|
||||
| Zod validation | Error messages | 20+ | ❌ Hardcoded |
|
||||
| Login form | Nhãn + lỗi | 8 | ❌ Hardcoded |
|
||||
| Register form | Nhãn + lỗi | 10 | ❌ Hardcoded |
|
||||
| Listing form | Nhãn đa bước | 25+ | ❌ Hardcoded |
|
||||
| Search filters | Nhãn tùy chọn | 30+ | ❌ Hardcoded |
|
||||
| Zod validation | Thông báo lỗi | 20+ | ❌ Hardcoded |
|
||||
|
||||
### Enums & Constants (~50+ items)
|
||||
| File | Items | Status |
|
||||
### Enum & Hằng số (~50+ mục)
|
||||
| File | Mục | Trạng thái |
|
||||
|------|-------|--------|
|
||||
| TRANSACTION_TYPES | 2 labels | ❌ Hardcoded |
|
||||
| PROPERTY_TYPES | 6 labels | ❌ Hardcoded |
|
||||
| LISTING_STATUSES | 8 labels | ❌ Hardcoded |
|
||||
| DIRECTIONS | 8 labels | ❌ Hardcoded |
|
||||
| CITIES | 13 names | ❌ Hardcoded |
|
||||
| PRICE_RANGES | 6 ranges | ❌ Hardcoded |
|
||||
| TRANSACTION_TYPES | 2 nhãn | ❌ Hardcoded |
|
||||
| PROPERTY_TYPES | 6 nhãn | ❌ Hardcoded |
|
||||
| LISTING_STATUSES | 8 nhãn | ❌ Hardcoded |
|
||||
| DIRECTIONS | 8 nhãn | ❌ Hardcoded |
|
||||
| CITIES | 13 tên | ❌ Hardcoded |
|
||||
| PRICE_RANGES | 6 khoảng | ❌ Hardcoded |
|
||||
|
||||
### Page Content (~30 items)
|
||||
| Page | Sections | Status |
|
||||
### Nội dung trang (~30 mục)
|
||||
| Trang | Phần | Trạng thái |
|
||||
|------|----------|--------|
|
||||
| Landing page | Hero, search, stats, CTA | ❌ Hardcoded |
|
||||
| Search results | No results, loading, headers | ❌ Hardcoded |
|
||||
| Dashboard | Section titles, empty states | ❌ Hardcoded |
|
||||
| Trang landing | Hero, search, stats, CTA | ❌ Hardcoded |
|
||||
| Kết quả tìm kiếm | Không có kết quả, loading, header | ❌ Hardcoded |
|
||||
| Dashboard | Tiêu đề phần, trạng thái rỗng | ❌ Hardcoded |
|
||||
|
||||
---
|
||||
|
||||
## 🔑 Critical Files for i18n
|
||||
## 🔑 Các file quan trọng cho i18n
|
||||
|
||||
### Must-Update Files (Blockers)
|
||||
1. **middleware.ts** — Locale routing
|
||||
2. **app/layout.tsx** — i18n provider setup
|
||||
3. **lib/validations/*.ts** — Message integration
|
||||
4. **lib/*.ts** — Any API error message handling
|
||||
### Các file phải cập nhật (Blocker)
|
||||
1. **middleware.ts** — Định tuyến locale
|
||||
2. **app/layout.tsx** — Thiết lập provider i18n
|
||||
3. **lib/validations/*.ts** — Tích hợp messages
|
||||
4. **lib/*.ts** — Bất kỳ xử lý thông báo lỗi API nào
|
||||
|
||||
### High-Priority Files
|
||||
### Các file ưu tiên cao
|
||||
1. **app/(public)/layout.tsx** — Navigation
|
||||
2. **app/(auth)/login/page.tsx** — Auth forms
|
||||
2. **app/(auth)/login/page.tsx** — Form xác thực
|
||||
3. **components/listings/listing-form-steps.tsx** — Forms
|
||||
4. **components/search/filter-bar.tsx** — Filters
|
||||
4. **components/search/filter-bar.tsx** — Bộ lọc
|
||||
|
||||
### Medium-Priority Files
|
||||
1. All page components
|
||||
2. All UI components with text
|
||||
3. Error boundary components
|
||||
### Các file ưu tiên trung bình
|
||||
1. Tất cả các component trang
|
||||
2. Tất cả các component UI có văn bản
|
||||
3. Các component error boundary
|
||||
|
||||
---
|
||||
|
||||
## ♿ A11y Implementation Priority
|
||||
## ♿ Ưu tiên triển khai A11y
|
||||
|
||||
### WCAG 2.1 AA Critical Fixes
|
||||
1. **Focus Management** (Level A)
|
||||
- Add focus trap in `dialog.tsx`
|
||||
- Restore focus on dialog close
|
||||
- Visible focus indicator on all buttons
|
||||
### Sửa lỗi quan trọng WCAG 2.1 AA
|
||||
1. **Quản lý focus** (Cấp A)
|
||||
- Thêm focus trap trong `dialog.tsx`
|
||||
- Khôi phục focus khi đóng dialog
|
||||
- Chỉ báo focus rõ ràng trên tất cả các nút
|
||||
|
||||
2. **Color Contrast** (Level AA)
|
||||
- Run axe DevTools audit
|
||||
- Fix any < 4.5:1 ratio text
|
||||
- Fix < 3:1 ratio graphics
|
||||
2. **Tương phản màu** (Cấp AA)
|
||||
- Chạy kiểm tra axe DevTools
|
||||
- Sửa văn bản có tỷ lệ < 4.5:1
|
||||
- Sửa đồ họa có tỷ lệ < 3:1
|
||||
|
||||
3. **Form Accessibility** (Level A)
|
||||
- Link all error messages with aria-describedby
|
||||
- Proper labeling with htmlFor
|
||||
- Fieldset grouping for complex forms
|
||||
3. **Khả năng tiếp cận form** (Cấp A)
|
||||
- Liên kết tất cả thông báo lỗi với aria-describedby
|
||||
- Gắn nhãn đúng cách với htmlFor
|
||||
- Nhóm fieldset cho các form phức tạp
|
||||
|
||||
4. **Loading States** (Level A)
|
||||
- Add aria-busy to spinners
|
||||
- Add aria-label with context
|
||||
4. **Trạng thái Loading** (Cấp A)
|
||||
- Thêm aria-busy cho spinner
|
||||
- Thêm aria-label kèm ngữ cảnh
|
||||
|
||||
5. **Icon Buttons** (Level A)
|
||||
- All icon-only buttons need aria-label
|
||||
- Theme toggle button already has label ✓
|
||||
5. **Nút biểu tượng** (Cấp A)
|
||||
- Tất cả các nút chỉ có biểu tượng cần aria-label
|
||||
- Nút bật/tắt theme đã có nhãn ✓
|
||||
|
||||
### Nice-to-Have A11y Enhancements
|
||||
- Skip link already present ✓
|
||||
- Semantic HTML already used ✓
|
||||
- Role="alert" on errors ✓
|
||||
- aria-invalid on form fields ✓
|
||||
### Các cải tiến A11y nên có
|
||||
- Skip link đã có sẵn ✓
|
||||
- HTML ngữ nghĩa đã được sử dụng ✓
|
||||
- Role="alert" trên lỗi ✓
|
||||
- aria-invalid trên các trường form ✓
|
||||
|
||||
---
|
||||
|
||||
## 📦 Dependencies to Add
|
||||
## 📦 Các phụ thuộc cần thêm
|
||||
|
||||
```bash
|
||||
npm install next-intl
|
||||
@@ -208,11 +208,11 @@ npm install next-intl
|
||||
# Testing with mocked i18n available
|
||||
```
|
||||
|
||||
**Total installation footprint:** ~500KB minified
|
||||
**Tổng kích thước cài đặt:** ~500KB đã minify
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Testing Strategy
|
||||
## 🧪 Chiến lược test
|
||||
|
||||
### Unit Tests
|
||||
```typescript
|
||||
@@ -241,43 +241,43 @@ describe('LoginForm', () => {
|
||||
|
||||
---
|
||||
|
||||
## 📊 Estimated Timeline
|
||||
## 📊 Lộ trình ước tính
|
||||
|
||||
| Phase | Duration | Effort |
|
||||
| Giai đoạn | Thời gian | Công sức |
|
||||
|-------|----------|--------|
|
||||
| Setup | 2-3h | Low |
|
||||
| Core Refactoring | 6-8h | Medium |
|
||||
| Components | 4-6h | Medium |
|
||||
| A11y Fixes | 4-6h | Low-Medium |
|
||||
| Testing | 3-4h | Medium |
|
||||
| **Total** | **19-27h** | **~3-4 days** |
|
||||
| Thiết lập | 2-3h | Thấp |
|
||||
| Tái cấu trúc cốt lõi | 6-8h | Trung bình |
|
||||
| Components | 4-6h | Trung bình |
|
||||
| Sửa lỗi A11y | 4-6h | Thấp-Trung bình |
|
||||
| Testing | 3-4h | Trung bình |
|
||||
| **Tổng** | **19-27h** | **~3-4 ngày** |
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Implementation Order (Recommended)
|
||||
## 🚀 Thứ tự triển khai (Khuyến nghị)
|
||||
|
||||
1. **Setup i18n infrastructure** (creates foundation)
|
||||
2. **Update middleware + root layout** (enables routing)
|
||||
3. **Extract & centralize all text** (main work)
|
||||
4. **Fix A11y issues** (parallelize with #3)
|
||||
5. **Test thoroughly** (final verification)
|
||||
1. **Thiết lập hạ tầng i18n** (tạo nền tảng)
|
||||
2. **Cập nhật middleware + root layout** (kích hoạt routing)
|
||||
3. **Trích xuất & tập trung tất cả văn bản** (công việc chính)
|
||||
4. **Sửa các vấn đề A11y** (song song với #3)
|
||||
5. **Test kỹ lưỡng** (xác minh cuối cùng)
|
||||
|
||||
---
|
||||
|
||||
## 💡 Quick Win Opportunities
|
||||
## 💡 Cơ hội thắng nhanh
|
||||
|
||||
These can be done immediately:
|
||||
1. Create message file structure (30 min)
|
||||
2. Add focus trap to dialog (30 min)
|
||||
3. Add aria-busy to spinners (20 min)
|
||||
4. Color contrast audit (1 hour)
|
||||
5. Icon button aria-labels (30 min)
|
||||
Những việc có thể làm ngay:
|
||||
1. Tạo cấu trúc file message (30 phút)
|
||||
2. Thêm focus trap cho dialog (30 phút)
|
||||
3. Thêm aria-busy cho spinner (20 phút)
|
||||
4. Kiểm tra tương phản màu (1 giờ)
|
||||
5. Aria-label cho nút biểu tượng (30 phút)
|
||||
|
||||
---
|
||||
|
||||
## 📝 Notes for Implementation
|
||||
## 📝 Ghi chú khi triển khai
|
||||
|
||||
### Locale Detection (middleware)
|
||||
### Phát hiện locale (middleware)
|
||||
```typescript
|
||||
// Check in order: URL > cookie > header > default
|
||||
function getLocale(request) {
|
||||
@@ -288,19 +288,19 @@ function getLocale(request) {
|
||||
}
|
||||
```
|
||||
|
||||
### Message Fallback Strategy
|
||||
### Chiến lược dự phòng Message
|
||||
```typescript
|
||||
// If translation missing, use English as fallback
|
||||
// Otherwise fallback to Vietnamese (primary)
|
||||
```
|
||||
|
||||
### Performance Considerations
|
||||
- Keep message files < 100KB each
|
||||
- Lazy load per-page messages if needed
|
||||
- Static generation for SEO-critical pages
|
||||
### Cân nhắc về hiệu năng
|
||||
- Giữ các file message < 100KB mỗi file
|
||||
- Lazy load message theo trang nếu cần
|
||||
- Static generation cho các trang quan trọng về SEO
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** April 9, 2026
|
||||
**Version:** 1.0 - Pre-Implementation
|
||||
**Confidence:** High
|
||||
**Cập nhật lần cuối:** Ngày 9 tháng 4 năm 2026
|
||||
**Phiên bản:** 1.0 - Trước triển khai
|
||||
**Độ tin cậy:** Cao
|
||||
|
||||
Reference in New Issue
Block a user