Skip to content

Add text transformation pipes (uppercase, lowercase, capitalize) support in translations #705

@allandiegoasilva

Description

@allandiegoasilva

Clear and concise description of the problem

Currently, nestjs-i18n allows interpolation of variables (e.g. {{field}}) but doesn’t provide built-in support for simple text transformations such as uppercase, lowercase, or capitalize within translation files.

This makes it harder to handle case-sensitive requirements directly in the translation strings (e.g., UI titles, field labels) and forces developers to apply manual post-processing after calling i18n.translate().

Suggested solution

Example translation file:

 {
    "greeting": "Hello, {{name}}!"
  }

Expected usage in code:

await this.i18n.translate('shared.greeting', {
  lang: 'en',
  args: { name: 'john doe' },
 transform: "uppercase"
});

// Potentially with modifier → "Hello, JOHN DOE!"

Alternative

Maybe can add uppsercase on translate file.

 {
    "greeting": "Hello, {{name | uppercase}}!"
  }

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions