Merge pull request #25877 from overleaf/td-limit-browser-translate

Prevent browser translation of stuff that shouldn't be translated in project dashboard

GitOrigin-RevId: aba5d28d368277730d3bdc9aced6b9257cbd7950
This commit is contained in:
Tim Down
2025-06-17 08:05:14 +00:00
committed by Copybot
parent 68b79ddb5d
commit e1b04ade05
18 changed files with 50 additions and 18 deletions
@@ -15,7 +15,10 @@ function CommonsPlan({
}: CommonsPlanProps) { }: CommonsPlanProps) {
const { t } = useTranslation() const { t } = useTranslation()
const currentPlanLabel = ( const currentPlanLabel = (
<Trans i18nKey="premium_plan_label" components={{ b: <strong /> }} /> <Trans
i18nKey="premium_plan_label"
components={{ b: <strong translate="no" /> }}
/>
) )
return ( return (
@@ -10,7 +10,10 @@ type FreePlanProps = Pick<FreePlanSubscription, 'featuresPageURL'>
function FreePlan({ featuresPageURL }: FreePlanProps) { function FreePlan({ featuresPageURL }: FreePlanProps) {
const { t } = useTranslation() const { t } = useTranslation()
const currentPlanLabel = ( const currentPlanLabel = (
<Trans i18nKey="free_plan_label" components={{ b: <strong /> }} /> <Trans
i18nKey="free_plan_label"
components={{ b: <strong translate="no" /> }}
/>
) )
const handleClick = () => { const handleClick = () => {
@@ -15,21 +15,25 @@ function GroupPlan({
remainingTrialDays, remainingTrialDays,
}: GroupPlanProps) { }: GroupPlanProps) {
const { t } = useTranslation() const { t } = useTranslation()
const planNameComponent = <strong translate="no" />
const currentPlanLabel = const currentPlanLabel =
remainingTrialDays >= 0 ? ( remainingTrialDays >= 0 ? (
remainingTrialDays === 1 ? ( remainingTrialDays === 1 ? (
<Trans i18nKey="trial_last_day" components={{ b: <strong /> }} /> <Trans i18nKey="trial_last_day" components={{ b: planNameComponent }} />
) : ( ) : (
<Trans <Trans
i18nKey="trial_remaining_days" i18nKey="trial_remaining_days"
components={{ b: <strong /> }} components={{ b: planNameComponent }}
values={{ days: remainingTrialDays }} values={{ days: remainingTrialDays }}
shouldUnescape shouldUnescape
tOptions={{ interpolation: { escapeValue: true } }} tOptions={{ interpolation: { escapeValue: true } }}
/> />
) )
) : ( ) : (
<Trans i18nKey="premium_plan_label" components={{ b: <strong /> }} /> <Trans
i18nKey="premium_plan_label"
components={{ b: planNameComponent }}
/>
) )
return ( return (
@@ -14,21 +14,25 @@ function IndividualPlan({
remainingTrialDays, remainingTrialDays,
}: IndividualPlanProps) { }: IndividualPlanProps) {
const { t } = useTranslation() const { t } = useTranslation()
const planNameComponent = <strong translate="no" />
const currentPlanLabel = const currentPlanLabel =
remainingTrialDays >= 0 ? ( remainingTrialDays >= 0 ? (
remainingTrialDays === 1 ? ( remainingTrialDays === 1 ? (
<Trans i18nKey="trial_last_day" components={{ b: <strong /> }} /> <Trans i18nKey="trial_last_day" components={{ b: planNameComponent }} />
) : ( ) : (
<Trans <Trans
i18nKey="trial_remaining_days" i18nKey="trial_remaining_days"
components={{ b: <strong /> }} components={{ b: planNameComponent }}
values={{ days: remainingTrialDays }} values={{ days: remainingTrialDays }}
shouldUnescape shouldUnescape
tOptions={{ interpolation: { escapeValue: true } }} tOptions={{ interpolation: { escapeValue: true } }}
/> />
) )
) : ( ) : (
<Trans i18nKey="premium_plan_label" components={{ b: <strong /> }} /> <Trans
i18nKey="premium_plan_label"
components={{ b: planNameComponent }}
/>
) )
return ( return (
@@ -13,7 +13,7 @@ function PausedPlan({ subscriptionPageUrl }: PausedPlanProps) {
i18nKey="your_premium_plan_is_paused" i18nKey="your_premium_plan_is_paused"
components={[ components={[
// eslint-disable-next-line react/jsx-key // eslint-disable-next-line react/jsx-key
<strong />, <strong translate="no" />,
]} ]}
/> />
) )
@@ -154,7 +154,7 @@ function SidebarDsNav() {
</> </>
)} )}
</div> </div>
<div className="ds-nav-ds-name"> <div className="ds-nav-ds-name" translate="no">
<span>Digital Science</span> <span>Digital Science</span>
</div> </div>
</div> </div>
@@ -57,6 +57,7 @@ export default function TagsList() {
<button <button
type="button" type="button"
className="tag-name" className="tag-name"
translate="no"
onClick={e => onClick={e =>
handleSelectTag(e as unknown as React.MouseEvent, tag._id) handleSelectTag(e as unknown as React.MouseEvent, tag._id)
} }
@@ -57,6 +57,7 @@ function InlineTag({ tag, projectId }: InlineTagProps) {
onClick: () => handleRemoveTag(tag._id, projectId), onClick: () => handleRemoveTag(tag._id, projectId),
}} }}
className="ms-2" className="ms-2"
translate="no"
> >
{tag.name} {tag.name}
</Tag> </Tag>
@@ -19,7 +19,7 @@ export default function LastUpdatedCell({ project }: LastUpdatedCellProps) {
overlayProps={{ placement: 'top', trigger: ['hover', 'focus'] }} overlayProps={{ placement: 'top', trigger: ['hover', 'focus'] }}
> >
{project.lastUpdatedBy ? ( {project.lastUpdatedBy ? (
<span> <span translate="no">
<LastUpdatedBy <LastUpdatedBy
lastUpdatedBy={project.lastUpdatedBy} lastUpdatedBy={project.lastUpdatedBy}
lastUpdatedDate={lastUpdatedDate} lastUpdatedDate={lastUpdatedDate}
@@ -47,7 +47,7 @@ export default function OwnerCell({ project }: OwnerCellProps) {
return ( return (
<> <>
{ownerName === 'You' ? t('you') : ownerName} <span translate="no">{ownerName === 'You' ? t('you') : ownerName}</span>
{project.source === 'token' && ( {project.source === 'token' && (
<LinkSharingIcon project={project} prependSpace={!!project.owner} /> <LinkSharingIcon project={project} prependSpace={!!project.owner} />
)} )}
@@ -7,7 +7,7 @@ export const ProjectListOwnerName = memo<{ ownerName: string }>(
const x = ownerName === 'You' ? t('you') : ownerName const x = ownerName === 'You' ? t('you') : ownerName
return <> — {t('owned_by_x', { x })}</> return <span translate="no"> — {t('owned_by_x', { x })}</span>
} }
) )
ProjectListOwnerName.displayName = 'ProjectListOwnerName' ProjectListOwnerName.displayName = 'ProjectListOwnerName'
@@ -22,7 +22,9 @@ function ProjectListTableRow({ project, selected }: ProjectListTableRowProps) {
<ProjectCheckbox projectId={project.id} projectName={project.name} /> <ProjectCheckbox projectId={project.id} projectName={project.name} />
</td> </td>
<td className="dash-cell-name"> <td className="dash-cell-name">
<a href={`/project/${project.id}`}>{project.name}</a>{' '} <a href={`/project/${project.id}`} translate="no">
{project.name}
</a>{' '}
<InlineTags className="d-none d-md-inline" projectId={project.id} /> <InlineTags className="d-none d-md-inline" projectId={project.id} />
</td> </td>
<td className="dash-cell-date-owner pb-0 d-md-none"> <td className="dash-cell-date-owner pb-0 d-md-none">
@@ -111,6 +111,7 @@ function TagsDropdown() {
<DropdownItem.EmptyLeadingIcon /> <DropdownItem.EmptyLeadingIcon />
) )
} }
translate="no"
> >
<div className="badge-tag-content"> <div className="badge-tag-content">
<span className="badge-prepend"> <span className="badge-prepend">
@@ -16,9 +16,11 @@ function ProjectListTitle({
}) { }) {
const { t } = useTranslation() const { t } = useTranslation()
let message = t('projects') let message = t('projects')
let extraProps = {}
if (selectedTag) { if (selectedTag) {
message = `${selectedTag.name}` message = `${selectedTag.name}`
extraProps = { translate: 'no' }
} else if (selectedTagId === UNCATEGORIZED_KEY) { } else if (selectedTagId === UNCATEGORIZED_KEY) {
message = t('uncategorized_projects') message = t('uncategorized_projects')
} else { } else {
@@ -42,7 +44,12 @@ function ProjectListTitle({
} }
return ( return (
<div className={classnames('project-list-title', className)}>{message}</div> <div
className={classnames('project-list-title', className)}
{...extraProps}
>
{message}
</div>
) )
} }
@@ -26,7 +26,7 @@ function FatFooterBase() {
<footer className="fat-footer-base"> <footer className="fat-footer-base">
<div className="fat-footer-base-section fat-footer-base-meta"> <div className="fat-footer-base-section fat-footer-base-meta">
<div className="fat-footer-base-item"> <div className="fat-footer-base-item">
<div className="fat-footer-base-copyright"> <div className="fat-footer-base-copyright" translate="no">
© {currentYear} Overleaf © {currentYear} Overleaf
</div> </div>
<FooterBaseLink href="/legal"> <FooterBaseLink href="/legal">
@@ -49,7 +49,7 @@ function LanguagePicker({ showHeader } = { showHeader: false }) {
return null return null
const isActive = subdomainDetails.lngCode === currentLangCode const isActive = subdomainDetails.lngCode === currentLangCode
return ( return (
<li role="none" key={subdomain}> <li role="none" key={subdomain} translate="no">
<DropdownItem <DropdownItem
href={`${subdomainDetails.url}${currentUrlWithQueryParams}`} href={`${subdomainDetails.url}${currentUrlWithQueryParams}`}
active={isActive} active={isActive}
@@ -46,6 +46,7 @@ export type DropdownItemProps = PropsWithChildren<{
target?: string target?: string
download?: boolean | string download?: boolean | string
rel?: string rel?: string
translate?: React.HTMLAttributes<HTMLElement>['translate']
}> }>
export type DropdownToggleProps = PropsWithChildren<{ export type DropdownToggleProps = PropsWithChildren<{
@@ -38,7 +38,12 @@ function MaterialIcon({
return ( return (
<> <>
<span className={iconClassName} aria-hidden="true" {...rest}> <span
className={iconClassName}
aria-hidden="true"
translate="no"
{...rest}
>
{type} {type}
</span> </span>
{accessibilityLabel && ( {accessibilityLabel && (