Skip to content

Commit cdf4fb9

Browse files
committed
feat(nuxt-json): add dynamic locale support for Spanish and other languages
- Replace hardcoded ['en', 'tr'] with dynamic locales parameter in getModelContent() - Pass metadata.locales from getModelData() to properly load all language variants - Default to ['en', 'tr'] for backward compatibility - Enables support for es.json and other language files
1 parent 2c292da commit cdf4fb9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/nuxt-json/src/runtime/server/services/storage.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ export class StorageService {
6262
/**
6363
* Model içeriğini okur
6464
*/
65-
private async getModelContent(modelId: string, isLocalized: boolean): Promise<(Content | LocalizedContent)[]> {
65+
private async getModelContent(modelId: string, isLocalized: boolean, locales: string[] = ['en', 'tr']): Promise<(Content | LocalizedContent)[]> {
6666
try {
6767
let content: (Content | LocalizedContent)[] = [];
6868

6969
if (isLocalized) {
70-
const languages = ['en', 'tr'];
70+
const languages = locales;
7171
for (const lang of languages) {
7272
const localeContent = await this.storage.getItem<any[]>(`${modelId}/${lang}.json`);
7373
if (!localeContent) {
@@ -116,7 +116,7 @@ export class StorageService {
116116
}
117117

118118
const fields = await this.getModelDefinition(modelId);
119-
const content = await this.getModelContent(modelId, metadata.localization);
119+
const content = await this.getModelContent(modelId, metadata.localization, metadata.locales);
120120

121121
const modelData: ModelData = {
122122
metadata,

0 commit comments

Comments
 (0)