Skip to content

Simpler solution to translate key to a specific locale #1356

Open
@codeflorist

Description

@codeflorist

Clear and concise description of the problem

If one wants to translate a key to a specific locale, this is possible by stating the locale in the TranslateOptions object.

However, the only signatures available taking this parameter are:

t(key, plural, TranslateOptions)
t(key, defaultMsg, TranslateOptions)
t(key, interpolations, TranslateOptions)

So the easiest solution would be using the plural-variant. e.g.:

t('message.key', 1, { locale: 'fr' })

But i should not be required to state a plural option, if i don't need it.

Suggested solution

The solution would be to provide the following additional signature:

t(key,TranslateOptions)

Then this simple and logical solution would be possible:

t('message.key', { locale: 'fr' })

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions