Skip to content

Commit

Permalink
Merge pull request #1021 from internxt/bugfix/remove-language-detector
Browse files Browse the repository at this point in the history
[_]: bugfix/ Removed i18next language detector
  • Loading branch information
CandelR authored Feb 7, 2024
2 parents ec827a0 + dc7dcf2 commit 036a7f5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 20 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"history": "^4.10.1",
"https-browserify": "^1.0.0",
"i18next": "^22.4.9",
"i18next-browser-languagedetector": "^7.2.0",
"idb": "^6.1.5",
"js-file-download": "^0.4.12",
"jszip": "=3.2.2",
Expand Down
3 changes: 1 addition & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { LRUFilesPreviewCacheManager } from './app/database/services/database.se
import { LRUPhotosPreviewsCacheManager } from './app/database/services/database.service/LRUPhotosPreviewCacheManager';
import { LRUPhotosCacheManager } from './app/database/services/database.service/LRUPhotosCacheManager';
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
import i18next, { t } from 'i18next';
import { t } from 'i18next';
import authService from './app/auth/services/auth.service';
import localStorageService from './app/core/services/local-storage.service';
import Mobile from './app/drive/views/MobileView/MobileView';
Expand Down Expand Up @@ -58,7 +58,6 @@ const App = (props: AppProps): JSX.Element => {

useEffect(() => {
initialState();
i18next.changeLanguage();
}, []);

if ((token && skipSignupIfLoggedIn) || (token && navigationService.history.location.pathname !== '/new')) {
Expand Down
5 changes: 2 additions & 3 deletions src/app/i18n/services/i18n.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { initReactI18next } from 'react-i18next';
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import localStorageService from 'app/core/services/local-storage.service';
import envService from 'app/core/services/env.service';
import es from 'dayjs/locale/es';
Expand All @@ -27,7 +26,6 @@ const deviceLang = localStorageService.get('language') || navigator.language.spl
dayjs.locale(dayJsLocale[deviceLang] || 'en');

export default i18next
.use(LanguageDetector)
.use(initReactI18next) // passes i18n down to react-i18next
.init({
resources: {
Expand Down Expand Up @@ -55,8 +53,9 @@ export default i18next
},
debug: !envService.isProduction(),
fallbackLng: 'en',
lng: deviceLang,
detection: {
order: ['querystring', 'cookie', 'navigator', 'localStorage'],
order: ['navigator', 'localStorage'],
caches: ['localStorage'],
},
defaultNS: 'translation',
Expand Down
14 changes: 0 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1138,13 +1138,6 @@
dependencies:
regenerator-runtime "^0.14.0"

"@babel/runtime@^7.23.2":
version "7.23.9"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.9.tgz#47791a15e4603bb5f905bc0753801cf21d6345f7"
integrity sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==
dependencies:
regenerator-runtime "^0.14.0"

"@babel/template@^7.22.15", "@babel/template@^7.22.5", "@babel/template@^7.3.3":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38"
Expand Down Expand Up @@ -7151,13 +7144,6 @@ husky@^7.0.2:
resolved "https://registry.yarnpkg.com/husky/-/husky-7.0.4.tgz#242048245dc49c8fb1bf0cc7cfb98dd722531535"
integrity sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==

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@^22.4.9:
version "22.5.1"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-22.5.1.tgz#99df0b318741a506000c243429a7352e5f44d424"
Expand Down

0 comments on commit 036a7f5

Please sign in to comment.