From 979c6b3f2f1967cc9565badf0f75855842571edf Mon Sep 17 00:00:00 2001 From: jy95 Date: Sat, 20 Apr 2024 15:52:15 +0200 Subject: [PATCH] docs: i18nConfig --- documentation/docs/custom/i18nConfig.mdx | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 documentation/docs/custom/i18nConfig.mdx diff --git a/documentation/docs/custom/i18nConfig.mdx b/documentation/docs/custom/i18nConfig.mdx new file mode 100644 index 00000000..0f762b33 --- /dev/null +++ b/documentation/docs/custom/i18nConfig.mdx @@ -0,0 +1,48 @@ +--- +description: Options for the i18next instances +title: 🌐 i18nConfig +--- + +import CodeBlock from "@theme/CodeBlock"; +import Schema from "@site/static/dosages/specs/boundsDuration/common.json"; +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import SingleDosageToText from "@site/src/components/single_dosage_to_text"; + + + + + + + + {JSON.stringify(Schema, null, 2)} + + + ```js + import LocalStorageBackend from 'i18next-localstorage-backend'; // load from local storage + import HttpApi from 'i18next-http-backend'; // have a own http fallback + + { + backend: { + backends: [ + LocalStorageBackend, // primary + HttpApi // fallback + ], + backendOptions: [{ + projectId: 'myLocizeProjectId' + }, { + loadPath: '/locales/{{lng}}/{{ns}}.json' // http api load path for my own fallback + }], + // cacheHitMode: 'none' // (default) + // cacheHitMode: 'refresh' // tries to refresh the cache by loading from the next backend and updates the cache + // cacheHitMode: 'refreshAndUpdateStore' // tries to refresh the cache by loading from the next backend, updates the cache and also update the i18next resource store + // reloadInterval: 60 * 60 * 1000 // can be used to reload resources in a specific interval (useful in server environments) + // refreshExpirationTime: 7 * 24 * 60 * 60 * 1000 // In case of caching with 'refresh' or 'refreshAndUpdateStore', it will only fetch from the next backend if the cached namespace is expired. Only supported if the backend returns the saved timestamp, like i18next-fs-backend, i18next-localstorage-backend + } + } + ``` + + +