Open djtsov opened 4 years ago
As I understood, for using the the square brackets in regular expressions, it's needed to use follow identifier: ["\\[","\\]"].
But then this line works wrong:
var key = placeholder.replace(identifiers[0], '').replace(identifiers[1], '');
because translate string contains the single brackets, but identifier[0] is '[' and identifier[1] is ']'.
Hi @djtsov
Thank you for your feedback. I will look into this. The syntax of the identifiers is probably not correct yet.
I want to use the square brackets for parameters in translation strings, for example, 'This is my [project]'. And for that aim I add the
{identifier: ['[',']']}
as the config parameter for initialize vuex-i18n. But unfortunately when I try to get a translation bythis.$i18n.translate('mykey', {'project': 'test' })
, I get 'This is my [project]' instead 'This is my test'. But when I replace the square brackets to braces (e.g. 'This is my {project}') then all works as expected. P.S. When I use the square brackets(!) then thethis.$i18n.translate('mykey', {'project': 'test' })
stops to work for strings used the braces 'This is my {project}', i.e. the identifier was changed for another symbol.