Closed matthub closed 4 years ago
@AndreiSoroka Yes, and there were some workarounds presented which only partially worked for our situation. Can you elaborate a little bit more - like what question you have, or if that code does not work for you?
@matthub Oh. Sorry. That MR was 2020 :)
I'm from https://github.com/mashpie/i18n-node/issues/274
You wrote
This should fix #274"
But that problem is actual.
@AndreiSoroka sorry for the long delay, just tried to put your examples in a test case, which ran through. Can you provide a simple test case to reproduce?
it('AndreiSoroka 1 - should ignore standalone pipe', function() {
const standalone = 'page number 3 | My site';
should.equal(
pluralTest.__(standalone),
standalone
);
});
it('AndreiSoroka 2 - should support escapes', function() {
const standalone = 'page number 3 \\| My site';
should.equal(
pluralTest.__(standalone),
standalone
);
});
it('274 example - should ignore single standalone | symbol', function() {
const standalone = 'Foo Bar | Baz Beep';
should.equal(
pluralTest.__(standalone),
standalone
);
});
Hey Thanks for the reply, I'll try to reproduce it next week
I was able to use "someKey": "hello %7C there"
and decodeURI(t("somekey"))
which becomes hello | there
edit: commented on wrong issue
We are happy users of your great library, but we encountered an issue with the pipe character. We wanted to use the pipe symbol directly as part of the text - without using the variable workaround as mentioned in this stackoverflow question. Thus this pull request is changing the parsing logic regarding to the pipe as following:
Additionally I've pushed the version to 0.10.1. Existing tests ran without any changes, additionally I added two test cases to verify the changed standalone pipe symbol behavior.
This should fix #274 and could maybe superseed pull request #388
If there is anything to add in the code or additionally to test I'm happy to do that. Thanks for the great library!