[docs] Wrong version localized URL
See original GitHub issueThe issue was first reported by @jaironalves. We hard-code the link to the versions URL without taking the locale into account:
- https://github.com/mui-org/material-ui/blob/68d1953fc09c0deb8a6bc4ba5202f9f35df514d5/docs/src/modules/components/AppFooter.js#L159
- https://github.com/mui-org/material-ui/blob/68d1953fc09c0deb8a6bc4ba5202f9f35df514d5/docs/src/modules/components/AppDrawer.js#L156
I don’t know if we have a better alternative than:
diff --git a/docs/src/modules/components/AppDrawer.js b/docs/src/modules/components/AppDrawer.js
index ead6ab7fa..d63d96294 100644
--- a/docs/src/modules/components/AppDrawer.js
+++ b/docs/src/modules/components/AppDrawer.js
@@ -140,6 +140,8 @@ const iOS = process.browser && /iPad|iPhone|iPod/.test(navigator.userAgent);
function AppDrawer(props) {
const { classes, className, disablePermanent, mobileOpen, onClose, onOpen } = props;
const { activePage, pages } = React.useContext(PageContext);
+ const userLanguage = useSelector((state) => state.options.userLanguage);
+ const languagePrefix = userLanguage === 'en' ? '' : `/${userLanguage}`;
const t = useSelector((state) => state.options.t);
const drawer = (
@@ -153,7 +155,7 @@ function AppDrawer(props) {
<Link
color="textSecondary"
variant="caption"
- href="https://material-ui.com/versions/"
+ href={`https://material-ui.com${languagePrefix}/versions/`}
onClick={onClose}
>
{`v${process.env.LIB_VERSION}`}
diff --git a/docs/src/modules/components/AppFooter.js b/docs/src/modules/components/AppFooter.js
index a973d0b6a..e1a8d34aa 100644
--- a/docs/src/modules/components/AppFooter.js
+++ b/docs/src/modules/components/AppFooter.js
@@ -52,6 +52,8 @@ const styles = (theme) => ({
function AppFooter(props) {
const { classes } = props;
+ const userLanguage = useSelector((state) => state.options.userLanguage);
+ const languagePrefix = userLanguage === 'en' ? '' : `/${userLanguage}`;
const t = useSelector((state) => state.options.t);
return (
@@ -156,7 +158,7 @@ function AppFooter(props) {
versionNumber: (
<Link
color="inherit"
- href="https://material-ui.com/versions/"
+ href={`https://material-ui.com${languagePrefix}/versions/`}
aria-label={`v${process.env.LIB_VERSION}. View versions page.`}
>
{`v${process.env.LIB_VERSION}`}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Localized Versions of your Pages | Google Search Central
Localized versions of a page are only considered duplicates if the main content of the page remains untranslated. If playback doesn't begin ...
Read more >Incorrect Google-selected canonical for multilanguage ...
It says that "Localized versions of a page are only considered duplicates if the main content of the page remains untranslated." My pages...
Read more >Localized URLs Hardcoded - MDN - Mozilla Discourse
Good question! The best practice would be to remove the locale string from the URL (that is, start the relative URL with “/docs”)....
Read more >Core localization file download URL is wrong - Drupal
The cause is that #3016471: Make localization file download major version agnostic did not update the URL for downloading localizations for Core ...
Read more >Localizing help center content - Zendesk help
When localizing your help center, it makes sense to start by adding localized versions of category pages, followed by section pages, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@oliviertassinari @jaironalves anybody working on this?
@tchmnn at moment no. You can take it.