angular-best-practices-transloco
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAngular Transloco Best Practices
Angular Transloco 最佳实践
Transloco rules for runtime internationalization, lazy-loaded translations, and testing. Use with the core
angular-best-practices
skill for comprehensive Angular coverage.
适用于运行时国际化、懒加载翻译及测试的Transloco规则。搭配核心的angular-best-practices技能使用,可获得全面的Angular开发支持。
Links
链接
When to Apply
适用场景
- Adding runtime i18n with the pipe or directive
transloco - Lazy-loading translation files per route with scopes
- Writing tests that use
TranslocoTestingModule
- 使用管道或指令添加运行时国际化支持
transloco - 按路由通过作用域懒加载翻译文件
- 编写使用的测试用例
TranslocoTestingModule
Rules
规则
| Rule | Impact | Description |
|---|---|---|
| Lazy Load Translation Files per Route | MEDIUM | Load scoped translations only when a route is activated |
| Mock Translations in Tests | MEDIUM | Fast deterministic tests without HTTP translation loading |
| Use Transloco for Runtime i18n | MEDIUM | Dynamic language switching without app rebuilds |
| 规则 | 影响程度 | 描述 |
|---|---|---|
| 按路由懒加载翻译文件 | 中等 | 仅在路由激活时加载对应作用域的翻译文件 |
| 在测试中模拟翻译 | 中等 | 无需HTTP加载翻译即可实现快速、可预测的测试 |
| 使用Transloco实现运行时国际化 | 中等 | 无需重建应用即可动态切换语言 |
Install
安装
Core skill (recommended):
npx skills add alfredoperez/angular-best-practices --skill angular-best-practicesThis add-on:
npx skills add alfredoperez/angular-best-practices --skill angular-best-practices-translocoBrowse all skills: skills.sh/alfredoperez/angular-best-practices
核心技能(推荐):
npx skills add alfredoperez/angular-best-practices --skill angular-best-practices本附加技能:
npx skills add alfredoperez/angular-best-practices --skill angular-best-practices-transloco