Translation (i18n) of system error messages

Hi everoyone.

Is is possible to translate (i18n) system error messages?
I did not find answer in docs, nor on the forum or in google.
Simple ones are not a problem. But ones with variables are.

For example Unable to register user with identity ‘XXX’. User already exists.
Obviously I cannot use it as translation key since it contains variable identity name.

Same problem with Duplicate value ‘XXX’ for column ‘YYY’

Maybe there is some form of using error code number as translation key?
Like error_3033 or something?

I tried varoius versions of passing strings with %s as variable placeholder - but it does not save such key. It returns an error.

Hello @Emil_Karolak

I consulted the team and unfortunately we don’t have support for your case, but you can transform the translated string. For example:

  • const tr =my error {email}
  • tr.replace('{email}', 'foo.bar@com')

Regards,
Inna

1 Like

Thank you Inna.

I found better solution though :slight_smile:
I’ll leave it here for future reference if anyone needs simillar solution.

I just catch error code instead of message - and pass it to error text block with some page-specific prefix for example “error_registration_123” - and I use this string as translation key.

obraz