Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

refactor(client): replace yml with generic dictionary references (#1115)

Corentin Thomassetc0bdd645f031
diff --git a/apps/papra-client/src/modules/i18n/locales.test.ts b/apps/papra-client/src/modules/i18n/locales.test.ts
index 65e903d7..c7ad916d 100644
--- a/apps/papra-client/src/modules/i18n/locales.test.ts
+++ b/apps/papra-client/src/modules/i18n/locales.test.ts
@@ -42,7 +42,7 @@ describe('locales', () => {
});
}
- test('all keys in en.yml must be used in the app (dynamic keys are manually excluded)', async () => {
+ test('all keys in en dictionary must be used in the app (dynamic keys are manually excluded)', async () => {
const srcFileNames = await Array.fromAsync(glob('src/**/*.{ts,tsx}', {
cwd: packageRoot,
exclude: ['src/**/*.test.*', 'src/modules/i18n/locales.types.ts', 'src/locales/*.ts'],
@@ -81,6 +81,6 @@ describe('locales', () => {
}
}
- expect([...keys]).to.eql([], 'Unused keys found in en.yml, please remove them (or add them to the dynamic keys matchers in locales.test.ts if they are used in dynamic contexts)');
+ expect([...keys]).to.eql([], 'Unused keys found in en dictionary, please remove them (or add them to the dynamic keys matchers in locales.test.ts if they are used in dynamic contexts)');
});
});
diff --git a/apps/papra-client/src/scripts/sync-i18n-key-order.script.ts b/apps/papra-client/src/scripts/sync-i18n-key-order.script.ts
index 9e658421..7abc3816 100644
--- a/apps/papra-client/src/scripts/sync-i18n-key-order.script.ts
+++ b/apps/papra-client/src/scripts/sync-i18n-key-order.script.ts
@@ -51,7 +51,7 @@ function syncLocaleFiles() {
const newLocalesContent = enLines
.filter(line => !line.startsWith('export') && !line.startsWith('}'))
.map((enLine) => {
- // Reflect empty lines from en.yml
+ // Reflect empty lines from en
if (enLine.trim() === '') {
return '';
}
@@ -66,12 +66,12 @@ function syncLocaleFiles() {
return `${' '.repeat(enLineIndentation - targetLineIndentation)}${targetLine}`;
}
- // Reflect comments from en.yml
+ // Reflect comments from en
if (enLine.trim().startsWith('//')) {
return enLine;
}
- // If the translation key does not exist in the target file, add a comment with the one from en.yml
+ // If the translation key does not exist in the target file, add a comment with the one from en
return `// ${enLine}`;
});
diff --git a/apps/papra-client/vite.env.d.ts b/apps/papra-client/vite.env.d.ts
deleted file mode 100644
index b707d347..00000000
--- a/apps/papra-client/vite.env.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-declare module '*.yml' {
- import type { LocaleKeys } from './types'; // Adjust the import path as needed
-
- const value: Record<LocaleKeys, string>;
- export default value;
-}