transloco-testing-flat-keys

Configure TranslocoTestingModule.forRoot with flat keys for Angular translate() tests.

171|10|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/fmflurry/settings-opencode --skill transloco-testing-flat-keys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: transloco-testing-flat-keys
Source: https://github.com/fmflurry/settings-opencode/tree/main/.claude/skills/transloco-testing-flat-keys
Command: npx skills add https://github.com/fmflurry/settings-opencode --skill transloco-testing-flat-keys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When unit tests exercise code that calls this.transloco.translate(), programmatic lookups may return the raw key instead of the translated value. This Skill provides a solution by using flat, dot-delimited keys and a TranslocoTestingModule.forRoot configuration to produce correct translations in tests.

Core Features & Use Cases

  • Flat-key translation mapping for programmatic access.
  • Works with Transloco in Angular unit tests.
  • Use case: verify translations in code paths that call translate() directly.

Quick Start

Configure TranslocoTestingModule.forRoot with flat, locale-scoped keys and a translocoConfig that enables the target language for consistent programmatic translations in tests.

Frequently Asked Questions about transloco-testing-flat-keys

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does Transloco.translate() return the key instead of the translation in Angular unit tests?

Using flat, dot-delimited keys with TranslocoTestingModule.forRoot resolves programmatic lookups to return correct translated values instead of the raw key during Angular unit tests.

How do I configure TranslocoTestingModule for programmatic translation lookups in tests?

Configure TranslocoTestingModule.forRoot with langs mapped as flat keys and a translocoConfig specifying availableLangs and defaultLang to ensure consistent programmatic translations across tests.

When do I need flat-key translation mapping for Angular unit testing?

You need flat-key translation mapping when unit tests exercise TypeScript code paths that call this.transloco.translate() directly, ensuring those programmatic lookups return translated values rather than raw keys.

Does this Transloco testing approach work with nested translation keys?

This approach specifically uses flat, dot-delimited keys rather than nested translation structures. Configuring TranslocoTestingModule.forRoot with flat, locale-scoped keys ensures proper runtime translations across tests.

What translocoConfig settings are required to fix missing translations in unit tests?

The translocoConfig requires availableLangs and defaultLang settings, combined with TranslocoTestingModule.forRoot configured with flat keys, to produce correct programmatic translations in unit tests.