File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 11import { LOCALES } from "@triliumnext/commons" ;
22import { readFileSync } from "fs" ;
33import { join } from "path" ;
4+ // eslint-disable-next-line @typescript-eslint/no-require-imports
5+ const { languages } = require ( "tesseract.js" ) ;
46import { describe , expect , it } from "vitest" ;
57
68describe ( "i18n" , ( ) => {
@@ -16,4 +18,17 @@ describe("i18n", () => {
1618 . not . toThrow ( ) ;
1719 }
1820 } ) ;
21+
22+ it ( "all tesseractCode values are supported by Tesseract.js" , ( ) => {
23+ const supportedCodes = new Set ( Object . keys ( languages ) . map ( ( k ) => k . toLowerCase ( ) ) ) ;
24+
25+ for ( const locale of LOCALES ) {
26+ if ( ! locale . tesseractCode ) {
27+ continue ;
28+ }
29+
30+ expect ( supportedCodes , `Locale '${ locale . id } ' has unsupported tesseractCode '${ locale . tesseractCode } '` )
31+ . toContain ( locale . tesseractCode ) ;
32+ }
33+ } ) ;
1934} ) ;
You can’t perform that action at this time.
0 commit comments