Skip to content

Commit

Permalink
Enable importing .json files
Browse files Browse the repository at this point in the history
Removes a bunch of ts-expect-error TS(2307)

Signed-off-by: Daniel Ziegenberg <[email protected]>
  • Loading branch information
ziegenberg committed May 24, 2024
1 parent b0f33d3 commit b817e4c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 39 deletions.
53 changes: 18 additions & 35 deletions src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,23 @@ import Backend from "i18next-xhr-backend";
import LanguageDetector from "i18next-browser-languagedetector";

// import language files
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import enGBTrans from "./org/opencastproject/adminui/languages/lang-en_GB";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import enUSTrans from "./org/opencastproject/adminui/languages/lang-en_US";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import daDKTrans from "./org/opencastproject/adminui/languages/lang-da_DK";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import deDETrans from "./org/opencastproject/adminui/languages/lang-de_DE";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import elGRTrans from "./org/opencastproject/adminui/languages/lang-el_GR";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import esESTrans from "./org/opencastproject/adminui/languages/lang-es_ES";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import frFRTrans from "./org/opencastproject/adminui/languages/lang-fr_FR";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import glESTrans from "./org/opencastproject/adminui/languages/lang-gl_ES";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import heILTrans from "./org/opencastproject/adminui/languages/lang-he_IL";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import itITTrans from "./org/opencastproject/adminui/languages/lang-it_IT";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import nlNLTrans from "./org/opencastproject/adminui/languages/lang-nl_NL";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import plPLTrans from "./org/opencastproject/adminui/languages/lang-pl_PL";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import slSITrans from "./org/opencastproject/adminui/languages/lang-sl_SI";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import svSETrans from "./org/opencastproject/adminui/languages/lang-sv_SE";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import trTRTrans from "./org/opencastproject/adminui/languages/lang-tr_TR";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import zhCNTrans from "./org/opencastproject/adminui/languages/lang-zh_CN";
// @ts-expect-error TS(2307): Cannot find module './org/opencastproject/adminui/... Remove this comment to see the full error message
import zhTWTrans from "./org/opencastproject/adminui/languages/lang-zh_TW";
import enGBTrans from "./org/opencastproject/adminui/languages/lang-en_GB.json";
import enUSTrans from "./org/opencastproject/adminui/languages/lang-en_US.json";
import daDKTrans from "./org/opencastproject/adminui/languages/lang-da_DK.json";
import deDETrans from "./org/opencastproject/adminui/languages/lang-de_DE.json";
import elGRTrans from "./org/opencastproject/adminui/languages/lang-el_GR.json";
import esESTrans from "./org/opencastproject/adminui/languages/lang-es_ES.json";
import frFRTrans from "./org/opencastproject/adminui/languages/lang-fr_FR.json";
import glESTrans from "./org/opencastproject/adminui/languages/lang-gl_ES.json";
import heILTrans from "./org/opencastproject/adminui/languages/lang-he_IL.json";
import itITTrans from "./org/opencastproject/adminui/languages/lang-it_IT.json";
import nlNLTrans from "./org/opencastproject/adminui/languages/lang-nl_NL.json";
import plPLTrans from "./org/opencastproject/adminui/languages/lang-pl_PL.json";
import slSITrans from "./org/opencastproject/adminui/languages/lang-sl_SI.json";
import svSETrans from "./org/opencastproject/adminui/languages/lang-sv_SE.json";
import trTRTrans from "./org/opencastproject/adminui/languages/lang-tr_TR.json";
import zhCNTrans from "./org/opencastproject/adminui/languages/lang-zh_CN.json";
import zhTWTrans from "./org/opencastproject/adminui/languages/lang-zh_TW.json";

// Assignment of language code to translation file
// !!! If translation file of a new language is added, please add assignment here, too !!!
Expand All @@ -61,7 +44,7 @@ const resources = {
tr: { translation: trTRTrans },
"zh-CN": { translation: zhCNTrans },
"zh-TW": { translation: zhTWTrans },
};
} as const;

// Configuration of i18next
i18n
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/* Language and Environment */
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"jsx": "react-jsx", /* Specify what JSX code is generated. */
"jsx": "react-jsx", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
Expand All @@ -38,12 +38,12 @@
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "resolveJsonModule": true, /* Enable importing .json files. */
"resolveJsonModule": true, /* Enable importing .json files. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */

/* JavaScript Support */
"allowJs": false, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
"checkJs": false, /* Enable error reporting in type-checked JavaScript files. */
"allowJs": false, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
"checkJs": false, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */

/* Emit */
Expand Down

0 comments on commit b817e4c

Please sign in to comment.