Skip to content

Commit f0f7588

Browse files
committed
Internationalize footer component by extracting translations, updating button styles, and adjusting compacting behavior
- do not shorten to single word 'apply', prefer not showing label at all - hide 'undo' before hiding 'apply from clipboard' - translations of footer should live in `apps/editor/src/views/panel/frontend/i18n/translations/footer.ts` - action.* translations in `apps/editor/src/views/panel/frontend/components/Layout/Footer/Footer.tsx` move to `apps/editor/src/views/panel/frontend/i18n/translations/footer.ts`
1 parent 2354271 commit f0f7588

5 files changed

Lines changed: 116 additions & 58 deletions

File tree

‎apps/editor/src/views/panel/frontend/components/Layout/Footer/Footer.module.scss‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@
7070
flex-shrink: 0;
7171
gap: 4px;
7272
height: var(--button-size);
73-
padding: 0 7px 0 4px;
73+
padding: 0 6px 0 3px;
7474
border-radius: 4px;
75-
border: 1px solid var(--cwc-border-color);
7675

7776
&:hover:not(:disabled) {
78-
border-color: var(--cwc-border-color-hover);
77+
background-color: var(--vscode-toolbar-hoverBackground);
7978
}
8079

8180
&:disabled {

‎apps/editor/src/views/panel/frontend/components/Layout/Footer/Footer.tsx‎

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const Footer: React.FC = () => {
1919
const [is_apply_disabled_temporarily, set_is_apply_disabled_temporarily] =
2020
useState(false)
2121

22-
const { container_ref, compact_step, report_width } = use_compacting(4)
22+
const { container_ref, compact_step, report_width } = use_compacting(2)
2323
const left_ref = useRef<HTMLDivElement>(null)
2424
const right_ref = useRef<HTMLDivElement>(null)
2525

@@ -60,7 +60,7 @@ export const Footer: React.FC = () => {
6060
styles['footer__icon-button--discord']
6161
)}
6262
href="https://discord.gg/KJySXsrSX5"
63-
title="Get involved"
63+
title={t('footer.get-involved')}
6464
>
6565
<UiIcon variant="DISCORD" />
6666
</a>
@@ -69,44 +69,40 @@ export const Footer: React.FC = () => {
6969
<div ref={right_ref}>
7070
<button
7171
className={cn(styles['footer__action-button'], {
72-
[styles['footer__action-button--compact']]: compact_step >= 4
72+
[styles['footer__action-button--compact']]: compact_step >= 1
7373
})}
74-
onClick={handle_apply_click}
75-
title={'Integrate copied chat response or a single code block'}
76-
disabled={is_apply_disabled_temporarily}
74+
onClick={on_undo_click}
75+
title={t('footer.undo-title')}
76+
disabled={!can_undo}
7777
>
7878
<span
7979
className={cn(
8080
styles['footer__action-button__icon'],
8181
'codicon',
82-
'codicon-clippy'
82+
'codicon-discard'
8383
)}
8484
/>
8585
<span className={styles['footer__action-button__text']}>
86-
{compact_step == 0
87-
? t('action.apply-from-clipboard')
88-
: t('action.apply')}
86+
{t('footer.action.undo')}
8987
</span>
9088
</button>
9189
<button
9290
className={cn(styles['footer__action-button'], {
93-
[styles['footer__action-button--compact']]: compact_step >= 3
91+
[styles['footer__action-button--compact']]: compact_step >= 2
9492
})}
95-
onClick={on_undo_click}
96-
title={
97-
'Restore saved state of the codebase after chat/API response integration'
98-
}
99-
disabled={!can_undo}
93+
onClick={handle_apply_click}
94+
title={t('footer.apply-title')}
95+
disabled={is_apply_disabled_temporarily}
10096
>
10197
<span
10298
className={cn(
10399
styles['footer__action-button__icon'],
104100
'codicon',
105-
'codicon-discard'
101+
'codicon-clippy'
106102
)}
107103
/>
108104
<span className={styles['footer__action-button__text']}>
109-
{t('action.undo')}
105+
{t('footer.action.apply-from-clipboard')}
110106
</span>
111107
</button>
112108
</div>

‎apps/editor/src/views/panel/frontend/i18n/translations/actions.ts‎

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -160,41 +160,5 @@ export const actions = {
160160
cs: 'Použít',
161161
hu: 'Alkalmaz',
162162
bg: 'Приложи'
163-
},
164-
'action.apply-from-clipboard': {
165-
en: 'Apply from Clipboard',
166-
pl: 'Integruj ze schowka',
167-
'zh-cn': '从剪贴板应用',
168-
ja: 'クリップボードから適用',
169-
'zh-tw': '從剪貼簿應用',
170-
de: 'Aus Zwischenablage anwenden',
171-
es: 'Aplicar desde el portapapeles',
172-
fr: 'Appliquer depuis le presse-papiers',
173-
'pt-br': 'Aplicar da área de transferência',
174-
ru: 'Применить из буфера обмена',
175-
ko: '클립보드에서 적용',
176-
it: 'Applica dagli appunti',
177-
tr: 'Panodan Uygula',
178-
cs: 'Použít ze schránky',
179-
hu: 'Alkalmazás vágólapról',
180-
bg: 'Приложи от клипборда'
181-
},
182-
'action.undo': {
183-
en: 'Undo',
184-
pl: 'Cofnij',
185-
'zh-cn': '撤销',
186-
ja: '元に戻す',
187-
'zh-tw': '復原',
188-
de: 'Rückgängig',
189-
es: 'Deshacer',
190-
fr: 'Annuler',
191-
'pt-br': 'Desfazer',
192-
ru: 'Отменить',
193-
ko: '실행 취소',
194-
it: 'Annulla',
195-
tr: 'Geri Al',
196-
cs: 'Zpět',
197-
hu: 'Visszavonás',
198-
bg: 'Отмяна'
199163
}
200164
} as const
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
export const footer = {
2+
'footer.get-involved': {
3+
en: 'Get involved',
4+
pl: 'Zaangażuj się',
5+
'zh-cn': '参与其中',
6+
ja: '参加する',
7+
'zh-tw': '參與其中',
8+
de: 'Mach mit',
9+
es: 'Involúcrate',
10+
fr: 'Impliquez-vous',
11+
'pt-br': 'Envolva-se',
12+
ru: 'Присоединиться',
13+
ko: '참여하기',
14+
it: 'Partecipa',
15+
tr: 'Katılın',
16+
cs: 'Zapojit se',
17+
hu: 'Vegyél részt',
18+
bg: 'Включете се'
19+
},
20+
'footer.undo-title': {
21+
en: 'Restore saved state of the codebase after chat/API response integration',
22+
pl: 'Przywróć zapisany stan kodu po integracji z czatem/odpowiedzią API',
23+
'zh-cn': '在聊天/API响应集成后恢复代码库的保存状态',
24+
ja: 'チャット/API応答の統合後、コードベースの保存された状態を復元する',
25+
'zh-tw': '在聊天/API響應集成後恢復代碼庫的保存狀態',
26+
de: 'Stellen Sie den gespeicherten Zustand der Codebasis nach der Chat-/API-Antwortintegration wieder her',
27+
es: 'Restaurar el estado guardado del código base después de la integración de respuesta de chat/API',
28+
fr: "Restaurer l'état enregistré de la base de code après l'intégration de la réponse du chat/API",
29+
'pt-br':
30+
'Restaurar o estado salvo da base de código após a integração de resposta de bate-papo/API',
31+
ru: 'Восстановить сохраненное состояние кодовой базы после интеграции ответа чата/API',
32+
ko: '채팅/API 응답 통합 후 코드베이스의 저장된 상태 복원',
33+
it: 'Ripristina lo stato salvato del codice base dopo integrazione della risposta di chat/API',
34+
tr: 'Sohbet/API yanıt entegrasyonundan sonra kod tabanının kaydedilen durumunu geri yükle',
35+
cs: 'Obnovit uložený stav kódové báze po integraci chatové/API odpovědi',
36+
hu: 'Állítsa vissza a kódbázis mentett állapotát a csevegés/API-válasz integrálása után',
37+
bg: 'Възстановете запазеното състояние на кодовата база след интегриране на чат/API отговор'
38+
},
39+
'footer.apply-title': {
40+
en: 'Integrate copied chat response or a single code block',
41+
pl: 'Zintegruj skopiowaną odpowiedź czatu lub pojedynczy blok kodu',
42+
'zh-cn': '集成复制的聊天响应或单个代码块',
43+
ja: 'コピーされたチャットの応答または単一のコードブロックを統合する',
44+
'zh-tw': '集成複製的聊天響應或單個代碼塊',
45+
de: 'Integrieren Sie eine kopierte Chat-Antwort oder einen einzelnen Codeblock',
46+
es: 'Integrar respuesta de chat copiada o un solo bloque de código',
47+
fr: 'Intégrer la réponse du chat copiée ou un seul bloc de code',
48+
'pt-br':
49+
'Integrar resposta de bate-papo copiada ou um único bloco de código',
50+
ru: 'Интегрировать скопированный ответ чата или отдельный блок кода',
51+
ko: '복사된 채팅 응답 또는 단일 코드 블록 통합',
52+
it: 'Integra la risposta della chat copiata o un singolo blocco di codice',
53+
tr: 'Kopyalanan sohbet yanıtını veya tek bir kod bloğunu entegre et',
54+
cs: 'Integrovat zkopírovanou chatovou odpověď nebo jeden blok kódu',
55+
hu: 'Integrálja a másolt csevegési választ vagy egyetlen kódblokkot',
56+
bg: 'Интегрирайте копиран отговор от чата или един кодов блок'
57+
},
58+
59+
'footer.action.apply-from-clipboard': {
60+
en: 'Apply from Clipboard',
61+
pl: 'Integruj ze schowka',
62+
'zh-cn': '从剪贴板应用',
63+
ja: 'クリップボードから適用',
64+
'zh-tw': '從剪貼簿應用',
65+
de: 'Aus Zwischenablage anwenden',
66+
es: 'Aplicar desde el portapapeles',
67+
fr: 'Appliquer depuis le presse-papiers',
68+
'pt-br': 'Aplicar da área de transferência',
69+
ru: 'Применить из буфера обмена',
70+
ko: '클립보드에서 적용',
71+
it: 'Applica dagli appunti',
72+
tr: 'Panodan Uygula',
73+
cs: 'Použít ze schránky',
74+
hu: 'Alkalmazás vágólapról',
75+
bg: 'Приложи от клипборда'
76+
},
77+
78+
'footer.action.undo': {
79+
en: 'Undo',
80+
pl: 'Cofnij',
81+
'zh-cn': '撤销',
82+
ja: '元に戻す',
83+
'zh-tw': '復原',
84+
de: 'Rückgängig',
85+
es: 'Deshacer',
86+
fr: 'Annuler',
87+
'pt-br': 'Desfazer',
88+
ru: 'Отменить',
89+
ko: '실행 취소',
90+
it: 'Annulla',
91+
tr: 'Geri Al',
92+
cs: 'Zpět',
93+
hu: 'Visszavonás',
94+
bg: 'Отмяна'
95+
}
96+
} as const

‎apps/editor/src/views/panel/frontend/i18n/translations/index.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ import { actions } from './actions'
55
import { prompt_field } from './prompt-field'
66
import { recent_donations } from './recent-donations'
77

8+
import { footer } from './footer'
9+
810
export const translations = {
911
...header,
1012
...home,
1113
...configurations,
1214
...actions,
1315
...prompt_field,
14-
...recent_donations
16+
...recent_donations,
17+
...footer
1518
}

0 commit comments

Comments
 (0)