Skip to content

Commit 173b453

Browse files
fix(ui): use i18n for live preview "Open in new window" tooltip (#16038)
The "Open in new window" title attribute in the live preview toolbar was hardcoded in English. Replace it with the existing `openInNewTab` translation key, which is already translated in all 44 supported languages. <!-- Thank you for the PR! Please go through the checklist below and make sure you've completed all the steps. Please review the [CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md) document in this repository if you haven't already. The following items will ensure that your PR is handled as smoothly as possible: - PR Title must follow conventional commits format. For example, `feat: my new feature`, `fix(plugin-seo): my fix`. - Minimal description explained as if explained to someone not immediately familiar with the code. - Provide before/after screenshots or code diffs if applicable. - Link any related issues/discussions from GitHub or Discord. - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? Replace hardcoded English string "Open in new window" with the existing `openInNewTab` i18n translation key in the live preview toolbar. ### Why? The tooltip stays in English regardless of the admin panel language setting. All other strings in this component already use the `useTranslation` hook. ### How? Changed `title="Open in new window"` to `title={t('general:openInNewTab')}` in `packages/ui/src/elements/LivePreview/Toolbar/Controls/index.tsx`. The `openInNewTab` key already exists in all 44 supported languages — no new translations needed. Fixes # --> --------- Co-authored-by: Paul Popus <paul@payloadcms.com>
1 parent 59f78f0 commit 173b453

46 files changed

Lines changed: 49 additions & 4 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/translations/src/clientKeys.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ export const clientTranslationKeys = createClientTranslationKeys([
312312
'general:noValue',
313313
'general:of',
314314
'general:open',
315+
'general:openInNewWindow',
315316
'general:only',
316317
'general:or',
317318
'general:order',

packages/translations/src/languages/ar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ export const arTranslations: DefaultTranslationsObject = {
380380
of: 'من',
381381
only: 'فقط',
382382
open: 'فتح',
383+
openInNewWindow: 'فتح في نافذة جديدة',
383384
or: 'أو',
384385
order: 'التّرتيب',
385386
overwriteExistingData: 'استبدل بيانات الحقل الموجودة',

packages/translations/src/languages/az.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ export const azTranslations: DefaultTranslationsObject = {
395395
of: 'dən',
396396
only: 'Yalnız',
397397
open: 'Aç',
398+
openInNewWindow: 'Yeni pəncərədə aç',
398399
or: 'Və ya',
399400
order: 'Sıra',
400401
overwriteExistingData: 'Mövcud sahə məlumatlarını yenidən yazın',

packages/translations/src/languages/bg.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ export const bgTranslations: DefaultTranslationsObject = {
392392
of: 'от',
393393
only: 'Само',
394394
open: 'Отвори',
395+
openInNewWindow: 'Отвори в нов прозорец',
395396
or: 'Или',
396397
order: 'Ред',
397398
overwriteExistingData: 'Презапишете съществуващите данни в полето',

packages/translations/src/languages/bnBd.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ export const bnBdTranslations: DefaultTranslationsObject = {
397397
of: 'এর',
398398
only: 'শুধুমাত্র',
399399
open: 'খুলুন',
400+
openInNewWindow: 'নতুন উইন্ডোতে খুলুন',
400401
or: 'বা',
401402
order: 'অর্ডার',
402403
overwriteExistingData: 'বিদ্যমান ফিল্ড ডেটা ওভাররাইট করুন',

packages/translations/src/languages/bnIn.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ export const bnInTranslations: DefaultTranslationsObject = {
396396
of: 'এর',
397397
only: 'শুধুমাত্র',
398398
open: 'খুলুন',
399+
openInNewWindow: 'নতুন উইন্ডোতে খুলুন',
399400
or: 'বা',
400401
order: 'অর্ডার',
401402
overwriteExistingData: 'বিদ্যমান ফিল্ড ডেটা ওভাররাইট করুন',

packages/translations/src/languages/ca.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ export const caTranslations: DefaultTranslationsObject = {
394394
of: 'de',
395395
only: 'Nomes',
396396
open: 'Obert',
397+
openInNewWindow: 'Obre en una finestra nova',
397398
or: 'O',
398399
order: 'Ordre',
399400
overwriteExistingData: 'Sobreescriu les dades existents',

packages/translations/src/languages/cs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ export const csTranslations: DefaultTranslationsObject = {
391391
of: 'z',
392392
only: 'Pouze',
393393
open: 'Otevřít',
394+
openInNewWindow: 'Otevřít v novém okně',
394395
or: 'Nebo',
395396
order: 'Pořadí',
396397
overwriteExistingData: 'Přepsat existující data pole',

packages/translations/src/languages/da.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ export const daTranslations: DefaultTranslationsObject = {
391391
of: 'Af',
392392
only: 'kun',
393393
open: 'Åben',
394+
openInNewWindow: 'Åbn i nyt vindue',
394395
or: 'Eller',
395396
order: 'Rækkefølge',
396397
overwriteExistingData: 'Overskriv eksisterende feltdata',

packages/translations/src/languages/de.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ export const deTranslations: DefaultTranslationsObject = {
401401
of: 'von',
402402
only: 'Nur',
403403
open: 'Öffnen',
404+
openInNewWindow: 'In neuem Fenster öffnen',
404405
or: 'oder',
405406
order: 'Reihenfolge',
406407
overwriteExistingData: 'Vorhandene Eingaben überschreiben',

0 commit comments

Comments
 (0)