diff --git a/packages/i18n/index.ts b/packages/i18n/index.ts index 3f019f1e5e..e8a7483966 100644 --- a/packages/i18n/index.ts +++ b/packages/i18n/index.ts @@ -1,4 +1,3 @@ export * from './src/StreamI18n'; -export * from './src/translations'; export * from './src/types'; export * from './src/utils'; diff --git a/packages/i18n/src/StreamI18n.ts b/packages/i18n/src/StreamI18n.ts index 9f4411aaa4..498ebc2098 100644 --- a/packages/i18n/src/StreamI18n.ts +++ b/packages/i18n/src/StreamI18n.ts @@ -1,5 +1,4 @@ import i18next from 'i18next'; -import defaultTranslations from './translations'; import { mapToRegistry } from './utils'; import { TranslationLanguage, @@ -15,10 +14,7 @@ const DEFAULT_CONFIG = { currentLanguage: DEFAULT_LANGUAGE, }; -const DEFAULT_TRANSLATIONS_REGISTRY = mapToRegistry( - defaultTranslations, - DEFAULT_NAMESPACE, -); +const DEFAULT_TRANSLATIONS_REGISTRY = mapToRegistry({}, DEFAULT_NAMESPACE); export const defaultTranslationFunction = (key: string) => key; diff --git a/packages/i18n/src/translations/index.ts b/packages/i18n/src/translations/index.ts deleted file mode 100644 index 430d2acc56..0000000000 --- a/packages/i18n/src/translations/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import en from './en.json'; - -const translations = { en }; -export default translations; diff --git a/packages/i18n/src/types.ts b/packages/i18n/src/types.ts index 8c3eb454a1..61791b4b38 100644 --- a/packages/i18n/src/types.ts +++ b/packages/i18n/src/types.ts @@ -1,12 +1,8 @@ -import defaultTranslations from './translations'; - -export type TranslationLanguage = 'en' | 'es' | string; +export type TranslationLanguage = 'en' | string; export type Namespace = string; -export type TranslationSheet = - | typeof defaultTranslations.en - | Record; +export type TranslationSheet = Record; export type TranslationsForLanguage = Record; diff --git a/packages/react-bindings/src/contexts/StreamI18nContext.tsx b/packages/react-bindings/src/contexts/StreamI18nContext.tsx index 05a25bcd5e..22e7968b1f 100644 --- a/packages/react-bindings/src/contexts/StreamI18nContext.tsx +++ b/packages/react-bindings/src/contexts/StreamI18nContext.tsx @@ -20,6 +20,12 @@ const StreamI18nContext = createContext({ t: defaultTranslationFunction, }); +type CreateI18nParams = { + i18nInstance?: StreamI18n; + language?: string; + translationsOverrides?: TranslationsMap; +}; + export type StreamI18nProviderProps = CreateI18nParams; export const StreamI18nProvider = ({ @@ -35,12 +41,6 @@ export const StreamI18nProvider = ({ ); }; -type CreateI18nParams = { - i18nInstance?: StreamI18n; - language?: string; - translationsOverrides?: TranslationsMap; -}; - export const useCreateI18n = ({ i18nInstance, language, diff --git a/packages/react-bindings/src/contexts/StreamVideoContext.tsx b/packages/react-bindings/src/contexts/StreamVideoContext.tsx index 6fb6053ff9..edd6808653 100644 --- a/packages/react-bindings/src/contexts/StreamVideoContext.tsx +++ b/packages/react-bindings/src/contexts/StreamVideoContext.tsx @@ -23,7 +23,7 @@ export type StreamVideoProps = StreamI18nProviderProps & { * @param PropsWithChildren * @category Client State */ -export const StreamVideo = ({ +export const StreamVideoProvider = ({ children, client, i18nInstance, diff --git a/packages/react-native-sdk/src/providers/StreamVideo.tsx b/packages/react-native-sdk/src/providers/StreamVideo.tsx index 3150ef8cd8..edb0a625bf 100644 --- a/packages/react-native-sdk/src/providers/StreamVideo.tsx +++ b/packages/react-native-sdk/src/providers/StreamVideo.tsx @@ -1,6 +1,8 @@ import { - StreamVideo as StreamVideoProvider, + StreamVideoProvider, + StreamI18nProvider, StreamVideoProps, + StreamI18nProviderProps, } from '@stream-io/video-react-bindings'; import React, { PropsWithChildren, useEffect } from 'react'; import { StreamVideoStoreProvider } from '../contexts/StreamVideoContext'; @@ -15,7 +17,9 @@ import { usePushRegisterEffect } from '../hooks'; * * @category Client State */ -export const StreamVideo = (props: PropsWithChildren) => { +export const StreamVideo = ( + props: PropsWithChildren, +) => { const { client, children, translationsOverrides, i18nInstance, language } = props; @@ -41,17 +45,18 @@ export const StreamVideo = (props: PropsWithChildren) => { }, [client]); return ( - - - - - {children} - + + + + + + {children} + + ); }; diff --git a/packages/react-sdk/index.ts b/packages/react-sdk/index.ts index 889dbc8959..e01bd6b18f 100644 --- a/packages/react-sdk/index.ts +++ b/packages/react-sdk/index.ts @@ -9,6 +9,7 @@ export * from './src/core'; export * from './src/components'; export * from './src/types'; +export * from './src/translations'; export { useHorizontalScrollPosition, useVerticalScrollPosition, diff --git a/packages/react-sdk/src/core/components/StreamVideo/StreamVideo.tsx b/packages/react-sdk/src/core/components/StreamVideo/StreamVideo.tsx new file mode 100644 index 0000000000..f8156b82da --- /dev/null +++ b/packages/react-sdk/src/core/components/StreamVideo/StreamVideo.tsx @@ -0,0 +1,12 @@ +import { + StreamVideoProvider, + StreamVideoProps, +} from '@stream-io/video-react-bindings'; +import { PropsWithChildren } from 'react'; +import { translations } from '../../../translations'; + +export const StreamVideo = (props: PropsWithChildren) => { + return ( + + ); +}; diff --git a/packages/react-sdk/src/core/components/StreamVideo/index.ts b/packages/react-sdk/src/core/components/StreamVideo/index.ts new file mode 100644 index 0000000000..8795a5a4db --- /dev/null +++ b/packages/react-sdk/src/core/components/StreamVideo/index.ts @@ -0,0 +1 @@ +export * from './StreamVideo'; diff --git a/packages/react-sdk/src/core/components/index.ts b/packages/react-sdk/src/core/components/index.ts index 8b07bae719..88f37b8279 100644 --- a/packages/react-sdk/src/core/components/index.ts +++ b/packages/react-sdk/src/core/components/index.ts @@ -1,6 +1,7 @@ export * from './Audio'; export * from './ParticipantView'; export * from './StreamCall'; +export * from './StreamVideo'; export { Video } from './Video'; export type { BaseVideoProps, VideoProps } from './Video'; diff --git a/packages/i18n/src/translations/en.json b/packages/react-sdk/src/translations/en.json similarity index 99% rename from packages/i18n/src/translations/en.json rename to packages/react-sdk/src/translations/en.json index 6089ee40f6..ec19366175 100644 --- a/packages/i18n/src/translations/en.json +++ b/packages/react-sdk/src/translations/en.json @@ -22,7 +22,7 @@ "Waiting for recording to start...": "Waiting for recording to start...", "Record call": "Record call", "Reactions": "Reactions", - "You can now share your screen.": "You can now share your screen.", + "You can now share your screen.": "You can now share your screen.", "Awaiting for an approval to share screen.": "Awaiting for an approval to share screen.", "You can no longer share your screen.": "You can no longer share your screen.", "Share screen": "Share screen", diff --git a/packages/react-sdk/src/translations/index.ts b/packages/react-sdk/src/translations/index.ts new file mode 100644 index 0000000000..b13cf59240 --- /dev/null +++ b/packages/react-sdk/src/translations/index.ts @@ -0,0 +1,3 @@ +import en from './en.json'; + +export const translations = { en }; diff --git a/sample-apps/react/react-dogfood/pages/join/[callId].tsx b/sample-apps/react/react-dogfood/pages/join/[callId].tsx index a76eddc291..c41b360ece 100644 --- a/sample-apps/react/react-dogfood/pages/join/[callId].tsx +++ b/sample-apps/react/react-dogfood/pages/join/[callId].tsx @@ -17,7 +17,7 @@ import { } from '../../lib/getServerSideCredentialsProps'; import { useGleap } from '../../hooks/useGleap'; import { useSettings } from '../../context/SettingsContext'; -import translations from '../../translations'; +import appTranslations from '../../translations'; import { DeviceSettingsCaptor, getDeviceSettings, @@ -108,7 +108,7 @@ const CallRoom = (props: ServerSideCredentialsProps) => {