Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/check-pr-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
check_pr_size:
if: false
runs-on: ubuntu-latest
timeout-minutes: 1

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internxt/drive-desktop-core",
"version": "0.1.5",
"version": "0.1.6",
"author": "Internxt <hello@internxt.com>",
"license": "MIT",
"files": [
Expand Down
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sonar.projectKey=internxt_drive-desktop-core
sonar.organization=internxt
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.exclusions=**/*.test.ts,**/*.module.ts,./src/backend/index.ts
sonar.exclusions=**/*.test.ts,**/i18n/locales/*.ts
sonar.coverage.exclusions=**/*.module.ts,./src/backend/index.ts
4 changes: 4 additions & 0 deletions src/frontend/core/i18n/i18n.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { en } from './locales/en';
export { es } from './locales/es';
export { fr } from './locales/fr';
export { TranslationFn, TranslationPath, TranslationArgs } from './i18n.types';
22 changes: 22 additions & 0 deletions src/frontend/core/i18n/i18n.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { en } from './locales/en';

export type Language = 'es' | 'en' | 'fr';
export type Translation = typeof en;

/**
* v2.6.0 Daniel Jiménez
* This type generates all possible paths from the translations.
* We set a maximum depth of 10 for a translation path.
*/
type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
type Paths<T, D extends number = 10> = [D] extends [never]
? never
: T extends object
? {
[K in keyof T]-?: K extends string | number ? (T[K] extends object ? `${K}.${Paths<T[K], Prev[D]> & string}` : `${K}`) : never;
}[keyof T]
: never;

export type TranslationPath = Paths<Translation>;
export type TranslationArgs = Record<string, unknown>;
export type TranslationFn = (path: TranslationPath, args?: Record<string, unknown>) => string;
Loading
Loading