-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
MBS-13496: Support attributes with spaces in link phrase interpolation #3186
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import expand2text, { | |
} from '../../common/i18n/expand2text.js'; | ||
|
||
test('expand2', function (t) { | ||
t.plan(69); | ||
t.plan(70); | ||
|
||
let error = ''; | ||
const consoleError = console.error; | ||
|
@@ -46,6 +46,7 @@ test('expand2', function (t) { | |
); | ||
expandText('An {apple_fruit}', null, 'An {apple_fruit}'); | ||
expandText('An {apple_fruit}', {apple_fruit: 'apple'}, 'An apple'); | ||
expandText('An {apple fruit}', {'apple fruit': 'apple'}, 'An apple'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be nice to have two more small tests for Also, I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do I understand correctly that
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a couple tests to the Perl file :) |
||
expandText('A {number}', {number: 1}, 'A 1'); | ||
expandHtml('{null} value', {null: null}, ' value'); | ||
t.equal(error, ''); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beginning/ending spaces should probably not be allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why they shouldn't? I mean, I don't think we're going to use them, but what's the damage? We're also probably not going to use ending underscores but we allow them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To prevent using them indeed. Damage is broken interpolation and translation. Same for underscores.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that would only be a problem if we actually did add spaces at the beginning or end of variables, or a translator messed up (which is already the case even without the spaces) :) That said, if the regex can be easily changed to your preference, I have nothing against committing a suggestion for it, I just don't think we should complicate it too much otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I don’t think that allowing spaces in variable names is a good approach at all, see below.