feat: Simple Mode language routing and translation improvements

## Simple Mode Enhancements
- Add `simple-index.html` as dedicated homepage for Simple Mode
- Hide marketing sections (FAQ, How It Works, Related Tools) on tool pages
- Add simplified navbar and footer for tool pages in Simple Mode
- Configure vite preview server to handle language-prefixed URLs

## Language Routing
- Add middleware to rewrite language-prefixed URLs (e.g., /de/merge-pdf.html)
- Support all languages: en, de, es, fr, id, it, pt, tr, vi, zh, zh-TW
- Create .htaccess with internal rewrites for Apache/Hostinger hosting

## Translation Updates
- Add missing translations for digitalSignPdf, validateSignaturePdf,
  emailToPdf, fontToOutline, deskewPdf to es, pt, tr, zh-TW
- Add Digital Signature and Validate Signature to homepage translation keys
- Fix language regex patterns to include all supported languages
- Fix typo in encrypt-pdf.html
This commit is contained in:
alam00000
2026-01-14 02:31:44 +05:30
parent 59584813e4
commit 90346d7ea9
11 changed files with 1884 additions and 637 deletions

View File

@@ -14,6 +14,7 @@ export const supportedLanguages = [
'tr',
'id',
'it',
'pt',
] as const;
export type SupportedLanguage = (typeof supportedLanguages)[number];
@@ -23,17 +24,20 @@ export const languageNames: Record<SupportedLanguage, string> = {
de: 'Deutsch',
es: 'Español',
zh: '中文',
"zh-TW": '繁體中文(台灣)',
'zh-TW': '繁體中文(台灣)',
vi: 'Tiếng Việt',
tr: 'Türkçe',
id: 'Bahasa Indonesia',
it: 'Italiano',
pt: 'Português',
};
export const getLanguageFromUrl = (): SupportedLanguage => {
const path = window.location.pathname;
const langMatch = path.match(/^\/(en|fr|es|de|zh|zh-TW|vi|tr|id|it)(?:\/|$)/);
const langMatch = path.match(
/^\/(en|fr|es|de|zh|zh-TW|vi|tr|id|it|pt)(?:\/|$)/
);
if (
langMatch &&
supportedLanguages.includes(langMatch[1] as SupportedLanguage)
@@ -95,9 +99,12 @@ export const changeLanguage = (lang: SupportedLanguage): void => {
const currentLang = getLanguageFromUrl();
let newPath: string;
if (currentPath.match(/^\/(en|fr|de|zh|zh-TW|vi|tr|id|it)\//)) {
newPath = currentPath.replace(/^\/(en|fr|de|zh|zh-TW|vi|tr|id|it)\//, `/${lang}/`);
} else if (currentPath.match(/^\/(en|fr|de|zh|zh-TW|vi|tr|id|it)$/)) {
if (currentPath.match(/^\/(en|fr|es|de|zh|zh-TW|vi|tr|id|it|pt)\//)) {
newPath = currentPath.replace(
/^\/(en|fr|es|de|zh|zh-TW|vi|tr|id|it|pt)\//,
`/${lang}/`
);
} else if (currentPath.match(/^\/(en|fr|es|de|zh|zh-TW|vi|tr|id|it|pt)$/)) {
newPath = `/${lang}`;
} else {
newPath = `/${lang}${currentPath}`;
@@ -161,7 +168,7 @@ export const rewriteLinks = (): void => {
return;
}
if (href.match(/^\/(en|fr|de|zh|zh-TW|vi|tr|id|it)\//)) {
if (href.match(/^\/(en|fr|es|de|zh|zh-TW|vi|tr|id|it|pt)\//)) {
return;
}
let newHref: string;