From 79978f026f688146425486dcb40ed3dd808ce8f6 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Fri, 4 Mar 2022 12:21:34 +0800 Subject: [PATCH] Localize the homepage selector too --- ui/component/homepageSelector/view.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/component/homepageSelector/view.jsx b/ui/component/homepageSelector/view.jsx index f728ad539..b083a3abb 100644 --- a/ui/component/homepageSelector/view.jsx +++ b/ui/component/homepageSelector/view.jsx @@ -1,8 +1,6 @@ // @flow import React from 'react'; -// $FlowFixMe -import homepages from 'homepages'; -import { getLanguageEngName } from 'constants/languages'; +import { getLanguageName } from 'constants/languages'; import { FormField } from 'component/common/form'; import { getDefaultHomepageKey } from 'util/default-languages'; @@ -13,14 +11,18 @@ type Props = { function SelectHomepage(props: Props) { const { homepage, setHomepage } = props; + const homepages = window.homepages || {}; + const homepageKeys = Object.keys(homepages); function handleSetHomepage(e) { const { value } = e.target; setHomepage(value); } - if (Object.keys(homepages).length <= 1) { + + if (homepageKeys.length <= 1) { return null; } + return ( - {Object.keys(homepages).map((hp) => ( + {homepageKeys.map((hp) => ( ))}