Permalink
Browse files

Check for additional placeholders in translations

validation didn’t check for extra placeholders if there were none in the original.
  • Loading branch information...
chrisgarrity committed Jul 19, 2018
1 parent 3a8cf83 commit 8db6469cb555c679978a8306039a8cee052828ba
Showing with 11 additions and 8 deletions.
  1. +6 −3 i18n/create_scratch_msgs.js
  2. +5 −5 msg/scratch_msgs.js
@@ -19,9 +19,12 @@ const validateEntry = function (entry) {
const re = /(%\d)/g;
const [key, translation] = entry;
const enMatch = en[key].match(re);
const placeholdersCount = enMatch ? enMatch.length : 0;
if (placeholdersCount > 0) {
const tMatch = translation.match(re);
const tMatch = translation.match(re);
const enCount = enMatch ? enMatch.length : 0;
const tCount = tMatch ? tMatch.length : 0;
assert.strictEqual(tCount, enCount, `${key}:${en[key]} - "${translation}" placeholder mismatch`);
if (enCount > 0) {
assert.notStrictEqual(tMatch, null, `${key} is missing a placeholder: ${translation}`);
assert.strictEqual(
tMatch.sort().toString(),
View
@@ -1117,14 +1117,14 @@ Blockly.ScratchMsgs.locales["cy"] =
"DELETE_VARIABLE": "Dileu newidyn \"%1\"",
"NEW_PROCEDURE": "Creu Bloc",
"PROCEDURE_ALREADY_EXISTS": "Mae trefn o'r enw \"%1\" yn bodoli eisoes.",
"PROCEDURE_DEFAULT_NAME": "block name",
"PROCEDURE_DEFAULT_NAME": "enw bloc",
"NEW_LIST": "Gwneud Rhestr",
"NEW_LIST_TITLE": "Enw rhestr newydd:",
"LIST_MODAL_TITLE": "Rhestr Newydd",
"LIST_ALREADY_EXISTS": "Mae rhestr o'r enw \"%1\" yn bodoli eisoes.",
"RENAME_LIST_TITLE": "Ailenwi pob rhestr \"%1\" i:",
"RENAME_LIST_MODAL_TITLE": "Ailenwi Rhestr",
"DEFAULT_LIST_ITEM": "thing",
"DEFAULT_LIST_ITEM": "peth",
"NEW_BROADCAST_MESSAGE": "Neges newydd",
"NEW_BROADCAST_MESSAGE_TITLE": "Enw neges newydd:",
"BROADCAST_MODAL_TITLE": "Neges Newydd",
@@ -4208,7 +4208,7 @@ Blockly.ScratchMsgs.locales["gd"] =
"DELETE_VARIABLE": "Sguab às dha “%1”",
"NEW_PROCEDURE": "Cruthaich bloca",
"PROCEDURE_ALREADY_EXISTS": "Tha modh air a bheil “%1” ann mu thràth.",
"PROCEDURE_DEFAULT_NAME": "block name",
"PROCEDURE_DEFAULT_NAME": "ainm a’ bhloca",
"NEW_LIST": "Cruthaich liosta",
"NEW_LIST_TITLE": "Ainm na liosta ùire:",
"LIST_MODAL_TITLE": "Liosta ùr",
@@ -7673,7 +7673,7 @@ Blockly.ScratchMsgs.locales["pl"] =
"LOOKS_CLEARGRAPHICEFFECTS": "Wyczyść efekty graficzne",
"LOOKS_CHANGESIZEBY": "Zmień rozmiar o %1",
"LOOKS_SETSIZETO": "Ustaw rozmiar na %1 %",
"LOOKS_SIZE": "Rozmiar %1",
"LOOKS_SIZE": "rozmiar",
"LOOKS_CHANGESTRETCHBY": "zmień rozciągnięcie o %1",
"LOOKS_SETSTRETCHTO": "ustaw rozciąganie na %1 %",
"LOOKS_SWITCHCOSTUMETO": "Zmień kostium na %1",
@@ -9835,7 +9835,7 @@ Blockly.ScratchMsgs.locales["sv"] =
"LIST_ALREADY_EXISTS": "En lista \"%1\" finns redan.",
"RENAME_LIST_TITLE": "Döp om alla \"%1\" listor till:",
"RENAME_LIST_MODAL_TITLE": "Döp om lista",
"DEFAULT_LIST_ITEM": "thing",
"DEFAULT_LIST_ITEM": "grej",
"NEW_BROADCAST_MESSAGE": "Nytt meddelande",
"NEW_BROADCAST_MESSAGE_TITLE": "Nytt namn på meddelande:",
"BROADCAST_MODAL_TITLE": "Nytt meddelande",

0 comments on commit 8db6469

Please sign in to comment.