File tree Expand file tree Collapse file tree 2 files changed +28
-11
lines changed
packages/ui/src/elements/PublishButton Expand file tree Collapse file tree 2 files changed +28
-11
lines changed Original file line number Diff line number Diff line change 33import type { PublishButtonClientProps } from 'payload'
44
55import { useModal } from '@faceless-ui/modal'
6+ import { getTranslation } from '@payloadcms/translations'
67import { hasAutosaveEnabled , hasScheduledPublishEnabled } from 'payload/shared'
78import * as qs from 'qs-esm'
89import React , { useCallback , useEffect , useState } from 'react'
@@ -49,7 +50,7 @@ export function PublishButton({ label: labelProp }: PublishButtonClientProps) {
4950 serverURL,
5051 } = config
5152
52- const { t } = useTranslation ( )
53+ const { i18n , t } = useTranslation ( )
5354 const label = labelProp || t ( 'version:publishChanges' )
5455
5556 const entityConfig = React . useMemo ( ( ) => {
@@ -197,11 +198,7 @@ export function PublishButton({ label: labelProp }: PublishButtonClientProps) {
197198 typeof locale === 'string' ? locale === localeCode : locale . code === localeCode ,
198199 )
199200
200- const activeLocaleLabel =
201- activeLocale &&
202- ( typeof activeLocale . label === 'string'
203- ? activeLocale . label
204- : ( activeLocale . label ?. [ localeCode ] ?? undefined ) )
201+ const activeLocaleLabel = activeLocale && getTranslation ( activeLocale . label , i18n )
205202
206203 if ( ! hasPublishPermission ) {
207204 return null
Original file line number Diff line number Diff line change @@ -443,27 +443,47 @@ export default buildConfigWithDefaults({
443443 } ,
444444 {
445445 code : defaultLocale ,
446- label : 'English' ,
446+ label : {
447+ de : 'Englisch' ,
448+ en : 'English' ,
449+ es : 'Inglés' ,
450+ } ,
447451 rtl : false ,
448452 } ,
449453 {
450454 code : spanishLocale ,
451- label : 'Spanish' ,
455+ label : {
456+ de : 'Spanisch' ,
457+ en : 'Spanish' ,
458+ es : 'Español' ,
459+ } ,
452460 rtl : false ,
453461 } ,
454462 {
455463 code : portugueseLocale ,
456464 fallbackLocale : spanishLocale ,
457- label : 'Portuguese' ,
465+ label : {
466+ de : 'Portugiesisch' ,
467+ en : 'Portuguese' ,
468+ es : 'Portugués' ,
469+ } ,
458470 } ,
459471 {
460472 code : 'ar' ,
461- label : 'Arabic' ,
473+ label : {
474+ de : 'Arabisch' ,
475+ en : 'Arabic' ,
476+ es : 'Árabe' ,
477+ } ,
462478 rtl : true ,
463479 } ,
464480 {
465481 code : hungarianLocale ,
466- label : 'Hungarian' ,
482+ label : {
483+ de : 'Ungarische' ,
484+ en : 'Hungarian' ,
485+ es : 'Húngaro' ,
486+ } ,
467487 rtl : false ,
468488 } ,
469489 ] ,
You can’t perform that action at this time.
0 commit comments