From 7b5774feed6982d804a3d2d393541a2f1783c069 Mon Sep 17 00:00:00 2001 From: Liam Mulhall Date: Sat, 24 Dec 2022 14:40:50 -0700 Subject: [PATCH] fix: if no keys, set number of translated to 0 If there are no string keys for a given key type (sim-specific, shared, or common), we set the number of translated strings in the form to 0. For https://github.com/phetsims/rosetta/issues/345. Came out of https://github.com/phetsims/qa/issues/869. --- src/client/js/computeTranslatedStringsData.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/client/js/computeTranslatedStringsData.js b/src/client/js/computeTranslatedStringsData.js index 0770fec2..b489d6d0 100644 --- a/src/client/js/computeTranslatedStringsData.js +++ b/src/client/js/computeTranslatedStringsData.js @@ -46,6 +46,12 @@ const computeTranslatedStringsData = translationValues => { } translatedStringsData[ keyType ].translated = translatedStringsCount; } + else { + + // If there aren't any string keys for a given key type, set translated to 0. + // Thus, you'd get a message like "0 of 0 {key type} strings translated". + translatedStringsData[ keyType ].translated = 0; + } } } return translatedStringsData;