Skip to content

Commit

Permalink
front: add version parameter to translations load path
Browse files Browse the repository at this point in the history
That way, every time we release a new OSRD version, we force
browsers to refresh translation files. This is similar to the hash
inserted in JS/CSS filenames by vite.

Signed-off-by: Simon Ser <[email protected]>
Closes: #9965
  • Loading branch information
emersion committed Jan 21, 2025
1 parent 88691e7 commit 2950b2f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions front/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { initReactI18next } from 'react-i18next';
// Official languages codes to use from IANA
// https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry

const version = encodeURIComponent(import.meta.env.VITE_OSRD_GIT_DESCRIBE);

i18n
.use(Backend)
.use(initReactI18next)
Expand All @@ -20,6 +22,9 @@ i18n
react: {
useSuspense: false,
},
backend: {
loadPath: `/locales/{{lng}}/{{ns}}.json?v=${version}`,
},
});

// Errors namespace must be initialized so t function
Expand Down

0 comments on commit 2950b2f

Please sign in to comment.