diff --git a/app/soapbox/locales/whitelist_is.json b/app/soapbox/locales/whitelist_is.json new file mode 100644 index 000000000..0d4f101c7 --- /dev/null +++ b/app/soapbox/locales/whitelist_is.json @@ -0,0 +1,2 @@ +[ +] diff --git a/translationRunner.ts b/translationRunner.ts index ad88f3db3..c4994648b 100644 --- a/translationRunner.ts +++ b/translationRunner.ts @@ -116,8 +116,8 @@ manageTranslations({ // used in translations which are not used in the default message. /* eslint-disable no-console */ -function findVariablesinAST(tree: parser.MessageFormatElement[]) { - const result = new Set(); +function findVariablesinAST(tree: parser.MessageFormatElement[]): Set { + const result = new Set(); tree.forEach((element) => { switch (element.type) { case parser.TYPE.argument: @@ -142,7 +142,7 @@ function findVariablesinAST(tree: parser.MessageFormatElement[]) { return result; } -function findVariables(string: string) { +function findVariables(string: string): Set { return findVariablesinAST(parser.parse(string)); } @@ -161,14 +161,19 @@ const extractedMessages = extractedMessagesFiles.reduce((acc, messageFile) => { return acc; }, [] as ExtractedDescriptor[]); -const translations = languages.map((language: string) => { +interface Translation { + language: string, + data: Record, +} + +const translations: Translation[] = languages.map((language: string) => { return { language: language, data: JSON.parse(fs.readFileSync(path.join(translationsDirectory, language + '.json'), 'utf8')), }; }); -function difference(a: Set, b: Set) { +function difference(a: Set, b: Set): Set { return new Set(Array.from(a).filter(x => !b.has(x))); }