From 486c6f34484596b096e624bd09e23a422ecb6485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kuchy=C5=88ka=20=28Anty=29?= Date: Wed, 30 Jul 2025 14:52:52 +0200 Subject: [PATCH 1/2] feat: add export formats Apple SDK and Android SDK --- schema.json | 2 ++ src/options.ts | 2 ++ src/schema.d.ts | 2 ++ src/utils/mapExportFormat.ts | 4 ++++ src/utils/mapImportFormat.ts | 5 +++++ 5 files changed, 15 insertions(+) diff --git a/schema.json b/schema.json index 36ee03b1..d1d3fdf6 100644 --- a/schema.json +++ b/schema.json @@ -302,8 +302,10 @@ "APPLE_STRINGS", "APPLE_XLIFF", "APPLE_XCSTRINGS", + "APPLE_SDK", "PROPERTIES_ICU", "PROPERTIES_JAVA", + "ANDROID_SDK", "ANDROID_XML", "COMPOSE_XML", "FLUTTER_ARB", diff --git a/src/options.ts b/src/options.ts index 59142292..a85cda65 100644 --- a/src/options.ts +++ b/src/options.ts @@ -102,8 +102,10 @@ export const FORMAT_OPT = new Option( 'APPLE_STRINGS', 'APPLE_XLIFF', 'APPLE_XCSTRINGS', + 'APPLE_SDK', 'PROPERTIES_ICU', 'PROPERTIES_JAVA', + 'ANDROID_SDK', 'ANDROID_XML', 'COMPOSE_XML', 'FLUTTER_ARB', diff --git a/src/schema.d.ts b/src/schema.d.ts index c8cb7538..14d52e59 100644 --- a/src/schema.d.ts +++ b/src/schema.d.ts @@ -25,8 +25,10 @@ export type Format = | "APPLE_STRINGS" | "APPLE_XLIFF" | "APPLE_XCSTRINGS" + | "APPLE_SDK" | "PROPERTIES_ICU" | "PROPERTIES_JAVA" + | "ANDROID_SDK" | "ANDROID_XML" | "COMPOSE_XML" | "FLUTTER_ARB" diff --git a/src/utils/mapExportFormat.ts b/src/utils/mapExportFormat.ts index 7a3eef46..00dec0a2 100644 --- a/src/utils/mapExportFormat.ts +++ b/src/utils/mapExportFormat.ts @@ -8,8 +8,12 @@ type FormatResult = { export const mapExportFormat = (format: Schema['format']): FormatResult => { switch (format) { + case 'ANDROID_SDK': + return { format: 'ANDROID_SDK', messageFormat: 'JAVA_STRING_FORMAT' }; case 'ANDROID_XML': return { format: 'ANDROID_XML', messageFormat: 'JAVA_STRING_FORMAT' }; + case 'APPLE_SDK': + return { format: 'APPLE_SDK', messageFormat: 'APPLE_SPRINTF' }; case 'APPLE_STRINGS': return { format: 'APPLE_STRINGS_STRINGSDICT', diff --git a/src/utils/mapImportFormat.ts b/src/utils/mapImportFormat.ts index 2edf7b59..20187050 100644 --- a/src/utils/mapImportFormat.ts +++ b/src/utils/mapImportFormat.ts @@ -1,3 +1,4 @@ +import { InvalidArgumentError } from 'commander'; import { components } from '../client/internal/schema.generated.js'; import { Schema } from '../schema.js'; @@ -19,6 +20,10 @@ export const mapImportFormat = ( } case 'JSON_TOLGEE': return 'JSON_ICU'; + case 'ANDROID_SDK': + throw new InvalidArgumentError('Importing files in ANDROID_SDK format is not supported.'); + case 'APPLE_SDK': + throw new InvalidArgumentError('Importing files in APPLE_SDK format is not supported.'); default: return format ?? 'JSON_ICU'; } From bcbf8c20bcc27d804fdf02dc757ad0386b715f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kuchy=C5=88ka=20=28Anty=29?= Date: Wed, 30 Jul 2025 15:01:03 +0200 Subject: [PATCH 2/2] chore: fix lint --- src/utils/mapImportFormat.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/mapImportFormat.ts b/src/utils/mapImportFormat.ts index 20187050..2df4fd61 100644 --- a/src/utils/mapImportFormat.ts +++ b/src/utils/mapImportFormat.ts @@ -21,9 +21,13 @@ export const mapImportFormat = ( case 'JSON_TOLGEE': return 'JSON_ICU'; case 'ANDROID_SDK': - throw new InvalidArgumentError('Importing files in ANDROID_SDK format is not supported.'); + throw new InvalidArgumentError( + 'Importing files in ANDROID_SDK format is not supported.' + ); case 'APPLE_SDK': - throw new InvalidArgumentError('Importing files in APPLE_SDK format is not supported.'); + throw new InvalidArgumentError( + 'Importing files in APPLE_SDK format is not supported.' + ); default: return format ?? 'JSON_ICU'; }