diff --git a/lib/compat/wordpress-6.7/block-editor.php b/lib/compat/wordpress-6.7/block-editor.php index 10b70ee84f9b6..7f772de54e14c 100644 --- a/lib/compat/wordpress-6.7/block-editor.php +++ b/lib/compat/wordpress-6.7/block-editor.php @@ -45,15 +45,10 @@ function gutenberg_get_block_editor_settings_6_7( $settings ) { } } - $settings['locale'] = array( - 'site' => array( - 'lang' => $current_site_locale, - 'isRTL' => $current_site_is_rtl, - ), - 'user' => array( - 'lang' => $current_user_locale, - 'isRTL' => $current_user_is_rtl, - ), + // @TODO confirm if `lang` just needs to be added to the `/wp/v2/settings` response`. + $settings['siteLocale'] = array( + 'lang' => $current_site_locale, + 'isRTL' => $current_site_is_rtl, ); return $settings; diff --git a/packages/block-editor/src/components/iframe/index.js b/packages/block-editor/src/components/iframe/index.js index 9e741e28b3ecc..964c1951eb760 100644 --- a/packages/block-editor/src/components/iframe/index.js +++ b/packages/block-editor/src/components/iframe/index.js @@ -14,7 +14,7 @@ import { useEffect, useRef, } from '@wordpress/element'; -import { __ } from '@wordpress/i18n'; +import { __, isRTL } from '@wordpress/i18n'; import { useResizeObserver, useMergeRefs, @@ -64,7 +64,7 @@ function bubbleEvent( event, Constructor, frame ) { } /** - * Bubbles some event types (keydown, keypress, and dragover) to parent document + * Bubbles some event types (keydown, keypress, and dragover) to parent * document to ensure that the keyboard shortcuts and drag and drop work. * * Ideally, we should remove event bubbling in the future. Keyboard shortcuts @@ -112,15 +112,14 @@ function Iframe( { title = __( 'Editor canvas' ), ...props } ) { - const { resolvedAssets, isPreviewMode, siteLocale, userLocale } = useSelect( + const { resolvedAssets, isPreviewMode, siteLocale } = useSelect( ( select ) => { const { getSettings } = select( blockEditorStore ); const settings = getSettings(); return { resolvedAssets: settings.__unstableResolvedAssets, isPreviewMode: settings.__unstableIsPreviewMode, - siteLocale: settings.locale?.site, - userLocale: settings.locale?.user, + siteLocale: settings.siteLocale, }; }, [] @@ -288,7 +287,7 @@ function Iframe( { and should therefore match the editor UI's directionality. */ .block-editor-block-list__layout .components-placeholder { - direction: ${ userLocale?.isRTL ? 'rtl' : 'ltr' }; + direction: ${ isRTL() ? 'rtl' : 'ltr' }; } ${ styles } diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index 6aa2763cf9db0..aaa9a0fb8184e 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -75,6 +75,7 @@ const BLOCK_EDITOR_SETTINGS = [ 'postsPerPage', 'readOnly', 'sectionRootClientId', + 'siteLocale', 'styles', 'titlePlaceholder', 'supportsLayout',