Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions .changeset/odd-hornets-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@replexica/spec": minor
"@replexica/sdk": minor
"replexica": minor
"@replexica/cli": minor
---

Update locale code resolution logic
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
10 changes: 5 additions & 5 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Z from 'zod';
import { sourceLocaleSchema, targetLocaleSchema, allLocalesSchema } from '@replexica/spec';
import { localeCodeSchema } from '@replexica/spec';
import { createId } from "@paralleldrive/cuid2";

const engineParamsSchema = Z.object({
Expand All @@ -24,12 +24,12 @@ const payloadSchema = Z.record(
);

const localizationParamsSchema = Z.object({
sourceLocale: sourceLocaleSchema,
targetLocale: targetLocaleSchema,
sourceLocale: localeCodeSchema,
targetLocale: localeCodeSchema,
});

const referenceSchema = Z.record(
allLocalesSchema,
localeCodeSchema,
payloadSchema,
);

Expand Down Expand Up @@ -178,4 +178,4 @@ export class ReplexicaEngine {
return 0;
}
}
}
}
10 changes: 5 additions & 5 deletions packages/spec/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Z from 'zod';
import { allLocalesSchema, sourceLocaleSchema, targetLocaleSchema } from './locales';
import { localeCodeSchema } from './locales';
import { bucketTypeSchema } from './formats';

// common
export const localeSchema = Z.object({
source: sourceLocaleSchema,
targets: Z.array(targetLocaleSchema),
source: localeCodeSchema,
targets: Z.array(localeCodeSchema),
});

// factories
Expand Down Expand Up @@ -139,7 +139,7 @@ export const configV1_1Definition = extendConfigDefinition(configV1Definition, {
export const configV1_2Definition = extendConfigDefinition(configV1_1Definition, {
createSchema: (baseSchema) => baseSchema.extend({
locale: localeSchema.extend({
extraSource: allLocalesSchema.optional(),
extraSource: localeCodeSchema.optional(),
}),
}),
createDefaultValue: (baseDefaultValue) => ({
Expand All @@ -166,4 +166,4 @@ export function parseI18nConfig(rawConfig: unknown) {
}
}

export const defaultConfig = LATEST_CONFIG_DEFINITION.defaultValue;
export const defaultConfig = LATEST_CONFIG_DEFINITION.defaultValue;
Loading