-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Allow escaping linked translations #248
Conversation
Hi, thanks for the PR! I think it is better to handle it similar to how Dart handles interpolation ( {
"message": "10@:{common.nbsp}Days"
} Here, I surrounded the path with |
Thank you for the feedback @Tienisto |
Please add the following tests in test('with links', () {
final test = r'{myArg} @:myLink';
final node = textNode(test, StringInterpolation.braces);
expect(node.content, r'${myArg} ${_root.myLink}');
expect(node.params, <String>{'myArg'});
});
test('with escaped links', () {
final test = r'{myArg} @:linkA @:{linkB}hello @:{linkC}';
final node = textNode(test, StringInterpolation.braces);
expect(node.content,
r'${myArg} ${_root.linkA} ${_root.linkB}hello ${_root.linkC}');
expect(node.params, <String>{'myArg'});
}); The main problem here is that we parse the linked translations after the interpolation ( |
You probably need to parse the linked translations first and update |
Good catch @Tienisto , I added the tests you recommended. As far as I understand, ignoring matches leading with |
Nice! |
(cherry picked from commit 3fb77d9)
I ran into an issue with linking translations and having them immediately followed by another word character.
Example:
Message is linking to
@:common.nbsp
, but the link will be interpreted as@:common.nbspDays
which is invalid.My PR adds the option to escape linked translations: