Skip to content

Commit

Permalink
feat: cleanup and preparation for export support
Browse files Browse the repository at this point in the history
  • Loading branch information
Anty0 committed Oct 30, 2024
1 parent 043f2dd commit 6aa07de
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ enum class ExportFormat(
"application/xml",
defaultFileStructureTemplate = "values-{androidLanguageTag}/strings.{extension}",
),
COMPOSE_XML(
"xml",
"application/xml",
defaultFileStructureTemplate = "values-{androidLanguageTag}/strings.{extension}",
),
FLUTTER_ARB(
"arb",
"application/json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class FileExporterFactory(

ExportFormat.ANDROID_XML -> AndroidStringsXmlExporter(data, exportParams, projectIcuPlaceholdersSupport)

ExportFormat.COMPOSE_XML -> AndroidStringsXmlExporter(data, exportParams, projectIcuPlaceholdersSupport) // TODO: Compose XML exporter

ExportFormat.PO ->
PoFileExporter(
data,
Expand Down
7 changes: 7 additions & 0 deletions e2e/cypress/common/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ export const testExportFormats = (
},
});

testFormat(interceptFn, submitFn, clearCheckboxesAfter, afterFn, {
format: 'Compose Multiplatform .xml',
expectedParams: {
format: 'COMPOSE_XML',
},
});

testFormat(interceptFn, submitFn, clearCheckboxesAfter, afterFn, {
format: 'Flutter .arb',
expectedParams: {
Expand Down
35 changes: 20 additions & 15 deletions webapp/src/service/apiSchema.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1865,19 +1865,20 @@ export interface components {
languages?: string[];
/** @description Format to export to */
format:
| "CSV"
| "JSON"
| "JSON_TOLGEE"
| "JSON_I18NEXT"
| "XLIFF"
| "PO"
| "APPLE_STRINGS_STRINGSDICT"
| "APPLE_XLIFF"
| "ANDROID_XML"
| "COMPOSE_XML"
| "FLUTTER_ARB"
| "PROPERTIES"
| "YAML_RUBY"
| "YAML";
| "YAML"
| "JSON_I18NEXT"
| "CSV";
/**
* @description Delimiter to structure file content.
*
Expand Down Expand Up @@ -1965,19 +1966,20 @@ export interface components {
languages?: string[];
/** @description Format to export to */
format:
| "CSV"
| "JSON"
| "JSON_TOLGEE"
| "JSON_I18NEXT"
| "XLIFF"
| "PO"
| "APPLE_STRINGS_STRINGSDICT"
| "APPLE_XLIFF"
| "ANDROID_XML"
| "COMPOSE_XML"
| "FLUTTER_ARB"
| "PROPERTIES"
| "YAML_RUBY"
| "YAML";
| "YAML"
| "JSON_I18NEXT"
| "CSV";
/**
* @description Delimiter to structure file content.
*
Expand Down Expand Up @@ -3107,19 +3109,20 @@ export interface components {
languages?: string[];
/** @description Format to export to */
format:
| "CSV"
| "JSON"
| "JSON_TOLGEE"
| "JSON_I18NEXT"
| "XLIFF"
| "PO"
| "APPLE_STRINGS_STRINGSDICT"
| "APPLE_XLIFF"
| "ANDROID_XML"
| "COMPOSE_XML"
| "FLUTTER_ARB"
| "PROPERTIES"
| "YAML_RUBY"
| "YAML";
| "YAML"
| "JSON_I18NEXT"
| "CSV";
/**
* @description Delimiter to structure file content.
*
Expand Down Expand Up @@ -3640,19 +3643,20 @@ export interface components {
};
ExportFormatModel: {
format:
| "CSV"
| "JSON"
| "JSON_TOLGEE"
| "JSON_I18NEXT"
| "XLIFF"
| "PO"
| "APPLE_STRINGS_STRINGSDICT"
| "APPLE_XLIFF"
| "ANDROID_XML"
| "COMPOSE_XML"
| "FLUTTER_ARB"
| "PROPERTIES"
| "YAML_RUBY"
| "YAML";
| "YAML"
| "JSON_I18NEXT"
| "CSV";
extension: string;
mediaType: string;
defaultFileStructureTemplate: string;
Expand Down Expand Up @@ -12267,19 +12271,20 @@ export interface operations {
languages?: string[];
/** Format to export to */
format?:
| "CSV"
| "JSON"
| "JSON_TOLGEE"
| "JSON_I18NEXT"
| "XLIFF"
| "PO"
| "APPLE_STRINGS_STRINGSDICT"
| "APPLE_XLIFF"
| "ANDROID_XML"
| "COMPOSE_XML"
| "FLUTTER_ARB"
| "PROPERTIES"
| "YAML_RUBY"
| "YAML";
| "YAML"
| "JSON_I18NEXT"
| "CSV";
/**
* Delimiter to structure file content.
*
Expand Down
11 changes: 11 additions & 0 deletions webapp/src/views/projects/export/components/formatGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@ export const formatGroups: FormatGroup[] = [
},
],
},
{
name: "Compose Multiplatform",
formats: [
{
id: 'compose_xml',
extension: 'xml',
name: <T keyName="export-format-compose-xml" />,
format: 'COMPOSE_XML',
}
]
},
{
name: 'Flutter',
formats: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const FORMATS = [
{ name: 'Apple Stringsdict', logo: <AppleLogo /> },
{ name: 'Apple XLIFF', logo: <AppleLogo /> },
{ name: 'Android XML', logo: <AndroidLogo /> },
// TODO: Compose multiplatform logo
{ name: 'Flutter ARB', logo: <FluttrerLogo /> },
{ name: 'Ruby YAML', logo: <RailsLogo /> },
{ name: 'i18next', logo: <I18nextLogo /> },
Expand Down

0 comments on commit 6aa07de

Please sign in to comment.