We need regexes in our translation files, for localised validation of things. Regexes are already annoying to read, and having to put extra encoding in them makes them even less readable.
Suggested solution
A way to fetch a translation message, without attempting to "compile" it. It should ignore all special characters in it, and just return the string exactly as-is, without processing or compilation. This could be a switch in the TranslationOptions object that is given in the t function, since compilation appears to occur just-in-time, e.g. when a message is fetched.
Alternative
Like I said, it would require annoying encoding in a string that is already hard to read:
Would need to become, well, I dunno what exactly. A even uglier monster 🙂
I'm not convinced that changing all regexes is a viable alternative, but it is technically an alternative.
I guess for now we should rather hardcode regexes into the application, but having a workaround should not demotivate finding a solution.
Additional context
Might be helpful to know that this had worked fine in version 8. We skipped 9, and when straight to 10 while upgrading to Vue 3.
Clear and concise description of the problem
We need regexes in our translation files, for localised validation of things. Regexes are already annoying to read, and having to put extra encoding in them makes them even less readable.
Suggested solution
A way to fetch a translation message, without attempting to "compile" it. It should ignore all special characters in it, and just return the string exactly as-is, without processing or compilation. This could be a switch in the
TranslationOptions
object that is given in thet
function, since compilation appears to occur just-in-time, e.g. when a message is fetched.Alternative
Like I said, it would require annoying encoding in a string that is already hard to read:
Would need to become, well, I dunno what exactly. A even uglier monster 🙂 I'm not convinced that changing all regexes is a viable alternative, but it is technically an alternative.
I guess for now we should rather hardcode regexes into the application, but having a workaround should not demotivate finding a solution.
Additional context
Might be helpful to know that this had worked fine in version 8. We skipped 9, and when straight to 10 while upgrading to Vue 3.
Validations