diff --git a/src/browser/utils.browser.ts b/src/browser/utils.browser.ts index 2c62f133..88898302 100644 --- a/src/browser/utils.browser.ts +++ b/src/browser/utils.browser.ts @@ -4,6 +4,7 @@ import CH from '../locales/cmn-Hant/text.json'; import CHS from '../locales/ch-CHS/text.json'; import E from '../locales/en/text.json'; import F from '../locales/fr-FR/text.json'; +import FI from '../locales/fi-FI/text.json'; import I from '../locales/it-IT/text.json'; import J from '../locales/ja-JP/text.json'; import K from '../locales/uk-UA/text.json'; @@ -31,6 +32,6 @@ declare global { } window.jw_epub_parser = { - languages: { CH, CHS, E, F, I, J, K, KO, M, MG, P, S, T, TG, TK, TND, TNK, TPO, TTM, TW, U, VZ, X }, + languages: { CH, CHS, E, F, FI, I, J, K, KO, M, MG, P, S, T, TG, TK, TND, TNK, TPO, TTM, TW, U, VZ, X }, path: path, }; diff --git a/src/common/date_parser.ts b/src/common/date_parser.ts index e0f743dd..1f13e5fd 100644 --- a/src/common/date_parser.ts +++ b/src/common/date_parser.ts @@ -69,6 +69,7 @@ const mwbDatePatterns: LangRegExp = { CH: new RegExp(mwbDatePatternJ, 'giu'), CHS: new RegExp(mwbDatePatternJ, 'giu'), E: new RegExp(mwbDatePatternE, 'giu'), + FI: new RegExp(mwbDatePatternX, 'giu'), J: new RegExp(mwbDatePatternJ, 'giu'), KO: new RegExp(mwbDatePatternKO, 'giu'), P: new RegExp(mwbDatePatternP, 'giu'), @@ -230,11 +231,18 @@ option1 = `(\\d{1,2}). bis (?:\\d{1,2}).? (${wordWithDiacritics}) (\\d{4})`; option2 = `(\\d{1,2}). (${wordWithDiacritics}) (\\d{4})`; const wDatePatternX = `${option1}|${option2}`; +// date like 1-) Tutkitaan 3.–9.2.2025 ; or 2) Tutkitaan 24.2.–2.3.2025. ; or 3) Tutkitaan 30.12.2024–5.1.2025. +option1 = '(\\d{1,2}).[–](?:\\d{1,2}).(\\d{1,2}).(\\d{4})'; +option2 = '(\\d{1,2}).(\\d{1,2}).[–](?:\\d{1,2}).(?:\\d{1,2}).(\\d{4})'; +option3 = '(\\d{1,2}).(\\d{1,2}).(\\d{4})'; +const wDatePatternFI = `${option1}|${option2}|${option3}`; + const wDatePatterns: LangRegExp = { common: new RegExp(wDatePatternCommon, 'giu'), CH: new RegExp(wDatePatternJ, 'giu'), CHS: new RegExp(wDatePatternJ, 'giu'), E: new RegExp(wDatePatternE, 'giu'), + FI: new RegExp(wDatePatternFI, 'giu'), J: new RegExp(wDatePatternJ, 'giu'), KO: new RegExp(wDatePatternKO, 'giu'), P: new RegExp(wDatePatternP, 'giu'), diff --git a/src/locales/languages.ts b/src/locales/languages.ts index f54592d1..cf8423f4 100644 --- a/src/locales/languages.ts +++ b/src/locales/languages.ts @@ -1,25 +1,27 @@ export default [ - { locale: 'en', code: 'E' }, - { locale: 'fr-FR', code: 'F' }, - { locale: 'it-IT', code: 'I' }, - { locale: 'ja-JP', code: 'J' }, - { locale: 'uk-UA', code: 'K' }, - { locale: 'ko-KR', code: 'KO' }, - { locale: 'ro-RO', code: 'M' }, - { locale: 'mg-MG', code: 'MG' }, - { locale: 'pl-PL', code: 'P' }, - { locale: 'es-ES', code: 'S' }, - { locale: 'pt-BR', code: 'T' }, - { locale: 'pt-PT', code: 'TPO'}, - { locale: 'tl-PH', code: 'TG' }, - { locale: 'tr-TR', code: 'TK' }, - { locale: 'mg-TND', code: 'TND' }, - { locale: 'mg-TNK', code: 'TNK' }, - { locale: 'mg-TTM', code: 'TTM' }, - { locale: 'tw-TW', code: 'TW' }, - { locale: 'uk-UA', code: 'U' }, - { locale: 'mg-VZ', code: 'VZ' }, - { locale: 'de-DE', code: 'X' }, - { locale: 'cmn-Hant', code: 'CH' }, - { locale: 'ch-CHS', code: 'CHS' }, + { locale: 'en', code: 'E' }, + { locale: 'fr-FR', code: 'F' }, + { locale: 'it-IT', code: 'I' }, + { locale: 'ja-JP', code: 'J' }, + { locale: 'uk-UA', code: 'K' }, + { locale: 'ko-KR', code: 'KO' }, + { locale: 'ro-RO', code: 'M' }, + { locale: 'mg-MG', code: 'MG' }, + { locale: 'pl-PL', code: 'P' }, + { locale: 'es-ES', code: 'S' }, + { locale: 'pt-BR', code: 'T' }, + { locale: 'pt-PT', code: 'TPO' }, + { locale: 'tl-PH', code: 'TG' }, + { locale: 'tr-TR', code: 'TK' }, + { locale: 'mg-TND', code: 'TND' }, + { locale: 'mg-TNK', code: 'TNK' }, + { locale: 'mg-TTM', code: 'TTM' }, + { locale: 'tw-TW', code: 'TW' }, + { locale: 'uk-UA', code: 'U' }, + { locale: 'mg-VZ', code: 'VZ' }, + { locale: 'de-DE', code: 'X' }, + { locale: 'cmn-Hant', code: 'CH' }, + { locale: 'ch-CHS', code: 'CHS' }, + { locale: 'fi-FI', code: 'FI' }, + { locale: 'sv-SE', code: 'Z' }, ]; diff --git a/src/node/utils.node.ts b/src/node/utils.node.ts index 0cdbbce7..07d905c4 100644 --- a/src/node/utils.node.ts +++ b/src/node/utils.node.ts @@ -5,6 +5,7 @@ import CH from '../locales/cmn-Hant/text.json' assert { type: 'json' }; import CHS from '../locales/ch-CHS/text.json' assert { type: 'json' }; import E from '../locales/en/text.json' assert { type: 'json' }; import F from '../locales/fr-FR/text.json' assert { type: 'json' }; +import FI from '../locales/fi-FI/text.json' assert { type: 'json' }; import I from '../locales/it-IT/text.json' assert { type: 'json' }; import J from '../locales/ja-JP/text.json' assert { type: 'json' }; import K from '../locales/uk-UA/text.json' assert { type: 'json' }; @@ -30,7 +31,7 @@ declare global { } global.jw_epub_parser = { - languages: { CH, CHS, E, F, I, J, K, KO, M, MG, P, S, T, TG, TK, TND, TNK, TPO, TTM, TW, U, VZ, X }, + languages: { CH, CHS, E, F, FI, I, J, K, KO, M, MG, P, S, T, TG, TK, TND, TNK, TPO, TTM, TW, U, VZ, X }, path: path, readFile: readFile, };