mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-01 17:59:09 +08:00
feat: added translation support for non-english languages
This commit is contained in:
parent
c6dba95fbc
commit
cbeb74d3dd
@ -53,7 +53,8 @@ const TranslateButton: FC<Props> = ({ text, onTranslated, disabled, style, isLoa
|
|||||||
const message = getUserMessage({
|
const message = getUserMessage({
|
||||||
assistant,
|
assistant,
|
||||||
topic: getDefaultTopic('default'),
|
topic: getDefaultTopic('default'),
|
||||||
type: 'text'
|
type: 'text',
|
||||||
|
content: text
|
||||||
})
|
})
|
||||||
|
|
||||||
const translatedText = await fetchTranslate({ message, assistant })
|
const translatedText = await fetchTranslate({ message, assistant })
|
||||||
|
|||||||
@ -35,7 +35,7 @@ interface Props {
|
|||||||
|
|
||||||
const SettingsTab: FC<Props> = (props) => {
|
const SettingsTab: FC<Props> = (props) => {
|
||||||
const { assistant, updateAssistantSettings, updateAssistant } = useAssistant(props.assistant.id)
|
const { assistant, updateAssistantSettings, updateAssistant } = useAssistant(props.assistant.id)
|
||||||
const { messageStyle, codeStyle, fontSize } = useSettings()
|
const { messageStyle, codeStyle, fontSize, language } = useSettings()
|
||||||
|
|
||||||
const [temperature, setTemperature] = useState(assistant?.settings?.temperature ?? DEFAULT_TEMPERATURE)
|
const [temperature, setTemperature] = useState(assistant?.settings?.temperature ?? DEFAULT_TEMPERATURE)
|
||||||
const [contextCount, setContextCount] = useState(assistant?.settings?.contextCount ?? DEFAULT_CONTEXTCOUNT)
|
const [contextCount, setContextCount] = useState(assistant?.settings?.contextCount ?? DEFAULT_CONTEXTCOUNT)
|
||||||
@ -330,15 +330,19 @@ const SettingsTab: FC<Props> = (props) => {
|
|||||||
/>
|
/>
|
||||||
</SettingRow>
|
</SettingRow>
|
||||||
<SettingDivider />
|
<SettingDivider />
|
||||||
<SettingRow>
|
{!language.startsWith('en') && (
|
||||||
<SettingRowTitleSmall>{t('settings.input.auto_translate_with_space')}</SettingRowTitleSmall>
|
<>
|
||||||
<Switch
|
<SettingRow>
|
||||||
size="small"
|
<SettingRowTitleSmall>{t('settings.input.auto_translate_with_space')}</SettingRowTitleSmall>
|
||||||
checked={autoTranslateWithSpace}
|
<Switch
|
||||||
onChange={(checked) => dispatch(setAutoTranslateWithSpace(checked))}
|
size="small"
|
||||||
/>
|
checked={autoTranslateWithSpace}
|
||||||
</SettingRow>
|
onChange={(checked) => dispatch(setAutoTranslateWithSpace(checked))}
|
||||||
<SettingDivider />
|
/>
|
||||||
|
</SettingRow>
|
||||||
|
<SettingDivider />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<SettingRow>
|
<SettingRow>
|
||||||
<SettingRowTitleSmall>{t('settings.messages.input.send_shortcuts')}</SettingRowTitleSmall>
|
<SettingRowTitleSmall>{t('settings.messages.input.send_shortcuts')}</SettingRowTitleSmall>
|
||||||
<Select
|
<Select
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user