Skip to content

Commit 1e78bfe

Browse files
committed
Update browser connection status component with internationalization and default theme
- translate [Fragment]
1 parent 9d9ce02 commit 1e78bfe

4 files changed

Lines changed: 83 additions & 10 deletions

File tree

‎apps/editor/src/views/prompt/frontend/Main/MainView/MainView.tsx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styles from './MainView.module.scss'
22
import { Configurations as UiConfigurations } from '@ui/components/editor/prompt/Configurations'
33
import { PromptField as UiPromptField } from '@ui/components/editor/common/prompts/PromptField'
4-
import { PromptAttachments as UiPromptAttachments } from './components/PromptAttachments'
4+
import { PromptAttachments } from './components/PromptAttachments'
55
import { Separator as UiSeparator } from '@ui/components/editor/prompt/Separator'
66
import { WebConfiguration } from '@shared/types/web-configuration'
77
import { Responses as UiResponses } from '@ui/components/editor/prompt/Responses'
@@ -10,7 +10,7 @@ import { EditFormat } from '@shared/types/edit-format'
1010
import { TARGET, Target } from '@shared/types/mode'
1111
import { ApiPromptType, WebPromptType } from '@shared/types/prompt-types'
1212
import { Scrollable as UiScrollable } from '@ui/components/editor/common/Scrollable'
13-
import { BrowserConnectionStatus as UiBrowserConnectionStatus } from './components/BrowserConnectionStatus'
13+
import { BrowserConnectionStatus } from './components/BrowserConnectionStatus'
1414
import { ApiConfiguration } from '@/views/prompt/types/messages'
1515
import { use_last_choice_tooltip } from './hooks/use-last-choice-tooltip'
1616
import { Header } from './components/Header'
@@ -248,15 +248,15 @@ export const MainView: React.FC<Props> = (props) => {
248248
<UiScrollable scroll_to_top_key={props.scroll_reset_key} top_shadow>
249249
<div className={styles.container}>
250250
{props.target == TARGET.WEB && (
251-
<UiBrowserConnectionStatus
251+
<BrowserConnectionStatus
252252
is_connected={props.is_connected}
253253
has_responses={props.response_history.length > 0}
254254
on_install={props.on_install_browser_extension}
255255
translations={{
256-
connected: 'Connected!',
257-
not_connected: 'Not connected',
258-
install: 'Install',
259-
hide: 'Hide'
256+
connected: t('main.browser-connection.connected'),
257+
not_connected: t('main.browser-connection.not-connected'),
258+
install: t('main.browser-connection.install'),
259+
hide: t('main.browser-connection.hide')
260260
}}
261261
/>
262262
)}
@@ -379,7 +379,7 @@ export const MainView: React.FC<Props> = (props) => {
379379
/>
380380
</div>
381381

382-
<UiPromptAttachments
382+
<PromptAttachments
383383
token_count={props.selected_files_token_count}
384384
files_count={
385385
context_is_empty_warning ? undefined : props.selected_files.length

‎apps/editor/src/views/prompt/frontend/Main/MainView/components/BrowserConnectionStatus/BrowserConnectionStatus.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const BrowserConnectionStatus: React.FC<Props> = (props) => {
3232
if (!props.is_connected) {
3333
actions.push({
3434
id: 'install',
35-
icon: 'codicon-desktop-download',
35+
icon: 'codicon-add',
3636
label: props.translations.install,
3737
title: props.translations.install,
3838
on_click: props.on_install
@@ -50,7 +50,7 @@ export const BrowserConnectionStatus: React.FC<Props> = (props) => {
5050
return (
5151
<StatusBar
5252
placement="top"
53-
theme={props.is_connected ? 'success' : 'warning'}
53+
theme={props.is_connected ? 'success' : 'default'}
5454
icon={
5555
props.is_connected
5656
? 'codicon-debug-connected'

‎apps/editor/src/views/prompt/frontend/i18n/translations/main.ts‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,77 @@ export const main = {
8888
cs: ' tokenů',
8989
hu: ' token',
9090
bg: ' токена'
91+
},
92+
'main.browser-connection.connected': {
93+
en: 'Connected!',
94+
pl: 'Połączono!',
95+
'zh-cn': '已连接!',
96+
ja: '接続されました!',
97+
'zh-tw': '已連線!',
98+
de: 'Verbunden!',
99+
es: '¡Conectado!',
100+
fr: 'Connecté !',
101+
'pt-br': 'Conectado!',
102+
ru: 'Подключено!',
103+
ko: '연결됨!',
104+
it: 'Connesso!',
105+
tr: 'Bağlandı!',
106+
cs: 'Připojeno!',
107+
hu: 'Csatlakoztatva!',
108+
bg: 'Свързано!'
109+
},
110+
'main.browser-connection.not-connected': {
111+
en: 'Not connected',
112+
pl: 'Brak połączenia',
113+
'zh-cn': '未连接',
114+
ja: '未接続',
115+
'zh-tw': '未連線',
116+
de: 'Nicht verbunden',
117+
es: 'No conectado',
118+
fr: 'Non connecté',
119+
'pt-br': 'Não conectado',
120+
ru: 'Нет подключения',
121+
ko: '연결되지 않음',
122+
it: 'Non connesso',
123+
tr: 'Bağlı değil',
124+
cs: 'Nepřipojeno',
125+
hu: 'Nincs csatlakoztatva',
126+
bg: 'Няма връзка'
127+
},
128+
'main.browser-connection.install': {
129+
en: 'Add to browser',
130+
pl: 'Dodaj do przeglądarki',
131+
'zh-cn': '添加到浏览器',
132+
ja: 'ブラウザに追加',
133+
'zh-tw': '新增至瀏覽器',
134+
de: 'Zum Browser hinzufügen',
135+
es: 'Añadir al navegador',
136+
fr: 'Ajouter au navigateur',
137+
'pt-br': 'Adicionar ao navegador',
138+
ru: 'Добавить в браузер',
139+
ko: '브라우저에 추가',
140+
it: 'Aggiungi al browser',
141+
tr: 'Tarayıcıya ekle',
142+
cs: 'Přidat do prohlížeče',
143+
hu: 'Hozzáadás a böngészőhöz',
144+
bg: 'Добавяне към браузъра'
145+
},
146+
'main.browser-connection.hide': {
147+
en: 'Hide',
148+
pl: 'Ukryj',
149+
'zh-cn': '隐藏',
150+
ja: '非表示',
151+
'zh-tw': '隱藏',
152+
de: 'Ausblenden',
153+
es: 'Ocultar',
154+
fr: 'Masquer',
155+
'pt-br': 'Ocultar',
156+
ru: 'Скрыть',
157+
ko: '숨기기',
158+
it: 'Nascondi',
159+
tr: 'Gizle',
160+
cs: 'Skrýt',
161+
hu: 'Elrejtés',
162+
bg: 'Скриване'
91163
}
92164
} as const

‎packages/ui/src/components/editor/prompt/StatusBar/StatusBar.module.scss‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
--height: 24px;
33
display: flex;
44
align-items: center;
5+
gap: 2px;
56
justify-content: space-between;
67
height: var(--height);
78
padding: 0 0 0 5px;

0 commit comments

Comments
 (0)