📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
added localisation files cache breaker
Blue Mousebea0fab6a86f
diff --git a/app/entry.client.tsx b/app/entry.client.tsxindex cf19f8326..c7689faf5 100644--- a/app/entry.client.tsx+++ b/app/entry.client.tsx@@ -8,6 +8,7 @@ import LanguageDetector from 'i18next-browser-languagedetector'import HTTPBackend from 'i18next-http-backend'import { getInitialNamespaces } from 'remix-i18next/client'import i18n from './i18n'+import { I18N_CACHE_BREAKER } from 'redux/constants'async function hydrate() {await i18next@@ -17,7 +18,7 @@ async function hydrate() {.init({...i18n,ns: getInitialNamespaces(),- backend: { loadPath: '/locales/{{lng}}.json' },+ backend: { loadPath: `/locales/{{lng}}.json?cv=${I18N_CACHE_BREAKER}` },detection: {order: ['htmlTag'],caches: ['cookie'],diff --git a/app/i18n.ts b/app/i18n.tsindex a1ac86c58..d52cfd5e1 100644--- a/app/i18n.ts+++ b/app/i18n.ts@@ -1,7 +1,7 @@import { InitOptions } from 'i18next'import _includes from 'lodash/includes'-import { defaultLanguage, whitelist } from 'redux/constants'+import { defaultLanguage, I18N_CACHE_BREAKER, whitelist } from 'redux/constants'const genericConfig: InitOptions = {supportedLngs: whitelist,@@ -9,7 +9,7 @@ const genericConfig: InitOptions = {defaultNS: 'common',react: { useSuspense: false },backend: {- loadPath: '/locales/{{lng}}.json',+ loadPath: `/locales/{{lng}}.json?cv=${I18N_CACHE_BREAKER}`,},interpolation: {escapeValue: false,diff --git a/app/redux/constants/index.ts b/app/redux/constants/index.tsindex 66a823c47..f72eb4e6e 100644--- a/app/redux/constants/index.ts+++ b/app/redux/constants/index.ts@@ -481,6 +481,10 @@ export const paddleLanguageMapping: IStringObject = {uk: 'en',}+// Increase this counter every time some major change is done within localisation files+// This will prevent cached version or raw locale strings being displayed in production+export const I18N_CACHE_BREAKER = 1+// dashboard && projectsexport const roles: string[] = ['admin', 'viewer']diff --git a/app/root.tsx b/app/root.tsxindex 68e807a65..3896add6a 100644--- a/app/root.tsx+++ b/app/root.tsx@@ -13,7 +13,7 @@ import {useRouteError,} from '@remix-run/react'import { store } from 'redux/store'-import { isBrowser, CONTACT_EMAIL, LS_THEME_SETTING, isSelfhosted } from 'redux/constants'+import { isBrowser, CONTACT_EMAIL, LS_THEME_SETTING, isSelfhosted, I18N_CACHE_BREAKER } from 'redux/constants'import { getCookie, generateCookieString } from 'utils/cookie'import { ExclamationTriangleIcon, ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'import { Provider } from 'react-redux'@@ -251,7 +251,7 @@ export default function App() {<LocaleLinks /><linkrel='preload'- href={`/locales/${locale}.json`}+ href={`/locales/${locale}.json?cv=${I18N_CACHE_BREAKER}`}as='fetch'type='application/json'crossOrigin='anonymous'