Skip to content

Commit

Permalink
fix(deps): update dependency i18next to v22 (#40)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency i18next to v22

* fix: update react-i18next to get typescript types

* chore: remove enzyme

* fix: fix typescript issue with i18next translate function

* chore: update boilerplate version

* chore: add i18next packages as peer dependencies

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Erik Slovak <erik.slovak@technologystudio.sk>
Co-authored-by: Rostislav Simonik <rostislav.simonik@technologystudio.sk>
  • Loading branch information
3 people committed Oct 24, 2022
1 parent 95205b9 commit 72469de
Show file tree
Hide file tree
Showing 5 changed files with 315 additions and 867 deletions.
2 changes: 1 addition & 1 deletion .boilerplate-version
@@ -1 +1 @@
b1ff5972e107940d3fdf6c5fd9aeafedd0a757ea
f60e4a5898c2d6e29d6f6329511c2fb1cc97c43f
5 changes: 0 additions & 5 deletions __tests__/Setup.ts
Expand Up @@ -4,13 +4,8 @@
* @Copyright: Technology Studio
**/

import { configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'

import './Config/LogConfig'

configure({ adapter: new Adapter() })

// Mock your external modules here if needed
// jest
// .mock('package', () => {
Expand Down
14 changes: 7 additions & 7 deletions package.json
Expand Up @@ -38,23 +38,23 @@
"@txo/types": "^1.3.0",
"numbro": "^2.3.6"
},
"peerDependencies": {
"i18next": "^22.0.2",
"react-i18next": "^12.0.0"
},
"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@txo-peer-dep/log": "^4.0.0",
"@txo/log-console": "^3.0.0",
"@types/enzyme": "^3.10.12",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/jest": "^29.2.0",
"@types/react": "^18.0.20",
"@types/react": "^18.0.21",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.40.1",
"commitizen": "^4.2.5",
"concurrently": "^7.5.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "^8.26.0",
"eslint-config-txo-typescript-react": "^1.0.16",
"eslint-formatter-pretty": "^4.1.0",
Expand All @@ -65,12 +65,12 @@
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.31.10",
"husky": "^8.0.1",
"i18next": "^21.10.0",
"i18next": "^22.0.2",
"jest": "^29.2.1",
"lint-staged": "^13.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^11.18.6",
"react-i18next": "^12.0.0",
"rimraf": "^3.0.2",
"semantic-release": "^19.0.5",
"semantic-release-slack-bot": "^3.5.3",
Expand Down
16 changes: 9 additions & 7 deletions src/Api/I18nInit.ts
Expand Up @@ -42,13 +42,15 @@ export const i18nInit = async (): Promise<TFunction> => {

const originalT = i18next.t
i18next.t = function (...arg: Parameters<typeof originalT>) {
const translation: string | null = originalT.apply(this, arg) as string | null
return configManager.config.displayLocalizationIssues
? translation
: translation?.startsWith('#')
? translation.substr(1)
: translation
}
const translation = originalT(...arg)
return typeof translation === 'string'
? configManager.config.displayLocalizationIssues
? translation
: translation?.startsWith('#')
? translation.substring(1)
: translation
: translation
} as TFunction

i18next.toNumber = (number: number, format: Record<string, unknown>) => (
numbro(number).format(format)
Expand Down

0 comments on commit 72469de

Please sign in to comment.