@dxos/react-ui 0.3.11-main.ed96468 → 0.3.11-main.ee2b64c

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.
@@ -1,5 +1,5 @@
1
1
  // packages/ui/react-ui/src/index.ts
2
- import { useTranslation, Trans } from "react-i18next";
2
+ import { Trans } from "react-i18next";
3
3
  export * from "@dxos/react-ui-types";
4
4
  export * from "@dxos/react-hooks";
5
5
 
@@ -23,14 +23,16 @@ var useElevationContext = (propsElevation) => {
23
23
  };
24
24
 
25
25
  // packages/ui/react-ui/src/hooks/useTranslationsContext.ts
26
- import { useContext as useContext3 } from "react";
26
+ import { useContext as useContext4 } from "react";
27
27
 
28
28
  // packages/ui/react-ui/src/components/ThemeProvider/TranslationsProvider.tsx
29
+ import { enUS as dtLocaleEnUs } from "date-fns/locale";
29
30
  import i18Next from "i18next";
30
- import React, { useEffect, createContext, useState, Suspense } from "react";
31
- import { initReactI18next } from "react-i18next";
31
+ import React, { useEffect, createContext, useState, Suspense, useContext as useContext3 } from "react";
32
+ import { initReactI18next, useTranslation as useI18NextTranslation } from "react-i18next";
32
33
  var initialLng = "en-US";
33
34
  var initialNs = "dxos-common";
35
+ var initialDtLocale = dtLocaleEnUs;
34
36
  var resources = {
35
37
  [initialLng]: {
36
38
  [initialNs]: {
@@ -47,9 +49,18 @@ void i18Next.use(initReactI18next).init({
47
49
  }
48
50
  });
49
51
  var TranslationsContext = /* @__PURE__ */ createContext({
50
- appNs: initialNs
52
+ appNs: initialNs,
53
+ dtLocale: initialDtLocale
51
54
  });
52
- var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs }) => {
55
+ var useTranslation = (...args) => {
56
+ const result = useI18NextTranslation(...args);
57
+ const { dtLocale } = useContext3(TranslationsContext);
58
+ return {
59
+ ...result,
60
+ dtLocale
61
+ };
62
+ };
63
+ var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs, dtLocale }) => {
53
64
  const [loaded, setLoaded] = useState(false);
54
65
  useEffect(() => {
55
66
  setLoaded(false);
@@ -68,7 +79,8 @@ var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs }) =
68
79
  ]);
69
80
  return /* @__PURE__ */ React.createElement(TranslationsContext.Provider, {
70
81
  value: {
71
- appNs: appNs ?? initialNs
82
+ appNs: appNs ?? initialNs,
83
+ dtLocale: dtLocale ?? initialDtLocale
72
84
  }
73
85
  }, /* @__PURE__ */ React.createElement(Suspense, {
74
86
  fallback
@@ -76,11 +88,11 @@ var TranslationsProvider = ({ fallback, resourceExtensions, children, appNs }) =
76
88
  };
77
89
 
78
90
  // packages/ui/react-ui/src/hooks/useTranslationsContext.ts
79
- var useTranslationsContext = () => useContext3(TranslationsContext);
91
+ var useTranslationsContext = () => useContext4(TranslationsContext);
80
92
 
81
93
  // packages/ui/react-ui/src/hooks/useThemeContext.ts
82
- import { useContext as useContext4 } from "react";
83
- var useThemeContext = () => useContext4(ThemeContext);
94
+ import { useContext as useContext5 } from "react";
95
+ var useThemeContext = () => useContext5(ThemeContext);
84
96
 
85
97
  // packages/ui/react-ui/src/hooks/useVisualViewport.ts
86
98
  import { useEffect as useEffect2, useState as useState2 } from "react";