Skip to content

Commit

Permalink
do not mutate translation input args
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Feb 16, 2023
1 parent b629694 commit c44511d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/docusaurus-theme-classic/src/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ function translateNavbar(
return navbar;
}

const {logo} = navbar;

if (logo) {
logo.alt = navbarTranslations[`logo.alt`]?.message ?? navbar.logo?.alt;
}
const logo = navbar.logo
? {
...navbar.logo,
alt: navbarTranslations[`logo.alt`]?.message ?? navbar.logo?.alt,
}
: undefined;

return {
...navbar,
Expand Down Expand Up @@ -184,11 +185,12 @@ function translateFooter(

const copyright = footerTranslations.copyright?.message ?? footer.copyright;

const {logo} = footer;

if (logo) {
logo.alt = footerTranslations[`logo.alt`]?.message ?? footer.logo?.alt;
}
const logo = footer.logo
? {
...footer.logo,
alt: footerTranslations[`logo.alt`]?.message ?? footer.logo?.alt,
}
: undefined;

return {
...footer,
Expand Down

0 comments on commit c44511d

Please sign in to comment.