Added tests for addBuffer and improved handling of empty strings files

This commit is contained in:
Alexander Cerutti
2021-10-11 23:43:03 +02:00
parent e69f302cf9
commit 6f3a7d2f6e
2 changed files with 120 additions and 1 deletions

View File

@@ -403,9 +403,15 @@ export default class PKPass extends Bundle {
if ((match = pathName.match(translationsFileRegexp))) {
const [, lang] = match;
const parsedTranslations = Strings.parse(buffer).translations;
if (!parsedTranslations.length) {
return;
}
Object.assign(
(this[localizationSymbol][lang] ??= {}),
Object.fromEntries(Strings.parse(buffer).translations),
Object.fromEntries(parsedTranslations),
);
return;