-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from jy95/classes
feat: allow users to configure their own backend(s) for translations
- Loading branch information
Showing
10 changed files
with
315 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
slug: empowerment | ||
title: Customizing i18next Configuration in Our Library | ||
authors: [jy95] | ||
tags: [features] | ||
--- | ||
|
||
We're thrilled to announce a new feature in our library that empowers users to tailor i18next configuration to their preferences. | ||
i18next, the internationalization framework, plays a crucial role in facilitating multilingual support. Now, with this enhancement, users have greater control over how i18next behaves within our system. | ||
|
||
Benefits : | ||
|
||
- **Flexibility** : Users can adapt i18next settings to suit their project's needs, ensuring a seamless internationalization experience. | ||
- **Customization** : Fine-tune language-related functionalities, such as pluralization rules or date formatting, to match project specifications. | ||
- **Ease of Integration** : Our library seamlessly integrates with existing i18next workflows, minimizing implementation hurdles. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
description: Control the display order used by the algorithm (Useful when you want to turn on / off some specific rules for some reason) | ||
title: 🔢 displayOrder | ||
--- | ||
|
||
import CodeBlock from "@theme/CodeBlock"; | ||
import Schema from "@site/static/dosages/examples/medicationrequest/medrx004.json"; | ||
import Tabs from "@theme/Tabs"; | ||
import TabItem from "@theme/TabItem"; | ||
import MultipleDosagesToText from "@site/src/components/multiple_dosage_to_text"; | ||
|
||
<Tabs> | ||
<TabItem value="text" label="Human readable text" default> | ||
<MultipleDosagesToText dosages={Schema} config={{ displayOrder: ["method", "doseQuantity", "doseRange", "rateRatio", "rateQuantity", "rateRange", "durationDurationMax", "frequencyFrequencyMaxPeriodPeriodMax", "offsetWhen", "dayOfWeek", "timeOfDay", "asNeeded", "boundsDuration", "boundsPeriod", "boundsRange", "countCountMax", "event", "code", "maxDosePerPeriod", "maxDosePerAdministration", "maxDosePerLifetime", "additionalInstruction", "patientInstruction", "route", "site"] }} /> | ||
</TabItem> | ||
<TabItem value="json" label="Dosage"> | ||
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock> | ||
</TabItem> | ||
<TabItem value="config" label="Configuration"> | ||
```js | ||
{ | ||
"displayOrder": ["method", "doseQuantity", "doseRange", "rateRatio", "rateQuantity", "rateRange", "durationDurationMax", "frequencyFrequencyMaxPeriodPeriodMax", "offsetWhen", "dayOfWeek", "timeOfDay", "asNeeded", "boundsDuration", "boundsPeriod", "boundsRange", "countCountMax", "event", "code", "maxDosePerPeriod", "maxDosePerAdministration", "maxDosePerLifetime", "additionalInstruction", "patientInstruction", "route", "site"] | ||
} | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
description: Override separator between each part of "Dosage" | ||
title: ➖ displaySeparator | ||
--- | ||
|
||
import CodeBlock from "@theme/CodeBlock"; | ||
import Schema from "@site/static/dosages/examples/medicationrequest/medrx004.json"; | ||
import Tabs from "@theme/Tabs"; | ||
import TabItem from "@theme/TabItem"; | ||
import MultipleDosagesToText from "@site/src/components/multiple_dosage_to_text"; | ||
|
||
<Tabs> | ||
<TabItem value="text" label="Human readable text" default> | ||
<MultipleDosagesToText dosages={Schema} config={{ displaySeparator: " | " }} /> | ||
</TabItem> | ||
<TabItem value="json" label="Dosage"> | ||
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock> | ||
</TabItem> | ||
<TabItem value="config" label="Configuration"> | ||
```js | ||
{ | ||
displaySeparator: " | " | ||
} | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
|
||
<Tabs> | ||
<TabItem value="text" label="Human readable text" default> | ||
<SingleDosageToText | ||
dosage={Schema} | ||
/> | ||
|
||
</TabItem> | ||
<TabItem value="json" label="Dosage"> | ||
<CodeBlock language="json">{JSON.stringify(Schema, null, 2)}</CodeBlock> | ||
</TabItem> | ||
<TabItem value="config" label="i18nConfig"> | ||
```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 | ||
} | ||
} | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.