Skip to content

Commit c2eb4ba

Browse files
committed
Keep a sentence ended in any script's mark, not only the ones listed
The apply card's list missed Devanagari, Armenian, Ethiopic, Khmer and Myanmar, so a Hindi sentence ended in a danda would get a second mark. Unicode's Sentence_Terminal covers them all.
1 parent c53312a commit c2eb4ba

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎src/renderer/apply-card.cjs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,10 @@ function applyStepRows(steps = [], states = []) {
179179
* sentence; without one the sentence is the whole story, and is given the
180180
* full stop it may lack: Git's own line and a thrown error have none. The
181181
* full stop is the translator's, since not every language ends a sentence
182-
* with one, and a sentence already ended in another script's mark keeps it. A patch file is applied all or nothing, so its
183-
* failure also says that nothing was changed; a pull request's does not,
184-
* since a checkout that fails part-way can leave the site on another branch.
182+
* with one, and a sentence already ended in any script's mark keeps it. A
183+
* patch file is applied all or nothing, so its failure also says that nothing
184+
* was changed; a pull request's does not, since a checkout that fails part-way
185+
* can leave the site on another branch.
185186
*
186187
* @param {Object} root0
187188
* @param {string} [root0.error] What went wrong, as it was reported.
@@ -191,7 +192,7 @@ function applyStepRows(steps = [], states = []) {
191192
*/
192193
function applyFailureWords({ error = '', conflict = null, kind = '' } = {}) {
193194
const sentence = String(error || '').trim();
194-
const headline = (conflict && conflict.headline) || (/[.!?。!?؟۔…]$/.test(sentence) || !sentence ? sentence : sprintf(
195+
const headline = (conflict && conflict.headline) || (/[\p{Sentence_Terminal}…]$/u.test(sentence) || !sentence ? sentence : sprintf(
195196
// translators: %s: a sentence that did not end in a full stop. Use the mark your language ends a sentence with, or none.
196197
_x('%s.', 'ends a sentence that lacks a full stop'),
197198
sentence

‎tests/unit/apply-card.test.cjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ test('the full stop a sentence is given is the translator\'s, and one ended in a
140140
assert.equal(applyFailureWords({ error: 'git: patch does not apply', kind: 'patch' }).headline, 'git: patch does not apply。');
141141
assert.equal(applyFailureWords({ error: 'パッチを適用できません。', kind: 'patch' }).headline, 'パッチを適用できません。');
142142
assert.equal(applyFailureWords({ error: 'هل تريد المتابعة؟', kind: 'pr' }).headline, 'هل تريد المتابعة؟');
143+
assert.equal(applyFailureWords({ error: 'पैच लागू नहीं हुआ।', kind: 'patch' }).headline, 'पैच लागू नहीं हुआ।');
143144
});
144145

145146
test('a breakdown\'s headline replaces the sentence it says in counts', () => {

0 commit comments

Comments
 (0)