Fix portuguese urls

This commit is contained in:
koalasat 2025-02-26 11:36:45 +01:00
parent f007907b99
commit 8865db4e5f
No known key found for this signature in database
GPG Key ID: 2F7F61C6146AB157

View File

@ -4,7 +4,7 @@ function matchPageWithSelection(language, currentUrl){
// checks if parameter is 'en', if so, removes it from the url
newLanguage = language === 'en' ? '' : `${language}`;
// regex to match the current url and extract the language and the rest of the url
let regex = /(?:(?:(\/(?:docs|contribute|stats)\/))(?:(es|fr)\/)?(.*))|(\/(?:es|fr|pt)\/|\/)$/
let regex = /(?:(?:(\/(?:docs|contribute|stats)\/))(?:(es|fr|pt)\/)?(.*))|(\/(?:es|fr|pt)\/|\/)$/
let [fullURL, first, urlLang = 'en', rest, home] = regex.exec(currentUrl);
if (home) {