Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special characters support in translation parameters #98

Closed
eeedvisss opened this issue Dec 4, 2018 · 1 comment
Closed

Special characters support in translation parameters #98

eeedvisss opened this issue Dec 4, 2018 · 1 comment
Assignees
Labels

Comments

@eeedvisss
Copy link

Hi,
First of all thanks for amazing 'i18n' implementation into 'vuex'.
Just one issue we bumped into while using it. Looks like regex that matches start/end identifiers only accept word characters between them (\w+). That way if we pass something like this as params '{{test!}}' we do not get a translated string while '{{test}}' works fine. Is there a particular reason for this? Could the matcher be updated from:
var matcher = new RegExp('' + identifiers[0] + '\\w+' + identifiers[1], 'g');
to:
var matcher = new RegExp('' + identifiers[0] + '.+?' + identifiers[1], 'g');
or similar to allow special characters?
Or maybe there's some option that I am missing that allows to do this?

@tikiatua
Copy link
Member

tikiatua commented Dec 4, 2018

Dear @eeedvisss

Many thanks for reporting the issue. We actually never bumped into the problem, as we usually use rather simple strings as keys for the translation – i.e. dashboard.title.

However, your reported use case should really work and I will look into how we can make the regex matcher more robust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants