Add i18n to service worker
This commit is contained in:
		
							parent
							
								
									2dcad150eb
								
							
						
					
					
						commit
						83eb4c39e5
					
				
					 4 changed files with 14 additions and 7 deletions
				
			
		|  | @ -18,10 +18,10 @@ import routes from "./routes"; | |||
| import { useAccountListener, useBackgroundProcesses, useConnectionListeners } from "./hooks"; | ||||
| import PublishDialog from "./PublishDialog"; | ||||
| import Messaging from "./Messaging"; | ||||
| import "./i18n"; // Translations! | ||||
| import Login from "./Login"; | ||||
| import Signup from "./Signup"; | ||||
| import Account from "./Account"; | ||||
| import "../app/i18n"; // Translations! | ||||
| 
 | ||||
| export const AccountContext = createContext(null); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,29 +0,0 @@ | |||
| import i18n from "i18next"; | ||||
| import Backend from "i18next-http-backend"; | ||||
| import LanguageDetector from "i18next-browser-languagedetector"; | ||||
| import { initReactI18next } from "react-i18next"; | ||||
| 
 | ||||
| // Translations using i18next | ||||
| // - Options: https://www.i18next.com/overview/configuration-options | ||||
| // - Browser Language Detector: https://github.com/i18next/i18next-browser-languageDetector | ||||
| // - HTTP Backend (load files via fetch): https://github.com/i18next/i18next-http-backend | ||||
| // | ||||
| // See example project here: | ||||
| // https://github.com/i18next/react-i18next/tree/master/example/react | ||||
| 
 | ||||
| i18n | ||||
|   .use(Backend) | ||||
|   .use(LanguageDetector) | ||||
|   .use(initReactI18next) | ||||
|   .init({ | ||||
|     fallbackLng: "en", | ||||
|     debug: true, | ||||
|     interpolation: { | ||||
|       escapeValue: false, // not needed for react as it escapes by default | ||||
|     }, | ||||
|     backend: { | ||||
|       loadPath: "/static/langs/{{lng}}.json", | ||||
|     }, | ||||
|   }); | ||||
| 
 | ||||
| export default i18n; | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue