File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/OnboardingSPA/steps/SiteGen/SiteDetails Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -54,20 +54,21 @@ const SiteGenSiteDetails = () => {
54
54
55
55
const isLargeViewport = useViewportMatch ( 'small' ) ;
56
56
const content = getContents ( ) ;
57
-
57
+
58
58
// Function to find English in language list or default to first language
59
59
const getDefaultLocale = ( ) => {
60
- const englishOption = content . languageList . find ( ( [ language ] ) =>
60
+ const englishOption = content . languageList . find ( ( [ language ] ) =>
61
61
language . toLowerCase ( ) . includes ( 'english' ) ) ;
62
- return englishOption ? englishOption [ 1 ] : ( content . languageList [ 0 ] ? content . languageList [ 0 ] [ 1 ] : '' ) ;
62
+ const defaultOption = content . languageList [ 0 ] ? content . languageList [ 0 ] [ 1 ] : '' ;
63
+ return englishOption ? englishOption [ 1 ] : defaultOption ;
63
64
} ;
64
65
65
66
// Set English as default if no locale is selected
66
67
useEffect ( ( ) => {
67
68
if ( ! selectedLocale && content . languageList && content . languageList . length > 0 ) {
68
69
const defaultLocale = getDefaultLocale ( ) ;
69
70
setSelectedLocale ( defaultLocale ) ;
70
-
71
+
71
72
// Update the store with the default locale
72
73
if ( defaultLocale ) {
73
74
currentData . sitegen . siteDetails . locale = defaultLocale ;
You can’t perform that action at this time.
0 commit comments