@navikt/ds-react 7.7.0 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/chips/Removable.d.ts +0 -5
- package/cjs/chips/Removable.js +2 -2
- package/cjs/chips/Removable.js.map +1 -1
- package/cjs/date/context/index.d.ts +2 -1
- package/cjs/date/context/index.js +5 -2
- package/cjs/date/context/index.js.map +1 -1
- package/cjs/date/context/useDateInputContext.d.ts +3 -3
- package/cjs/date/context/useDateInputContext.js +4 -4
- package/cjs/date/context/useDateInputContext.js.map +1 -1
- package/cjs/date/context/useDateTranslationContext.d.ts +8 -0
- package/cjs/date/context/useDateTranslationContext.js +7 -0
- package/cjs/date/context/useDateTranslationContext.js.map +1 -0
- package/cjs/date/datepicker/DatePicker.js +18 -16
- package/cjs/date/datepicker/DatePicker.js.map +1 -1
- package/cjs/date/datepicker/DatePickerStandalone.js +17 -14
- package/cjs/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/cjs/date/datepicker/parts/Caption.js +2 -3
- package/cjs/date/datepicker/parts/Caption.js.map +1 -1
- package/cjs/date/datepicker/parts/DropdownCaption.js +2 -2
- package/cjs/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/cjs/date/datepicker/parts/WeekNumber.js +3 -4
- package/cjs/date/datepicker/parts/WeekNumber.js.map +1 -1
- package/cjs/date/datepicker/parts/WeekRow.js +2 -3
- package/cjs/date/datepicker/parts/WeekRow.js.map +1 -1
- package/cjs/date/datepicker/types.d.ts +8 -0
- package/cjs/date/monthpicker/MonthCaption.js +1 -3
- package/cjs/date/monthpicker/MonthCaption.js.map +1 -1
- package/cjs/date/monthpicker/MonthPicker.js +30 -28
- package/cjs/date/monthpicker/MonthPicker.js.map +1 -1
- package/cjs/date/monthpicker/MonthPickerStandalone.js +16 -12
- package/cjs/date/monthpicker/MonthPickerStandalone.js.map +1 -1
- package/cjs/date/monthpicker/types.d.ts +8 -0
- package/cjs/date/parts/DateInput.js +1 -2
- package/cjs/date/parts/DateInput.js.map +1 -1
- package/cjs/date/parts/DateWrapper.d.ts +3 -1
- package/cjs/date/parts/DateWrapper.js +3 -3
- package/cjs/date/parts/DateWrapper.js.map +1 -1
- package/cjs/date/utils/index.d.ts +1 -1
- package/cjs/date/utils/index.js +2 -1
- package/cjs/date/utils/index.js.map +1 -1
- package/cjs/date/utils/locale.d.ts +12 -2
- package/cjs/date/utils/locale.js +18 -2
- package/cjs/date/utils/locale.js.map +1 -1
- package/cjs/form/combobox/Combobox.d.ts +1 -1
- package/cjs/form/combobox/ComboboxWrapper.js +6 -6
- package/cjs/form/combobox/ComboboxWrapper.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +4 -4
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptionsItem.js +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptionsItem.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/MaxSelectedMessage.d.ts +1 -1
- package/cjs/form/combobox/FilteredOptions/MaxSelectedMessage.js +2 -5
- package/cjs/form/combobox/FilteredOptions/MaxSelectedMessage.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +4 -4
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/cjs/form/combobox/Input/Input.js +1 -1
- package/cjs/form/combobox/Input/Input.js.map +1 -1
- package/cjs/form/combobox/Input/InputController.d.ts +1 -1
- package/cjs/form/combobox/Input/InputController.js +7 -9
- package/cjs/form/combobox/Input/InputController.js.map +1 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +2 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +9 -5
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/cjs/form/combobox/types.d.ts +7 -17
- package/cjs/form/search/Search.d.ts +2 -1
- package/cjs/form/search/Search.js.map +1 -1
- package/cjs/form/textarea/Textarea.d.ts +1 -0
- package/cjs/form/textarea/Textarea.js.map +1 -1
- package/cjs/guide-panel/GuidePanel.js +11 -3
- package/cjs/guide-panel/GuidePanel.js.map +1 -1
- package/cjs/guide-panel/Illustration.d.ts +2 -8
- package/cjs/guide-panel/Illustration.darkside.d.ts +2 -0
- package/cjs/guide-panel/Illustration.darkside.js +30 -0
- package/cjs/guide-panel/Illustration.darkside.js.map +1 -0
- package/cjs/guide-panel/Illustration.js +2 -18
- package/cjs/guide-panel/Illustration.js.map +1 -1
- package/cjs/guide-panel/index.d.ts +0 -1
- package/cjs/guide-panel/index.js +1 -3
- package/cjs/guide-panel/index.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +2 -3
- package/cjs/index.js.map +1 -1
- package/cjs/modal/Modal.js +1 -1
- package/cjs/modal/Modal.js.map +1 -1
- package/cjs/modal/ModalHeader.js +1 -1
- package/cjs/modal/ModalHeader.js.map +1 -1
- package/cjs/popover/Popover.js +1 -1
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/provider/Provider.d.ts +35 -10
- package/cjs/provider/Provider.js +13 -14
- package/cjs/provider/Provider.js.map +1 -1
- package/cjs/table/ExpandableRow.js +3 -3
- package/cjs/table/ExpandableRow.js.map +1 -1
- package/cjs/tabs/Tabs.context.d.ts +1 -1
- package/cjs/timeline/Timeline.d.ts +1 -0
- package/cjs/timeline/Timeline.js.map +1 -1
- package/cjs/util/i18n/i18n.context.d.ts +1 -1
- package/cjs/util/i18n/i18n.context.js +15 -14
- package/cjs/util/i18n/i18n.context.js.map +1 -1
- package/cjs/util/i18n/locales/en.d.ts +50 -54
- package/cjs/util/i18n/locales/en.js +52 -56
- package/cjs/util/i18n/locales/en.js.map +1 -1
- package/cjs/util/i18n/locales/index.d.ts +3 -0
- package/cjs/util/i18n/locales/index.js +14 -0
- package/cjs/util/i18n/locales/index.js.map +1 -0
- package/cjs/util/i18n/locales/nb.d.ts +53 -57
- package/cjs/util/i18n/locales/nb.js +56 -60
- package/cjs/util/i18n/locales/nb.js.map +1 -1
- package/cjs/util/i18n/locales/nn.d.ts +50 -54
- package/cjs/util/i18n/locales/nn.js +52 -56
- package/cjs/util/i18n/locales/nn.js.map +1 -1
- package/esm/chips/Removable.d.ts +0 -5
- package/esm/chips/Removable.js +2 -2
- package/esm/chips/Removable.js.map +1 -1
- package/esm/date/context/index.d.ts +2 -1
- package/esm/date/context/index.js +2 -1
- package/esm/date/context/index.js.map +1 -1
- package/esm/date/context/useDateInputContext.d.ts +3 -3
- package/esm/date/context/useDateInputContext.js +3 -3
- package/esm/date/context/useDateInputContext.js.map +1 -1
- package/esm/date/context/useDateTranslationContext.d.ts +8 -0
- package/esm/date/context/useDateTranslationContext.js +3 -0
- package/esm/date/context/useDateTranslationContext.js.map +1 -0
- package/esm/date/datepicker/DatePicker.js +21 -19
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/DatePickerStandalone.js +19 -16
- package/esm/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/esm/date/datepicker/parts/Caption.js +2 -3
- package/esm/date/datepicker/parts/Caption.js.map +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js +3 -3
- package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/esm/date/datepicker/parts/WeekNumber.js +3 -4
- package/esm/date/datepicker/parts/WeekNumber.js.map +1 -1
- package/esm/date/datepicker/parts/WeekRow.js +2 -3
- package/esm/date/datepicker/parts/WeekRow.js.map +1 -1
- package/esm/date/datepicker/types.d.ts +8 -0
- package/esm/date/monthpicker/MonthCaption.js +2 -4
- package/esm/date/monthpicker/MonthCaption.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.js +33 -31
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/date/monthpicker/MonthPickerStandalone.js +18 -14
- package/esm/date/monthpicker/MonthPickerStandalone.js.map +1 -1
- package/esm/date/monthpicker/types.d.ts +8 -0
- package/esm/date/parts/DateInput.js +2 -3
- package/esm/date/parts/DateInput.js.map +1 -1
- package/esm/date/parts/DateWrapper.d.ts +3 -1
- package/esm/date/parts/DateWrapper.js +4 -4
- package/esm/date/parts/DateWrapper.js.map +1 -1
- package/esm/date/utils/index.d.ts +1 -1
- package/esm/date/utils/index.js +1 -1
- package/esm/date/utils/index.js.map +1 -1
- package/esm/date/utils/locale.d.ts +12 -2
- package/esm/date/utils/locale.js +16 -1
- package/esm/date/utils/locale.js.map +1 -1
- package/esm/form/combobox/Combobox.d.ts +1 -1
- package/esm/form/combobox/ComboboxWrapper.js +6 -6
- package/esm/form/combobox/ComboboxWrapper.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +4 -4
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptionsItem.js +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptionsItem.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/MaxSelectedMessage.d.ts +1 -1
- package/esm/form/combobox/FilteredOptions/MaxSelectedMessage.js +2 -5
- package/esm/form/combobox/FilteredOptions/MaxSelectedMessage.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +4 -4
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/Input/InputController.d.ts +1 -1
- package/esm/form/combobox/Input/InputController.js +7 -9
- package/esm/form/combobox/Input/InputController.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +2 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +9 -5
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/combobox/types.d.ts +7 -17
- package/esm/form/search/Search.d.ts +2 -1
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/textarea/Textarea.d.ts +1 -0
- package/esm/form/textarea/Textarea.js.map +1 -1
- package/esm/guide-panel/GuidePanel.js +11 -3
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/guide-panel/Illustration.d.ts +2 -8
- package/esm/guide-panel/Illustration.darkside.d.ts +2 -0
- package/esm/guide-panel/Illustration.darkside.js +23 -0
- package/esm/guide-panel/Illustration.darkside.js.map +1 -0
- package/esm/guide-panel/Illustration.js +2 -18
- package/esm/guide-panel/Illustration.js.map +1 -1
- package/esm/guide-panel/index.d.ts +0 -1
- package/esm/guide-panel/index.js +0 -1
- package/esm/guide-panel/index.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/modal/Modal.js +2 -2
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/ModalHeader.js +1 -1
- package/esm/modal/ModalHeader.js.map +1 -1
- package/esm/popover/Popover.js +2 -2
- package/esm/popover/Popover.js.map +1 -1
- package/esm/provider/Provider.d.ts +35 -10
- package/esm/provider/Provider.js +11 -15
- package/esm/provider/Provider.js.map +1 -1
- package/esm/table/ExpandableRow.js +3 -3
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/tabs/Tabs.context.d.ts +1 -1
- package/esm/timeline/Timeline.d.ts +1 -0
- package/esm/timeline/Timeline.js.map +1 -1
- package/esm/util/i18n/i18n.context.d.ts +1 -1
- package/esm/util/i18n/i18n.context.js +15 -14
- package/esm/util/i18n/i18n.context.js.map +1 -1
- package/esm/util/i18n/locales/en.d.ts +50 -54
- package/esm/util/i18n/locales/en.js +52 -56
- package/esm/util/i18n/locales/en.js.map +1 -1
- package/esm/util/i18n/locales/index.d.ts +3 -0
- package/esm/util/i18n/locales/index.js +5 -0
- package/esm/util/i18n/locales/index.js.map +1 -0
- package/esm/util/i18n/locales/nb.d.ts +53 -57
- package/esm/util/i18n/locales/nb.js +56 -60
- package/esm/util/i18n/locales/nb.js.map +1 -1
- package/esm/util/i18n/locales/nn.d.ts +50 -54
- package/esm/util/i18n/locales/nn.js +52 -56
- package/esm/util/i18n/locales/nn.js.map +1 -1
- package/package.json +13 -3
- package/src/chips/Removable.tsx +1 -9
- package/src/date/context/index.ts +5 -1
- package/src/date/context/useDateInputContext.tsx +6 -4
- package/src/date/context/useDateTranslationContext.ts +9 -0
- package/src/date/datepicker/DatePicker.tsx +41 -32
- package/src/date/datepicker/DatePickerStandalone.tsx +46 -37
- package/src/date/datepicker/parts/Caption.tsx +2 -3
- package/src/date/datepicker/parts/DropdownCaption.tsx +3 -3
- package/src/date/datepicker/parts/WeekNumber.tsx +3 -9
- package/src/date/datepicker/parts/WeekRow.tsx +2 -3
- package/src/date/datepicker/types.ts +8 -0
- package/src/date/monthpicker/MonthCaption.tsx +2 -4
- package/src/date/monthpicker/MonthPicker.tsx +67 -54
- package/src/date/monthpicker/MonthPickerStandalone.tsx +39 -26
- package/src/date/monthpicker/types.ts +8 -0
- package/src/date/parts/DateInput.tsx +2 -3
- package/src/date/parts/DateWrapper.tsx +6 -4
- package/src/date/utils/index.ts +5 -1
- package/src/date/utils/locale.ts +17 -1
- package/src/form/combobox/ComboboxWrapper.tsx +6 -6
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +4 -4
- package/src/form/combobox/FilteredOptions/FilteredOptionsItem.tsx +1 -1
- package/src/form/combobox/FilteredOptions/MaxSelectedMessage.tsx +2 -9
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +4 -4
- package/src/form/combobox/Input/Input.context.tsx +1 -1
- package/src/form/combobox/Input/Input.tsx +1 -1
- package/src/form/combobox/Input/InputController.tsx +4 -23
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +10 -7
- package/src/form/combobox/types.ts +12 -20
- package/src/form/search/Search.tsx +2 -1
- package/src/form/textarea/Textarea.tsx +1 -0
- package/src/guide-panel/GuidePanel.tsx +59 -15
- package/src/guide-panel/Illustration.darkside.tsx +96 -0
- package/src/guide-panel/Illustration.tsx +2 -22
- package/src/guide-panel/index.ts +0 -1
- package/src/index.ts +1 -5
- package/src/modal/Modal.tsx +2 -2
- package/src/modal/ModalHeader.tsx +1 -1
- package/src/popover/Popover.tsx +2 -2
- package/src/provider/Provider.tsx +56 -13
- package/src/table/ExpandableRow.tsx +10 -3
- package/src/timeline/Timeline.tsx +1 -0
- package/src/util/i18n/i18n.context.test.tsx +29 -8
- package/src/util/i18n/i18n.context.ts +15 -14
- package/src/util/i18n/locales/en.ts +52 -56
- package/src/util/i18n/locales/index.ts +4 -0
- package/src/util/i18n/locales/nb.ts +56 -60
- package/src/util/i18n/locales/nn.ts +52 -56
- package/cjs/provider/i18n/LanguageProvider.d.ts +0 -26
- package/cjs/provider/i18n/LanguageProvider.js +0 -54
- package/cjs/provider/i18n/LanguageProvider.js.map +0 -1
- package/esm/provider/i18n/LanguageProvider.d.ts +0 -26
- package/esm/provider/i18n/LanguageProvider.js +0 -23
- package/esm/provider/i18n/LanguageProvider.js.map +0 -1
- package/src/provider/i18n/LanguageProvider.tsx +0 -49
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { renderHook } from "@testing-library/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
import
|
|
4
|
+
import { Provider } from "../../provider";
|
|
5
5
|
import { useI18n } from "./i18n.context";
|
|
6
|
+
import en from "./locales/en";
|
|
7
|
+
import nb from "./locales/nb";
|
|
6
8
|
|
|
7
9
|
describe("useI18n", () => {
|
|
8
10
|
test("should throw error if key is not found", () => {
|
|
@@ -12,13 +14,32 @@ describe("useI18n", () => {
|
|
|
12
14
|
expect(() => translate("item.nonexistentKey")).toThrowError();
|
|
13
15
|
});
|
|
14
16
|
|
|
15
|
-
test("should return the
|
|
17
|
+
test("should return the default NB translation when Provider is not used", () => {
|
|
18
|
+
const { result } = renderHook(() => useI18n("FileUpload"));
|
|
19
|
+
const translate = result.current;
|
|
20
|
+
expect(translate("item.uploading")).toBe(nb.FileUpload.item.uploading);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("should return the default translation when key is not in context object", () => {
|
|
24
|
+
const i18n = { FileUpload: { item: { downloading: "Test translation" } } };
|
|
25
|
+
const { result } = renderHook(() => useI18n("FileUpload"), {
|
|
26
|
+
wrapper: ({ children }) => (
|
|
27
|
+
<Provider locale={en} translations={i18n}>
|
|
28
|
+
{children}
|
|
29
|
+
</Provider>
|
|
30
|
+
),
|
|
31
|
+
});
|
|
32
|
+
const translate = result.current;
|
|
33
|
+
expect(translate("item.uploading")).toBe(en.FileUpload.item.uploading);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("should return the translated text from the context object", () => {
|
|
16
37
|
const i18n = { FileUpload: { item: { uploading: "Test translation" } } };
|
|
17
38
|
const { result } = renderHook(() => useI18n("FileUpload"), {
|
|
18
39
|
wrapper: ({ children }) => (
|
|
19
|
-
<
|
|
40
|
+
<Provider locale={en} translations={i18n}>
|
|
20
41
|
{children}
|
|
21
|
-
</
|
|
42
|
+
</Provider>
|
|
22
43
|
),
|
|
23
44
|
});
|
|
24
45
|
const translate = result.current;
|
|
@@ -32,9 +53,9 @@ describe("useI18n", () => {
|
|
|
32
53
|
const i18n2 = { FileUpload: { item: { uploading: "Wrong translation" } } };
|
|
33
54
|
const { result } = renderHook(() => useI18n("FileUpload"), {
|
|
34
55
|
wrapper: ({ children }) => (
|
|
35
|
-
<
|
|
56
|
+
<Provider locale={en} translations={[i18n1, i18n2]}>
|
|
36
57
|
{children}
|
|
37
|
-
</
|
|
58
|
+
</Provider>
|
|
38
59
|
),
|
|
39
60
|
});
|
|
40
61
|
const translate = result.current;
|
|
@@ -48,9 +69,9 @@ describe("useI18n", () => {
|
|
|
48
69
|
};
|
|
49
70
|
const { result } = renderHook(() => useI18n("FileUpload"), {
|
|
50
71
|
wrapper: ({ children }) => (
|
|
51
|
-
<
|
|
72
|
+
<Provider locale={en} translations={[i18n1, i18n2]}>
|
|
52
73
|
{children}
|
|
53
|
-
</
|
|
74
|
+
</Provider>
|
|
54
75
|
),
|
|
55
76
|
});
|
|
56
77
|
const translate = result.current;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
|
-
import {
|
|
3
|
-
import { LanguageProviderContext } from "../../provider/i18n/LanguageProvider";
|
|
2
|
+
import { useProvider } from "../../provider/Provider";
|
|
4
3
|
import { get } from "./get";
|
|
5
4
|
import {
|
|
6
5
|
Component,
|
|
@@ -28,15 +27,16 @@ export type TFunction<T extends Component> = (
|
|
|
28
27
|
|
|
29
28
|
export function useI18n<T extends Component>(
|
|
30
29
|
componentName: T,
|
|
31
|
-
...
|
|
30
|
+
...localTranslations: (ComponentTranslation<T> | undefined)[]
|
|
32
31
|
) {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
32
|
+
const context = useProvider();
|
|
33
|
+
const contextTranslations = context.translations || [];
|
|
35
34
|
const i18nObjects: (PartialTranslations | undefined)[] = [
|
|
36
|
-
...
|
|
37
|
-
...(Array.isArray(
|
|
38
|
-
?
|
|
39
|
-
: [
|
|
35
|
+
...localTranslations,
|
|
36
|
+
...(Array.isArray(contextTranslations)
|
|
37
|
+
? contextTranslations.map((t) => t[componentName])
|
|
38
|
+
: [contextTranslations[componentName]]),
|
|
39
|
+
context.locale[componentName],
|
|
40
40
|
];
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -67,11 +67,12 @@ export function useI18n<T extends Component>(
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export function useDateLocale() {
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const i18nObjects = Array.isArray(
|
|
73
|
-
?
|
|
74
|
-
: [
|
|
70
|
+
const context = useProvider();
|
|
71
|
+
const contextTranslations = context.translations || [];
|
|
72
|
+
const i18nObjects = Array.isArray(contextTranslations)
|
|
73
|
+
? contextTranslations.map((t) => t.global)
|
|
74
|
+
: [contextTranslations.global];
|
|
75
|
+
i18nObjects.push(context.locale.global);
|
|
75
76
|
|
|
76
77
|
for (const obj of i18nObjects) {
|
|
77
78
|
if (obj?.dateLocale) {
|
|
@@ -7,8 +7,53 @@ export default {
|
|
|
7
7
|
showMore: "Show more",
|
|
8
8
|
showLess: "Show less",
|
|
9
9
|
readOnly: "Read-only",
|
|
10
|
+
close: "Close",
|
|
10
11
|
},
|
|
11
12
|
|
|
13
|
+
Alert: {
|
|
14
|
+
closeAlert: "Close alert",
|
|
15
|
+
closeMessage: "Close message",
|
|
16
|
+
error: "Error",
|
|
17
|
+
info: "Information",
|
|
18
|
+
success: "Success",
|
|
19
|
+
warning: "Warning",
|
|
20
|
+
},
|
|
21
|
+
Chips: {
|
|
22
|
+
Removable: {
|
|
23
|
+
labelSuffix: "delete",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
Combobox: {
|
|
27
|
+
addOption: "Add",
|
|
28
|
+
loading: "Searching…",
|
|
29
|
+
maxSelected: "{selected} of max {limit} are selected.",
|
|
30
|
+
},
|
|
31
|
+
CopyButton: {
|
|
32
|
+
title: "Copy",
|
|
33
|
+
activeText: "Copied!",
|
|
34
|
+
},
|
|
35
|
+
DatePicker: {
|
|
36
|
+
chooseDate: "Choose date",
|
|
37
|
+
chooseDates: "Choose dates",
|
|
38
|
+
chooseDateRange: "Choose start and end date",
|
|
39
|
+
chooseMonth: "Choose month",
|
|
40
|
+
week: "Week",
|
|
41
|
+
weekNumber: "Week {week}",
|
|
42
|
+
selectWeekNumber: "Select week {week}",
|
|
43
|
+
month: "Month",
|
|
44
|
+
goToNextMonth: "Go to next month",
|
|
45
|
+
goToPreviousMonth: "Go to previous month",
|
|
46
|
+
year: "Year",
|
|
47
|
+
goToNextYear: "Go to next year",
|
|
48
|
+
goToPreviousYear: "Go to previous year",
|
|
49
|
+
openDatePicker: "Open date picker",
|
|
50
|
+
openMonthPicker: "Open month picker",
|
|
51
|
+
closeDatePicker: "Close date picker",
|
|
52
|
+
closeMonthPicker: "Close month picker",
|
|
53
|
+
},
|
|
54
|
+
ErrorSummary: {
|
|
55
|
+
heading: "You must correct the following errors before you can continue:",
|
|
56
|
+
},
|
|
12
57
|
FileUpload: {
|
|
13
58
|
dropzone: {
|
|
14
59
|
button: "Choose file",
|
|
@@ -32,35 +77,18 @@ export default {
|
|
|
32
77
|
showAllSteps: "Show all steps",
|
|
33
78
|
hideAllSteps: "Hide all steps",
|
|
34
79
|
},
|
|
35
|
-
Alert: {
|
|
36
|
-
closeAlert: "Close alert",
|
|
37
|
-
closeMessage: "Close message",
|
|
38
|
-
error: "Error",
|
|
39
|
-
info: "Information",
|
|
40
|
-
success: "Success",
|
|
41
|
-
warning: "Warning",
|
|
42
|
-
},
|
|
43
|
-
Chips: {
|
|
44
|
-
Removable: {
|
|
45
|
-
labelSuffix: "delete",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
CopyButton: {
|
|
49
|
-
title: "Copy",
|
|
50
|
-
activeText: "Copied!",
|
|
51
|
-
},
|
|
52
|
-
ErrorSummary: {
|
|
53
|
-
heading: "You must correct the following errors before you can continue:",
|
|
54
|
-
},
|
|
55
80
|
FormSummary: {
|
|
56
81
|
editAnswer: "Edit answer",
|
|
57
82
|
},
|
|
83
|
+
GuidePanel: {
|
|
84
|
+
illustrationLabel: "Illustration of advisor",
|
|
85
|
+
},
|
|
86
|
+
HelpText: {
|
|
87
|
+
title: "More information",
|
|
88
|
+
},
|
|
58
89
|
Loader: {
|
|
59
90
|
title: "Waiting…",
|
|
60
91
|
},
|
|
61
|
-
Modal: {
|
|
62
|
-
close: "Close",
|
|
63
|
-
},
|
|
64
92
|
Pagination: {
|
|
65
93
|
previous: "Previous",
|
|
66
94
|
next: "Next",
|
|
@@ -71,7 +99,7 @@ export default {
|
|
|
71
99
|
"Progress is unknown, estimated time is {seconds} seconds.",
|
|
72
100
|
},
|
|
73
101
|
Search: {
|
|
74
|
-
clear: "Clear",
|
|
102
|
+
clear: "Clear field",
|
|
75
103
|
search: "Search",
|
|
76
104
|
},
|
|
77
105
|
Textarea: {
|
|
@@ -104,36 +132,4 @@ export default {
|
|
|
104
132
|
reset: "Reset zoom",
|
|
105
133
|
},
|
|
106
134
|
},
|
|
107
|
-
DatePicker: {
|
|
108
|
-
close: "Close",
|
|
109
|
-
chooseDate: "Choose date",
|
|
110
|
-
chooseDates: "Choose dates",
|
|
111
|
-
chooseDateRange: "Choose start and end date",
|
|
112
|
-
chooseMonth: "Choose month",
|
|
113
|
-
week: "Week",
|
|
114
|
-
weekNumber: "Week {week}",
|
|
115
|
-
selectWeekNumber: "Select week {week}",
|
|
116
|
-
month: "Month",
|
|
117
|
-
goToNextMonth: "Go to next month",
|
|
118
|
-
goToPreviousMonth: "Go to previous month",
|
|
119
|
-
year: "Year",
|
|
120
|
-
goToNextYear: "Go to next year",
|
|
121
|
-
goToPreviousYear: "Go to previous year",
|
|
122
|
-
openDatePicker: "Open date picker",
|
|
123
|
-
openMonthPicker: "Open month picker",
|
|
124
|
-
closeDatePicker: "Close date picker",
|
|
125
|
-
closeMonthPicker: "Close month picker",
|
|
126
|
-
},
|
|
127
|
-
Combobox: {
|
|
128
|
-
addOption: "Add",
|
|
129
|
-
loading: "Searching…",
|
|
130
|
-
maxSelected: "{selected} of max {limit} are selected.",
|
|
131
|
-
clear: "Clear",
|
|
132
|
-
},
|
|
133
|
-
GuidePanel: {
|
|
134
|
-
illustrationLabel: "Illustration of advisor",
|
|
135
|
-
},
|
|
136
|
-
HelpText: {
|
|
137
|
-
title: "More information",
|
|
138
|
-
},
|
|
139
135
|
} satisfies Translations;
|
|
@@ -10,8 +10,56 @@ export default {
|
|
|
10
10
|
showMore: "Vis mer",
|
|
11
11
|
showLess: "Vis mindre",
|
|
12
12
|
readOnly: "Skrivebeskyttet",
|
|
13
|
+
close: "Lukk",
|
|
13
14
|
},
|
|
14
15
|
|
|
16
|
+
Alert: {
|
|
17
|
+
closeAlert: "Lukk varsel",
|
|
18
|
+
closeMessage: "Lukk melding",
|
|
19
|
+
error: "Feil",
|
|
20
|
+
info: "Informasjon",
|
|
21
|
+
success: "Suksess",
|
|
22
|
+
warning: "Advarsel",
|
|
23
|
+
},
|
|
24
|
+
Chips: {
|
|
25
|
+
Removable: {
|
|
26
|
+
/** Will be appended to the accessible name for the button. */
|
|
27
|
+
labelSuffix: "slett",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
Combobox: {
|
|
31
|
+
/** The input value will be appended to the end of this text, e.g. `Legg til "input value"`. */
|
|
32
|
+
addOption: "Legg til",
|
|
33
|
+
/** Loader title */
|
|
34
|
+
loading: "Søker…",
|
|
35
|
+
maxSelected: "{selected} av maks {limit} er valgt.",
|
|
36
|
+
},
|
|
37
|
+
CopyButton: {
|
|
38
|
+
title: "Kopier",
|
|
39
|
+
activeText: "Kopiert!",
|
|
40
|
+
},
|
|
41
|
+
DatePicker: {
|
|
42
|
+
chooseDate: "Velg dato",
|
|
43
|
+
chooseDates: "Velg datoer",
|
|
44
|
+
chooseDateRange: "Velg start- og sluttdato",
|
|
45
|
+
chooseMonth: "Velg måned",
|
|
46
|
+
week: "Uke",
|
|
47
|
+
weekNumber: "Uke {week}",
|
|
48
|
+
selectWeekNumber: "Velg uke {week}",
|
|
49
|
+
month: "Måned",
|
|
50
|
+
goToNextMonth: "Gå til neste måned",
|
|
51
|
+
goToPreviousMonth: "Gå til forrige måned",
|
|
52
|
+
year: "År",
|
|
53
|
+
goToNextYear: "Gå til neste år",
|
|
54
|
+
goToPreviousYear: "Gå til forrige år",
|
|
55
|
+
openDatePicker: "Åpne datovelger",
|
|
56
|
+
openMonthPicker: "Åpne månedsvelger",
|
|
57
|
+
closeDatePicker: "Lukk datovelger",
|
|
58
|
+
closeMonthPicker: "Lukk månedsvelger",
|
|
59
|
+
},
|
|
60
|
+
ErrorSummary: {
|
|
61
|
+
heading: "Du må rette disse feilene før du kan fortsette:",
|
|
62
|
+
},
|
|
15
63
|
FileUpload: {
|
|
16
64
|
dropzone: {
|
|
17
65
|
button: "Velg fil",
|
|
@@ -35,36 +83,18 @@ export default {
|
|
|
35
83
|
showAllSteps: "Vis alle steg",
|
|
36
84
|
hideAllSteps: "Skjul alle steg",
|
|
37
85
|
},
|
|
38
|
-
Alert: {
|
|
39
|
-
closeAlert: "Lukk varsel",
|
|
40
|
-
closeMessage: "Lukk melding",
|
|
41
|
-
error: "Feil",
|
|
42
|
-
info: "Informasjon",
|
|
43
|
-
success: "Suksess",
|
|
44
|
-
warning: "Advarsel",
|
|
45
|
-
},
|
|
46
|
-
Chips: {
|
|
47
|
-
Removable: {
|
|
48
|
-
/** Will be appended to the accessible name for the button. */
|
|
49
|
-
labelSuffix: "slett",
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
CopyButton: {
|
|
53
|
-
title: "Kopier",
|
|
54
|
-
activeText: "Kopiert!",
|
|
55
|
-
},
|
|
56
|
-
ErrorSummary: {
|
|
57
|
-
heading: "Du må rette disse feilene før du kan fortsette:",
|
|
58
|
-
},
|
|
59
86
|
FormSummary: {
|
|
60
87
|
editAnswer: "Endre svar",
|
|
61
88
|
},
|
|
89
|
+
GuidePanel: {
|
|
90
|
+
illustrationLabel: "Illustrasjon av veileder",
|
|
91
|
+
},
|
|
92
|
+
HelpText: {
|
|
93
|
+
title: "Mer informasjon",
|
|
94
|
+
},
|
|
62
95
|
Loader: {
|
|
63
96
|
title: "Venter…",
|
|
64
97
|
},
|
|
65
|
-
Modal: {
|
|
66
|
-
close: "Lukk",
|
|
67
|
-
},
|
|
68
98
|
Pagination: {
|
|
69
99
|
previous: "Forrige",
|
|
70
100
|
next: "Neste",
|
|
@@ -75,7 +105,7 @@ export default {
|
|
|
75
105
|
"Fremdrift kan ikke beregnes, antatt tid er {seconds} sekunder.",
|
|
76
106
|
},
|
|
77
107
|
Search: {
|
|
78
|
-
clear: "Tøm",
|
|
108
|
+
clear: "Tøm feltet",
|
|
79
109
|
search: "Søk",
|
|
80
110
|
},
|
|
81
111
|
Textarea: {
|
|
@@ -98,7 +128,7 @@ export default {
|
|
|
98
128
|
warning: "Advarsel",
|
|
99
129
|
danger: "Fare",
|
|
100
130
|
info: "Info",
|
|
101
|
-
neutral: "Nøytral",
|
|
131
|
+
neutral: "Nøytral",
|
|
102
132
|
period: "{status} fra {start} til {end}",
|
|
103
133
|
},
|
|
104
134
|
Pin: {
|
|
@@ -109,38 +139,4 @@ export default {
|
|
|
109
139
|
reset: "Tilbakestill tidsperspektiv",
|
|
110
140
|
},
|
|
111
141
|
},
|
|
112
|
-
DatePicker: {
|
|
113
|
-
close: "Lukk", // TODO: Consider making global
|
|
114
|
-
chooseDate: "Velg dato",
|
|
115
|
-
chooseDates: "Velg datoer",
|
|
116
|
-
chooseDateRange: "Velg start- og sluttdato",
|
|
117
|
-
chooseMonth: "Velg måned",
|
|
118
|
-
week: "Uke",
|
|
119
|
-
weekNumber: "Uke {week}",
|
|
120
|
-
selectWeekNumber: "Velg uke {week}",
|
|
121
|
-
month: "Måned",
|
|
122
|
-
goToNextMonth: "Gå til neste måned",
|
|
123
|
-
goToPreviousMonth: "Gå til forrige måned",
|
|
124
|
-
year: "År",
|
|
125
|
-
goToNextYear: "Gå til neste år",
|
|
126
|
-
goToPreviousYear: "Gå til forrige år",
|
|
127
|
-
openDatePicker: "Åpne datovelger",
|
|
128
|
-
openMonthPicker: "Åpne månedsvelger",
|
|
129
|
-
closeDatePicker: "Lukk datovelger",
|
|
130
|
-
closeMonthPicker: "Lukk månedsvelger",
|
|
131
|
-
},
|
|
132
|
-
Combobox: {
|
|
133
|
-
/** The input value will be appended to the end of this text, e.g. `Legg til "input value"`. */
|
|
134
|
-
addOption: "Legg til",
|
|
135
|
-
/** Loader title */
|
|
136
|
-
loading: "Søker…",
|
|
137
|
-
maxSelected: "{selected} av maks {limit} er valgt.",
|
|
138
|
-
clear: "Tøm",
|
|
139
|
-
},
|
|
140
|
-
GuidePanel: {
|
|
141
|
-
illustrationLabel: "Illustrasjon av veileder",
|
|
142
|
-
},
|
|
143
|
-
HelpText: {
|
|
144
|
-
title: "Mer informasjon",
|
|
145
|
-
},
|
|
146
142
|
} satisfies TranslationMap;
|
|
@@ -7,8 +7,53 @@ export default {
|
|
|
7
7
|
showMore: "Vis meir",
|
|
8
8
|
showLess: "Vis mindre",
|
|
9
9
|
readOnly: "Skrivebeskytta",
|
|
10
|
+
close: "Lukk",
|
|
10
11
|
},
|
|
11
12
|
|
|
13
|
+
Alert: {
|
|
14
|
+
closeAlert: "Lukk varsel",
|
|
15
|
+
closeMessage: "Lukk melding",
|
|
16
|
+
error: "Feil",
|
|
17
|
+
info: "Informasjon",
|
|
18
|
+
success: "Suksess",
|
|
19
|
+
warning: "Åtvaring",
|
|
20
|
+
},
|
|
21
|
+
Chips: {
|
|
22
|
+
Removable: {
|
|
23
|
+
labelSuffix: "slett",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
Combobox: {
|
|
27
|
+
addOption: "Legg til",
|
|
28
|
+
loading: "Søker…",
|
|
29
|
+
maxSelected: "{selected} av maks {limit} er valt.",
|
|
30
|
+
},
|
|
31
|
+
CopyButton: {
|
|
32
|
+
title: "Kopier",
|
|
33
|
+
activeText: "Kopiert!",
|
|
34
|
+
},
|
|
35
|
+
DatePicker: {
|
|
36
|
+
chooseDate: "Vel dato",
|
|
37
|
+
chooseDates: "Vel datoar",
|
|
38
|
+
chooseDateRange: "Vel start- og sluttdato",
|
|
39
|
+
chooseMonth: "Vel månad",
|
|
40
|
+
week: "Veke",
|
|
41
|
+
weekNumber: "Veke {week}",
|
|
42
|
+
selectWeekNumber: "Vel veke {week}",
|
|
43
|
+
month: "Månad",
|
|
44
|
+
goToNextMonth: "Gå til neste månad",
|
|
45
|
+
goToPreviousMonth: "Gå til førre månad",
|
|
46
|
+
year: "År",
|
|
47
|
+
goToNextYear: "Gå til neste år",
|
|
48
|
+
goToPreviousYear: "Gå til førre år",
|
|
49
|
+
openDatePicker: "Opne datoveljar",
|
|
50
|
+
openMonthPicker: "Opne månadsveljar",
|
|
51
|
+
closeDatePicker: "Lukk datoveljar",
|
|
52
|
+
closeMonthPicker: "Lukk månadsveljar",
|
|
53
|
+
},
|
|
54
|
+
ErrorSummary: {
|
|
55
|
+
heading: "Du må rette desse feila før du kan halde fram:",
|
|
56
|
+
},
|
|
12
57
|
FileUpload: {
|
|
13
58
|
dropzone: {
|
|
14
59
|
button: "Vel fil",
|
|
@@ -32,35 +77,18 @@ export default {
|
|
|
32
77
|
showAllSteps: "Vis alle steg",
|
|
33
78
|
hideAllSteps: "Skjul alle steg",
|
|
34
79
|
},
|
|
35
|
-
Alert: {
|
|
36
|
-
closeAlert: "Lukk varsel",
|
|
37
|
-
closeMessage: "Lukk melding",
|
|
38
|
-
error: "Feil",
|
|
39
|
-
info: "Informasjon",
|
|
40
|
-
success: "Suksess",
|
|
41
|
-
warning: "Åtvaring",
|
|
42
|
-
},
|
|
43
|
-
Chips: {
|
|
44
|
-
Removable: {
|
|
45
|
-
labelSuffix: "slett",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
CopyButton: {
|
|
49
|
-
title: "Kopier",
|
|
50
|
-
activeText: "Kopiert!",
|
|
51
|
-
},
|
|
52
|
-
ErrorSummary: {
|
|
53
|
-
heading: "Du må rette desse feila før du kan halde fram:",
|
|
54
|
-
},
|
|
55
80
|
FormSummary: {
|
|
56
81
|
editAnswer: "Endre svar",
|
|
57
82
|
},
|
|
83
|
+
GuidePanel: {
|
|
84
|
+
illustrationLabel: "Illustrasjon av rettleiar",
|
|
85
|
+
},
|
|
86
|
+
HelpText: {
|
|
87
|
+
title: "Meir informasjon",
|
|
88
|
+
},
|
|
58
89
|
Loader: {
|
|
59
90
|
title: "Ventar…",
|
|
60
91
|
},
|
|
61
|
-
Modal: {
|
|
62
|
-
close: "Lukk",
|
|
63
|
-
},
|
|
64
92
|
Pagination: {
|
|
65
93
|
previous: "Førre",
|
|
66
94
|
next: "Neste",
|
|
@@ -71,7 +99,7 @@ export default {
|
|
|
71
99
|
"Framdrift kan ikkje bereknast, antatt tid er {seconds} sekund.",
|
|
72
100
|
},
|
|
73
101
|
Search: {
|
|
74
|
-
clear: "Tøm",
|
|
102
|
+
clear: "Tøm feltet",
|
|
75
103
|
search: "Søk",
|
|
76
104
|
},
|
|
77
105
|
Textarea: {
|
|
@@ -104,36 +132,4 @@ export default {
|
|
|
104
132
|
reset: "Tilbakestill tidsperspektiv",
|
|
105
133
|
},
|
|
106
134
|
},
|
|
107
|
-
DatePicker: {
|
|
108
|
-
close: "Lukk",
|
|
109
|
-
chooseDate: "Vel dato",
|
|
110
|
-
chooseDates: "Vel datoar",
|
|
111
|
-
chooseDateRange: "Vel start- og sluttdato",
|
|
112
|
-
chooseMonth: "Vel månad",
|
|
113
|
-
week: "Veke",
|
|
114
|
-
weekNumber: "Veke {week}",
|
|
115
|
-
selectWeekNumber: "Vel veke {week}",
|
|
116
|
-
month: "Månad",
|
|
117
|
-
goToNextMonth: "Gå til neste månad",
|
|
118
|
-
goToPreviousMonth: "Gå til førre månad",
|
|
119
|
-
year: "År",
|
|
120
|
-
goToNextYear: "Gå til neste år",
|
|
121
|
-
goToPreviousYear: "Gå til førre år",
|
|
122
|
-
openDatePicker: "Opne datoveljar",
|
|
123
|
-
openMonthPicker: "Opne månadsveljar",
|
|
124
|
-
closeDatePicker: "Lukk datoveljar",
|
|
125
|
-
closeMonthPicker: "Lukk månadsveljar",
|
|
126
|
-
},
|
|
127
|
-
Combobox: {
|
|
128
|
-
addOption: "Legg til",
|
|
129
|
-
loading: "Søker…",
|
|
130
|
-
maxSelected: "{selected} av maks {limit} er valt.",
|
|
131
|
-
clear: "Tøm",
|
|
132
|
-
},
|
|
133
|
-
GuidePanel: {
|
|
134
|
-
illustrationLabel: "Illustrasjon av rettleiar",
|
|
135
|
-
},
|
|
136
|
-
HelpText: {
|
|
137
|
-
title: "Meir informasjon",
|
|
138
|
-
},
|
|
139
135
|
} satisfies Translations;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { PartialTranslations } from "../../util/i18n/i18n.types";
|
|
3
|
-
export interface LanguageProviderContextType {
|
|
4
|
-
/**
|
|
5
|
-
* Merged with the default language translations object (officially provided translations).
|
|
6
|
-
*/
|
|
7
|
-
translations: PartialTranslations | PartialTranslations[];
|
|
8
|
-
}
|
|
9
|
-
export declare const LanguageProviderContext: React.Context<LanguageProviderContextType>;
|
|
10
|
-
export interface LanguageProviderProps {
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
translations?: PartialTranslations | PartialTranslations[];
|
|
13
|
-
}
|
|
14
|
-
export declare const useProvider: () => LanguageProviderContextType;
|
|
15
|
-
/**
|
|
16
|
-
* @private Feature is under development and should not be used in any applications.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```jsx
|
|
20
|
-
* <UNSAFE_AkselLanguageProvider translations={{...}}>
|
|
21
|
-
* {app}
|
|
22
|
-
* </UNSAFE_AkselLanguageProvider>
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare const UNSAFE_AkselLanguageProvider: ({ children, translations, }: LanguageProviderProps) => React.JSX.Element;
|
|
26
|
-
export default UNSAFE_AkselLanguageProvider;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.UNSAFE_AkselLanguageProvider = exports.useProvider = exports.LanguageProviderContext = void 0;
|
|
30
|
-
const react_1 = __importStar(require("react"));
|
|
31
|
-
const nb_1 = __importDefault(require("../../util/i18n/locales/nb"));
|
|
32
|
-
exports.LanguageProviderContext = (0, react_1.createContext)({
|
|
33
|
-
translations: nb_1.default,
|
|
34
|
-
});
|
|
35
|
-
const useProvider = () => (0, react_1.useContext)(exports.LanguageProviderContext);
|
|
36
|
-
exports.useProvider = useProvider;
|
|
37
|
-
/**
|
|
38
|
-
* @private Feature is under development and should not be used in any applications.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```jsx
|
|
42
|
-
* <UNSAFE_AkselLanguageProvider translations={{...}}>
|
|
43
|
-
* {app}
|
|
44
|
-
* </UNSAFE_AkselLanguageProvider>
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
const UNSAFE_AkselLanguageProvider = ({ children, translations, }) => {
|
|
48
|
-
return (react_1.default.createElement(exports.LanguageProviderContext.Provider, { value: {
|
|
49
|
-
translations: translations !== null && translations !== void 0 ? translations : nb_1.default,
|
|
50
|
-
} }, children));
|
|
51
|
-
};
|
|
52
|
-
exports.UNSAFE_AkselLanguageProvider = UNSAFE_AkselLanguageProvider;
|
|
53
|
-
exports.default = exports.UNSAFE_AkselLanguageProvider;
|
|
54
|
-
//# sourceMappingURL=LanguageProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LanguageProvider.js","sourceRoot":"","sources":["../../../src/provider/i18n/LanguageProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAyD;AAEzD,oEAA4C;AAS/B,QAAA,uBAAuB,GAClC,IAAA,qBAAa,EAA8B;IACzC,YAAY,EAAE,YAAE;CACjB,CAAC,CAAC;AAOE,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,IAAA,kBAAU,EAAC,+BAAuB,CAAC,CAAC;AAAxD,QAAA,WAAW,eAA6C;AAErE;;;;;;;;;GASG;AACI,MAAM,4BAA4B,GAAG,CAAC,EAC3C,QAAQ,EACR,YAAY,GACU,EAAE,EAAE;IAC1B,OAAO,CACL,8BAAC,+BAAuB,CAAC,QAAQ,IAC/B,KAAK,EAAE;YACL,YAAY,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,YAAE;SACjC,IAEA,QAAQ,CACwB,CACpC,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,4BAA4B,gCAavC;AAEF,kBAAe,oCAA4B,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { PartialTranslations } from "../../util/i18n/i18n.types.js";
|
|
3
|
-
export interface LanguageProviderContextType {
|
|
4
|
-
/**
|
|
5
|
-
* Merged with the default language translations object (officially provided translations).
|
|
6
|
-
*/
|
|
7
|
-
translations: PartialTranslations | PartialTranslations[];
|
|
8
|
-
}
|
|
9
|
-
export declare const LanguageProviderContext: React.Context<LanguageProviderContextType>;
|
|
10
|
-
export interface LanguageProviderProps {
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
translations?: PartialTranslations | PartialTranslations[];
|
|
13
|
-
}
|
|
14
|
-
export declare const useProvider: () => LanguageProviderContextType;
|
|
15
|
-
/**
|
|
16
|
-
* @private Feature is under development and should not be used in any applications.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```jsx
|
|
20
|
-
* <UNSAFE_AkselLanguageProvider translations={{...}}>
|
|
21
|
-
* {app}
|
|
22
|
-
* </UNSAFE_AkselLanguageProvider>
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare const UNSAFE_AkselLanguageProvider: ({ children, translations, }: LanguageProviderProps) => React.JSX.Element;
|
|
26
|
-
export default UNSAFE_AkselLanguageProvider;
|