Skip to content

Commit

Permalink
Auto detect and set language
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Nov 26, 2023
1 parent f1f0aeb commit 15b046a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
"firebase": "^7.24.0",
"graphql": "^15.3.0",
"i18next": "^23.7.6",
"i18next-browser-languagedetector": "^7.2.0",
"isomorphic-fetch": "^3.0.0",
"jsonic": "^0.3.0",
"jszip": "3.8.0",
Expand Down
19 changes: 11 additions & 8 deletions src/browser/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import i18n from 'i18next'
import { resources } from 'neo4j-arc/graph-visualization'
import { initReactI18next } from 'react-i18next'
import { resources } from 'neo4j-arc/graph-visualization'
import LanguageDetector from 'i18next-browser-languagedetector'

i18n.use(initReactI18next).init({
resources,
lng: 'zh',
interpolation: {
escapeValue: false
}
})
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources,
interpolation: {
escapeValue: false
}
})

export default i18n
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7357,6 +7357,13 @@ hyphenate-style-name@^1.0.2:
resolved "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz"
integrity sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==

i18next-browser-languagedetector@^7.2.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.2.0.tgz#de0321cba6881be37d82e20e4d6f05aa75f6e37f"
integrity sha512-U00DbDtFIYD3wkWsr2aVGfXGAj2TgnELzOX9qv8bT0aJtvPV9CRO77h+vgmHFBMe7LAxdwvT/7VkCWGya6L3tA==
dependencies:
"@babel/runtime" "^7.23.2"

i18next@^23.7.6:
version "23.7.6"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-23.7.6.tgz#7328e76c899052d5d33d930164612dd21e575f74"
Expand Down

0 comments on commit 15b046a

Please sign in to comment.