Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
replace app globals locale with i18n data provider
  • Loading branch information
sejas committed Aug 17, 2024
commit 6be41fd4e4c5bd1aedaa6c22d076d6d70da94076
4 changes: 2 additions & 2 deletions src/hooks/use-localization-support.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useI18n } from '@wordpress/react-i18n';
import { useEffect } from 'react';
import { getAppGlobals } from '../lib/app-globals';
import { useI18nData } from './use-i18n-data';

export function useLocalizationSupport() {
const { __, _x, isRTL } = useI18n();
const locale = getAppGlobals().locale;
const { locale } = useI18nData();

// Some languages may need to set an html lang attribute that is different from their slug
let lang = __( 'html_lang_attribute' );
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/use-welcome-messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
useCallback,
useContext,
} from 'react';
import { getAppGlobals } from '../lib/app-globals';
import { useAuth } from './use-auth';
import { useI18nData } from './use-i18n-data';
import { useOffline } from './use-offline';
import { useWindowListener } from './use-window-listener';

Expand All @@ -31,7 +31,7 @@ const WelcomeMessagesContext = createContext< WelcomeMessagesContext >( {
export const WelcomeMessagesProvider = ( { children }: { children: React.ReactNode } ) => {
const { client } = useAuth();
const isOffline = useOffline();
const locale = getAppGlobals().locale;
const { locale } = useI18nData();
const [ messages, setMessages ] = useState< string[] >( [] );
const [ examplePrompts, setExamplePrompts ] = useState< string[] >( [] );
const isFetchingMessages = useRef( false );
Expand Down