angular-best-practices-transloco

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Angular 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
    transloco
    pipe or directive
  • Lazy-loading translation files per route with scopes
  • Writing tests that use
    TranslocoTestingModule
  • 使用
    transloco
    管道或指令添加运行时国际化支持
  • 按路由通过作用域懒加载翻译文件
  • 编写使用
    TranslocoTestingModule
    的测试用例

Rules

规则

RuleImpactDescription
Lazy Load Translation Files per RouteMEDIUMLoad scoped translations only when a route is activated
Mock Translations in TestsMEDIUMFast deterministic tests without HTTP translation loading
Use Transloco for Runtime i18nMEDIUMDynamic language switching without app rebuilds
规则影响程度描述
按路由懒加载翻译文件中等仅在路由激活时加载对应作用域的翻译文件
在测试中模拟翻译中等无需HTTP加载翻译即可实现快速、可预测的测试
使用Transloco实现运行时国际化中等无需重建应用即可动态切换语言

Install

安装

Core skill (recommended):
npx skills add alfredoperez/angular-best-practices --skill angular-best-practices
This add-on:
npx skills add alfredoperez/angular-best-practices --skill angular-best-practices-transloco
核心技能(推荐):
npx skills add alfredoperez/angular-best-practices --skill angular-best-practices
本附加技能:
npx skills add alfredoperez/angular-best-practices --skill angular-best-practices-transloco