website icon indicating copy to clipboard operation
website copied to clipboard

Pages break when using the Portuguese language.

Open felipeparaizoo opened this issue 9 months ago • 6 comments

Hello, I'm looking at the electron.js documentation and I came across a broken page because it uses the Portuguese language when accessing it. When accessed in English, it loads fine, but the same doesn't happen when trying to access the URL:

https://www.electronjs.org/pt/docs/latest/why-electron

Image

felipeparaizoo avatar Feb 24 '26 13:02 felipeparaizoo

Thanks for reporting!

Looks like certain languages translate the URL slug and other languages don't:

  • German: https://www.electronjs.org/de/docs/latest/why-electron (not translated)
  • Portuguese: https://www.electronjs.org/pt/docs/latest/por-que-electron (translated)

nikwen avatar Mar 18 '26 00:03 nikwen

Hi @nikwen

When you select to change the language, it only changes the language directory, and the rest of the URL remains the same, for example:

https://www.electronjs.org/pt/docs/latest/por-que-electron (translated)

When you select to change to English, for example, it looks like this:

https://www.electronjs.org/docs/latest/por-que-electron (However, the URL remains translated to Portuguese)

The correct way would be:

https://www.electronjs.org/docs/latest/

I'll leave an explanatory video below:

https://github.com/user-attachments/assets/66ae490f-9f12-4fee-b956-e43b00d7a150

In my opinion, the easiest thing to do right now would be to disable URL translation and leave them all, for example, in this format:

https://www.electronjs.org/pt/docs/latest/why-electron

https://www.electronjs.org/zh/docs/latest/why-electron

https://www.electronjs.org/es/docs/latest/why-electron

These are the only URLs that currently deviate from this pattern.

felipeparaizoo avatar Mar 18 '26 11:03 felipeparaizoo

Hi @felipeparaizoo ! I don’t know if this could be useful, but you said that “These are the only URLs that currently deviate from this pattern.”

I was navigating through the website and noticed that I can’t access https://www.electronjs.org/fr/apps in French. /governance doesn’t work either.

I guess you are right, it's the URL translation and maybe because in English there is no /en/ tag in the URL. It could be useful, I don't know what you think about this.

Hope I was useful! Have a nice day !

MasterAcnolo avatar Jun 01 '26 19:06 MasterAcnolo

Hi @felipeparaizoo ! I don’t know if this could be useful, but you said that “These are the only URLs that currently deviate from this pattern.”

I was navigating through the website and noticed that I can’t access https://www.electronjs.org/fr/apps in French. /governance doesn’t work either.

I guess you are right, it's the URL translation and maybe because in English there is no /en/ tag in the URL. It could be useful, I don't know what you think about this.

Hope I was useful! Have a nice day !

Hi @MasterAcnolo !

Thank you very much for your feedback; these pages are indeed experiencing the problem I described above!

And I agree with you, I believe the quickest solution would be to remove the translations and leave them in the standard English format, only changing the language tags:

/en/, /pt/, /fr/, and so on.

Thank you very much for your collaboration!

felipeparaizoo avatar Jun 01 '26 19:06 felipeparaizoo

You're welcome! Always happy to help.

So If the URL structure is reworked to use a /en/ prefix and no longer relies on translated paths:

The new "problem" is backward-compatible links. For example, if we have https://www.electronjs.org/docs/latest/tutorial/performance, adding the standard /en/ like this https://www.electronjs.org/en/docs/latest/tutorial/performance returns a 404.

It means all the old links should redirect to the correct ones with /en/ inserted between the domain and the first path segment.

I don't know how difficult this would be in the current codebase. I’ll try to look into it, but with plain HTML it's pretty easy for just one or two pages manually. (But with the number of pages, it seems basically impossible.)

And a script that adds /en/ to the current page is pretty unreliable, so...

We also shouldn't forget that the old translated pages should still work, right? Backward compatibility is better than just throwing a basic error saying "the content moved".

I’ll look into it on my side, but I’m just putting this here in case anyone has a solution !

MasterAcnolo avatar Jun 01 '26 19:06 MasterAcnolo

Hi everyone! Am back maybe with a solution.

I've been thinking about the backward compatibility issue and I think server-side redirects are the cleanest fix here.

Since the website runs on Docusaurus, we could use @docusaurus/plugin-client-redirects directly in docusaurus.config.js. The plugin automatically loops over all configured locales, so you only need to define the redirect once without including the locale prefix:

{
  from: '/docs/latest/por-que-electron',
  to: '/docs/latest/why-electron',
}

Docusaurus will then generate the redirect for every locale (/pt/..., /fr/..., etc.) automatically.

For cases like /fr/apps or /governance that are just missing routes, we could handle those at the hosting level (_redirects on Netlify or vercel.json) as a fallback.

The trickiest part is building the full mapping of translated slugs back to their English equivalents, but that could be scripted from the existing i18n files rather than written by hand.

Does anyone know how the site is currently hosted? That would help figure out the best approach for the fallback cases.

MasterAcnolo avatar Jun 10 '26 20:06 MasterAcnolo