From a1cea6776fe841910a3ab6f0543528a75bdcbac3 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 5 Mar 2024 16:36:27 +0000 Subject: [PATCH] Desktop: Fixes #10058: OCR does not start when German language is selected --- packages/lib/locale.test.ts | 12 +++++++++++- packages/lib/locale.ts | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/lib/locale.test.ts b/packages/lib/locale.test.ts index 0627ef5ba5..641119f3e4 100644 --- a/packages/lib/locale.test.ts +++ b/packages/lib/locale.test.ts @@ -1,4 +1,4 @@ -import { closestSupportedLocale, parsePluralForm, setLocale, _n } from './locale'; +import { closestSupportedLocale, parsePluralForm, setLocale, _n, toIso639 } from './locale'; describe('locale', () => { @@ -91,4 +91,14 @@ describe('locale', () => { } }); + test.each([ + ['en_GB', 'eng'], + ['en', 'eng'], + ['de', 'deu'], + ['fr_FR', 'fra'], + ])('should convert to ISO-639', (input, expected) => { + const actual = toIso639(input); + expect(actual).toBe(expected); + }); + }); diff --git a/packages/lib/locale.ts b/packages/lib/locale.ts index 600a4fed3d..6bf10d6d97 100644 --- a/packages/lib/locale.ts +++ b/packages/lib/locale.ts @@ -213,6 +213,7 @@ const iso639Map_ = [ ['cos', 'co'], ['cre', 'cr'], ['dan', 'da'], + ['deu', 'de'], ['div', 'dv'], ['dzo', 'dz'], ['eng', 'en'],