mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-13 17:54:19 +01:00
1 parent
39024e1a63
commit
4487f2c1c6
1 file changed
+3
-3
+3
-3
@@ -66,7 +66,7 @@ export const getLanguageFromUrl = (): SupportedLanguage => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const langMatch = path.match(
|
const langMatch = path.match(
|
||||||
/^\/(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl|be|da|ko|sv|ru|ja|uk|sk)(?:\/|$)/
|
/^\/(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|pl|nl|be|da|ko|sv|ru|ja|uk|sk)(?:\/|$)/
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
langMatch &&
|
langMatch &&
|
||||||
@@ -156,7 +156,7 @@ export const changeLanguage = (lang: SupportedLanguage): void => {
|
|||||||
|
|
||||||
let pagePathWithoutLang = relativePath;
|
let pagePathWithoutLang = relativePath;
|
||||||
const langPrefixMatch = relativePath.match(
|
const langPrefixMatch = relativePath.match(
|
||||||
/^\/(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl|be|da|ko|sv|ru|ja|uk|sk)(\/.*)?$/
|
/^\/(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|pl|nl|be|da|ko|sv|ru|ja|uk|sk)(\/.*)?$/
|
||||||
);
|
);
|
||||||
if (langPrefixMatch) {
|
if (langPrefixMatch) {
|
||||||
pagePathWithoutLang = langPrefixMatch[2] || '/';
|
pagePathWithoutLang = langPrefixMatch[2] || '/';
|
||||||
@@ -251,7 +251,7 @@ export const rewriteLinks = (): void => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const langPrefixRegex = new RegExp(
|
const langPrefixRegex = new RegExp(
|
||||||
`^(${basePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})?/?(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|nl|be|da|ko|sv|ru|ja|uk|sk)(/|$)`
|
`^(${basePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})?/?(en|ar|fr|es|de|zh|zh-TW|vi|tr|id|it|pt|pl|nl|be|da|ko|sv|ru|ja|uk|sk)(/|$)`
|
||||||
);
|
);
|
||||||
if (langPrefixRegex.test(href)) {
|
if (langPrefixRegex.test(href)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in new issue
Block a user