Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"graphql": "^16.6.0",
"graphql-middleware": "^6.1.33",
"graphql-shield": "^7.6.3",
"i18next": "^20.3.1",
"i18next": "^25.3.2",
"jsonwebtoken": "^8.5.1",
"node-fetch": "^3.3.2",
"object-hash": "^2.2.0",
Expand Down
14 changes: 5 additions & 9 deletions packages/backend/src/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18next, { TFunctionResult, TOptions } from 'i18next'
import i18next, { TOptions } from 'i18next'
import { EmailTranslations, PrintTranslations } from '@lara/api'

import { GermanTranslations } from './de'
Expand Down Expand Up @@ -46,17 +46,13 @@ i18next.init({
},
})

export type TFunction = <TResult extends TFunctionResult = string>(
key: string,
lng?: string,
params?: TOptions
) => TResult
export type TFunction = <TResult = string | object>(key: string, lng?: string, params?: TOptions) => TResult

export const t: TFunction = (key, lng, params) => {
return i18next.t(key, { lng: lng ?? 'de', ...params })
export const t = <TResult = string | object>(key: string, lng?: string, params?: TOptions): TResult => {
return i18next.t(key, { lng: lng ?? 'de', ...params }) as unknown as TResult
}

type SimpleTFuntion = <TResult extends TFunctionResult = string>(key: string, params?: TOptions) => TResult
type SimpleTFuntion = <TResult = string | object>(key: string, params?: TOptions) => TResult

export const createT = (lng?: string): SimpleTFuntion => {
return (key, params) => t(key, lng, params)
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/resolvers/trainee.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export const traineeTraineeResolver: GqlResolvers<TraineeContext> = {
const reportsData = filteredReports.map((report) => createPrintReportData(report, currentUser))

const userData = await createPrintUserData(currentUser)
const printTranslations: PrintTranslations = t('print', currentUser.language)
const emailTranslations: EmailTranslations = t('email', currentUser.language)
const printTranslations = t<PrintTranslations>('print', currentUser.language)
const emailTranslations = t<EmailTranslations>('email', currentUser.language)

const hash = await savePrintData({
reportsData,
Expand Down
4 changes: 1 addition & 3 deletions packages/frontend/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// @ts-check


const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const createStyledComponentsTransformer = require('typescript-plugin-styled-components').default
const path = require('path')
const dotenv = require('dotenv')


const {
MICROSOFT_CLIENT_ID,
Expand Down Expand Up @@ -120,7 +118,7 @@ const webpackConfig = () => {
plugins: [
new webpack.DefinePlugin({
ENVIRONMENT: JSON.stringify(getEnvironmentConfig()),

REVISION: JSON.stringify(require(__dirname + '/scripts/get-revision')()),

TAG: JSON.stringify(process.env.LARA_VERSION),
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@
dependencies:
"@babel/helper-plugin-utils" "^7.27.1"

"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.9":
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.9", "@babel/runtime@^7.27.6":
version "7.28.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.2.tgz#2ae5a9d51cc583bd1f5673b3bb70d6d819682473"
integrity sha512-KHp2IflsnGywDjBWDkR9iEqiWSpc8GIi0lgTT3mOElT0PP1tG26P4tmFI2YvAdzgq9RGyoHZQEIEdZy6Ec5xCA==
Expand Down Expand Up @@ -10561,12 +10561,12 @@ husky@^4.3.0:
slash "^3.0.0"
which-pm-runs "^1.0.0"

i18next@^20.3.1:
version "20.6.1"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-20.6.1.tgz#535e5f6e5baeb685c7d25df70db63bf3cc0aa345"
integrity sha512-yCMYTMEJ9ihCwEQQ3phLo7I/Pwycf8uAx+sRHwwk5U9Aui/IZYgQRyMqXafQOw5QQ7DM1Z+WyEXWIqSuJHhG2A==
i18next@^25.3.2:
version "25.3.2"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-25.3.2.tgz#3d6a7d1dc058caa1b9bdca47fd585483e2e7a637"
integrity sha512-JSnbZDxRVbphc5jiptxr3o2zocy5dEqpVm9qCGdJwRNO+9saUJS0/u4LnM/13C23fUEWxAylPqKU/NpMV/IjqA==
dependencies:
"@babel/runtime" "^7.12.0"
"@babel/runtime" "^7.27.6"

iconv-lite@0.4.24, iconv-lite@^0.4.24:
version "0.4.24"
Expand Down