【发布时间】:2021-05-19 09:16:16
【问题描述】:
我已经如下设置了 Select 组件
<Select
styles={customStyles}
defaultValue={{ label: t('Text to be translated'), value: 'all' }}
components={{
IndicatorSeparator: () => null,
}}
isSearchable={isSearchable}
options={[
{ value: 'val1', label: t('text 1') },
{ value: 'val2', label: t('text 2') },
{ value: 'val3', label: t('text 3') },
]}
onChange={handleSelectChange}
isDisabled={disabled}
/>
我的defaultValue 仅在首次加载组件时翻译。更改语言不会以任何方式产生影响。文本以初始加载时选择的语言显示。但有趣的事实 - 选项翻译完全没有问题
【问题讨论】:
标签: reactjs internationalization react-select