question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[docs] Wrong version localized URL

See original GitHub issue

The issue was first reported by @jaironalves. We hard-code the link to the versions URL without taking the locale into account:

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:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tchmnncommented, Jun 14, 2020

@oliviertassinari @jaironalves anybody working on this?

0reactions
jaironalvescommented, Jun 14, 2020

@oliviertassinari @jaironalves anybody working on this?

@tchmnn at moment no. You can take it.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found