mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-26 14:19:24 +00:00
Refactor translation keys and enhance i18n configuration
This commit is contained in:
parent
ecf30d1028
commit
5b6d82797e
@ -10,7 +10,8 @@
|
|||||||
"Bash(npm test)",
|
"Bash(npm test)",
|
||||||
"Bash(npm test:*)",
|
"Bash(npm test:*)",
|
||||||
"Bash(ls:*)",
|
"Bash(ls:*)",
|
||||||
"Bash(npx tsc:*)"
|
"Bash(npx tsc:*)",
|
||||||
|
"Bash(sed:*)"
|
||||||
],
|
],
|
||||||
"deny": []
|
"deny": []
|
||||||
}
|
}
|
||||||
|
@ -380,14 +380,6 @@
|
|||||||
"title": "Remove",
|
"title": "Remove",
|
||||||
"desc": "Delete unwanted pages from your PDF document."
|
"desc": "Delete unwanted pages from your PDF document."
|
||||||
},
|
},
|
||||||
"addPassword": {
|
|
||||||
"title": "Add Password",
|
|
||||||
"desc": "Encrypt your PDF document with a password."
|
|
||||||
},
|
|
||||||
"changePermissions": {
|
|
||||||
"title": "Change Permissions",
|
|
||||||
"desc": "Change document restrictions and permissions."
|
|
||||||
},
|
|
||||||
"removePassword": {
|
"removePassword": {
|
||||||
"title": "Remove Password",
|
"title": "Remove Password",
|
||||||
"desc": "Remove password protection from your PDF document."
|
"desc": "Remove password protection from your PDF document."
|
||||||
@ -396,10 +388,6 @@
|
|||||||
"title": "Compress",
|
"title": "Compress",
|
||||||
"desc": "Compress PDFs to reduce their file size."
|
"desc": "Compress PDFs to reduce their file size."
|
||||||
},
|
},
|
||||||
"sanitize": {
|
|
||||||
"title": "Sanitise",
|
|
||||||
"desc": "Remove potentially harmful elements from PDF files."
|
|
||||||
},
|
|
||||||
"unlockPDFForms": {
|
"unlockPDFForms": {
|
||||||
"title": "Unlock PDF Forms",
|
"title": "Unlock PDF Forms",
|
||||||
"desc": "Remove read-only property of form fields in a PDF document."
|
"desc": "Remove read-only property of form fields in a PDF document."
|
||||||
@ -1748,6 +1736,8 @@
|
|||||||
"approximateSize": "Approximate size"
|
"approximateSize": "Approximate size"
|
||||||
},
|
},
|
||||||
"sanitize": {
|
"sanitize": {
|
||||||
|
"title": "Sanitise",
|
||||||
|
"desc": "Remove potentially harmful elements from PDF files.",
|
||||||
"submit": "Sanitise PDF",
|
"submit": "Sanitise PDF",
|
||||||
"completed": "Sanitisation completed successfully",
|
"completed": "Sanitisation completed successfully",
|
||||||
"error.generic": "Sanitisation failed",
|
"error.generic": "Sanitisation failed",
|
||||||
@ -1780,6 +1770,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"addPassword": {
|
"addPassword": {
|
||||||
|
"title": "Add Password",
|
||||||
|
"desc": "Encrypt your PDF document with a password.",
|
||||||
"completed": "Password protection applied",
|
"completed": "Password protection applied",
|
||||||
"submit": "Encrypt",
|
"submit": "Encrypt",
|
||||||
"filenamePrefix": "encrypted",
|
"filenamePrefix": "encrypted",
|
||||||
@ -1838,6 +1830,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"changePermissions": {
|
"changePermissions": {
|
||||||
|
"title": "Change Permissions",
|
||||||
|
"desc": "Change document restrictions and permissions.",
|
||||||
"completed": "Permissions changed",
|
"completed": "Permissions changed",
|
||||||
"submit": "Change Permissions",
|
"submit": "Change Permissions",
|
||||||
"error": {
|
"error": {
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"convert": {
|
|
||||||
"selectSourceFormat": "Select source file format",
|
|
||||||
"selectTargetFormat": "Select target file format",
|
|
||||||
"selectFirst": "Select a source format first",
|
|
||||||
"imageOptions": "Image Options:",
|
|
||||||
"emailOptions": "Email Options:",
|
|
||||||
"colorType": "Color Type",
|
|
||||||
"dpi": "DPI",
|
|
||||||
"singleOrMultiple": "Output",
|
|
||||||
"emailNote": "Email attachments and embedded images will be included"
|
|
||||||
},
|
|
||||||
"common": {
|
|
||||||
"color": "Color",
|
|
||||||
"grayscale": "Grayscale",
|
|
||||||
"blackWhite": "Black & White",
|
|
||||||
"single": "Single Image",
|
|
||||||
"multiple": "Multiple Images"
|
|
||||||
},
|
|
||||||
"groups": {
|
|
||||||
"document": "Document",
|
|
||||||
"spreadsheet": "Spreadsheet",
|
|
||||||
"presentation": "Presentation",
|
|
||||||
"image": "Image",
|
|
||||||
"web": "Web",
|
|
||||||
"text": "Text",
|
|
||||||
"email": "Email"
|
|
||||||
}
|
|
||||||
}
|
|
@ -116,7 +116,7 @@ const LandingPage = () => {
|
|||||||
>
|
>
|
||||||
<AddIcon className="text-[var(--accent-interactive)]" />
|
<AddIcon className="text-[var(--accent-interactive)]" />
|
||||||
<span>
|
<span>
|
||||||
{t('fileUpload.addFiles', 'Add Files')}
|
{t('fileUpload.uploadFiles', 'Upload Files')}
|
||||||
</span>
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ const LandingPage = () => {
|
|||||||
className="text-[var(--accent-interactive)]"
|
className="text-[var(--accent-interactive)]"
|
||||||
style={{ fontSize: '.8rem' }}
|
style={{ fontSize: '.8rem' }}
|
||||||
>
|
>
|
||||||
{t('fileUpload.dragFilesInOrClick', 'Drag files in or click "Add Files" to browse')}
|
{t('fileUpload.dropFilesHere', 'Drop files here or click to upload')}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</Dropzone>
|
</Dropzone>
|
||||||
|
@ -118,7 +118,7 @@ interface ToolManagementResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const useToolManagement = (): ToolManagementResult => {
|
export const useToolManagement = (): ToolManagementResult => {
|
||||||
const { t } = useTranslation();
|
const { t, ready } = useTranslation();
|
||||||
|
|
||||||
const [selectedToolKey, setSelectedToolKey] = useState<string | null>(null);
|
const [selectedToolKey, setSelectedToolKey] = useState<string | null>(null);
|
||||||
const [toolSelectedFileIds, setToolSelectedFileIds] = useState<string[]>([]);
|
const [toolSelectedFileIds, setToolSelectedFileIds] = useState<string[]>([]);
|
||||||
@ -136,18 +136,22 @@ export const useToolManagement = (): ToolManagementResult => {
|
|||||||
}, [endpointsLoading, endpointStatus]);
|
}, [endpointsLoading, endpointStatus]);
|
||||||
|
|
||||||
const toolRegistry: ToolRegistry = useMemo(() => {
|
const toolRegistry: ToolRegistry = useMemo(() => {
|
||||||
|
if (!ready) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
const availableTools: ToolRegistry = {};
|
const availableTools: ToolRegistry = {};
|
||||||
Object.keys(toolDefinitions).forEach(toolKey => {
|
Object.keys(toolDefinitions).forEach(toolKey => {
|
||||||
if (isToolAvailable(toolKey)) {
|
if (isToolAvailable(toolKey)) {
|
||||||
const toolDef = toolDefinitions[toolKey];
|
const toolDef = toolDefinitions[toolKey];
|
||||||
availableTools[toolKey] = {
|
availableTools[toolKey] = {
|
||||||
...toolDef,
|
...toolDef,
|
||||||
name: t(`home.${toolKey}.title`, toolKey.charAt(0).toUpperCase() + toolKey.slice(1))
|
name: t(`${toolKey}.title`, toolKey.charAt(0).toUpperCase() + toolKey.slice(1))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return availableTools;
|
return availableTools;
|
||||||
}, [t, isToolAvailable]);
|
}, [t, isToolAvailable, ready]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!endpointsLoading && selectedToolKey && !toolRegistry[selectedToolKey]) {
|
if (!endpointsLoading && selectedToolKey && !toolRegistry[selectedToolKey]) {
|
||||||
|
@ -57,6 +57,8 @@ i18n
|
|||||||
.use(initReactI18next)
|
.use(initReactI18next)
|
||||||
.init({
|
.init({
|
||||||
fallbackLng: 'en-GB',
|
fallbackLng: 'en-GB',
|
||||||
|
supportedLngs: Object.keys(supportedLanguages),
|
||||||
|
nonExplicitSupportedLngs: false,
|
||||||
debug: process.env.NODE_ENV === 'development',
|
debug: process.env.NODE_ENV === 'development',
|
||||||
|
|
||||||
interpolation: {
|
interpolation: {
|
||||||
@ -77,6 +79,12 @@ i18n
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Map base language codes to specific locales
|
||||||
|
i18n.services.languageUtils.formatLanguageCode = (lng) => {
|
||||||
|
if (lng === 'en') return 'en-GB';
|
||||||
|
return lng;
|
||||||
|
};
|
||||||
|
|
||||||
// Set document direction based on language
|
// Set document direction based on language
|
||||||
i18n.on('languageChanged', (lng) => {
|
i18n.on('languageChanged', (lng) => {
|
||||||
const isRTL = rtlLanguages.includes(lng);
|
const isRTL = rtlLanguages.includes(lng);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user