Add languages and further functionality to Translate (#29342)

GitOrigin-RevId: 5e575c2aa51490071bfbd7498fd81b4e30ffa77f
This commit is contained in:
Borja
2025-10-29 11:16:42 +01:00
committed by Copybot
parent 38edeca871
commit cb0cfcfd82
2 changed files with 56 additions and 8 deletions

View File

@@ -16,25 +16,31 @@ export const ToolbarButtonMenu: FC<
disabled?: boolean
disablePopover?: boolean
altCommand?: (view: EditorView) => void
onToggle?: (isOpen: boolean) => void
}>
> = memo(function ButtonMenu({
icon,
id,
label,
altCommand,
onToggle,
disabled,
disablePopover,
children,
}) {
const target = useRef<any>(null)
const { open, onToggle, ref } = useDropdown()
const { open, onToggle: handleToggle, ref } = useDropdown()
const view = useCodeMirrorViewContext()
useEffect(() => {
if (disablePopover && open) {
onToggle(false)
handleToggle(false)
}
}, [open, disablePopover, onToggle])
}, [open, disablePopover, handleToggle])
useEffect(() => {
onToggle?.(open)
}, [open, onToggle])
const button = (
<button
@@ -57,7 +63,7 @@ export const ToolbarButtonMenu: FC<
altCommand(view)
view.focus()
} else {
onToggle(!open)
handleToggle(!open)
}
}}
ref={target}
@@ -75,7 +81,7 @@ export const ToolbarButtonMenu: FC<
containerPadding={0}
transition
rootClose
onHide={() => onToggle(false)}
onHide={() => handleToggle(false)}
>
<OLPopover
id={`${id}-menu`}
@@ -85,7 +91,7 @@ export const ToolbarButtonMenu: FC<
<OLListGroup
role="menu"
onClick={() => {
onToggle(false)
handleToggle(false)
}}
>
{children}

View File

@@ -35,10 +35,31 @@ const en = {
'translate.es': 'Spanish',
'translate.de': 'German',
'translate.ja': 'Japanese',
'translate.sq': 'Albanian',
'translate.ar': 'Arabic',
'translate.bg': 'Bulgarian',
'translate.cs': 'Czech',
'translate.nl': 'Dutch',
'translate.fil': 'Filipino',
'translate.el': 'Greek',
'translate.he': 'Hebrew',
'translate.hu': 'Hungarian',
'translate.it': 'Italian',
'translate.ms': 'Malay',
'translate.fa': 'Persian(Farsi)',
'translate.pl': 'Polish',
'translate.ro': 'Romanian',
'translate.ru': 'Russian',
'translate.sr': 'Serbian',
'translate.sv': 'Swedish',
'translate.tr': 'Turkish',
'translate.uk': 'Ukrainian',
'translate.vi': 'Vietnamese',
'translate.other': 'Other',
'translate.not-listed': 'Language not listed?',
'translate.more-languages-coming-soon.title': 'More languages coming soon',
'translate.more-languages-coming-soon.body':
'Sorry, we dont currently offer any other languages for Translate. We will be adding more throughout October and November so watch this space!',
'Sorry, we dont currently offer any other languages for Translate. We will be adding more throughout November so watch this space!',
'blocked-suggestion-signpost.question':
'Do you want to permanently stop this suggestion from appearing again?',
'blocked-suggestion-signpost.tooltip': 'You can block a suggestion here.',
@@ -376,10 +397,31 @@ const es = {
'translate.es': 'Español',
'translate.de': 'Alemán',
'translate.ja': 'Japonés',
'translate.sq': 'Albanés',
'translate.ar': 'Árabe',
'translate.bg': 'Búlgaro',
'translate.cs': 'Checo',
'translate.nl': 'Neerlandés',
'translate.fil': 'Filipino',
'translate.el': 'Griego',
'translate.he': 'Hebreo',
'translate.hu': 'Húngaro',
'translate.it': 'Italiano',
'translate.ms': 'Malayo',
'translate.fa': 'Persa (Farsi)',
'translate.pl': 'Polaco',
'translate.ro': 'Rumano',
'translate.ru': 'Ruso',
'translate.sr': 'Serbio',
'translate.sv': 'Sueco',
'translate.tr': 'Turco',
'translate.uk': 'Ucraniano',
'translate.vi': 'Vietnamita',
'translate.other': 'Otro',
'translate.not-listed': '¿Idioma no listado?',
'translate.more-languages-coming-soon.title': 'Más idiomas próximamente',
'translate.more-languages-coming-soon.body':
'Lo sentimos, actualmente no ofrecemos otros idiomas para la traducción. Agregaremos más a lo largo de octubre y noviembre, ¡así que mantente atento!',
'Lo sentimos, actualmente no ofrecemos otros idiomas para la traducción. Agregaremos más a lo largo de noviembre, ¡así que mantente atento!',
'blocked-suggestion-signpost.question':
'¿Quieres dejar de ver esta sugerencia permanentemente? Puedes bloquear esta sugerencia aquí.',
'blocked-suggestion-signpost.tooltip':