Skip to content

Commit e0f4599

Browse files
committed
Fix translation lookup and dialog refresh behavior
- CloudTranslationService: Check both empty string and actual language code for source translations - ExportProjectDialog: Add padding to checkbox list - Detail.razor: Refresh data after translate/import dialogs close
1 parent 6aa2b59 commit e0f4599

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

cloud/src/LrmCloud.Api/Services/Translation/CloudTranslationService.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,12 @@ public async Task<TranslateResponseDto> TranslateKeysAsync(
213213
}
214214
else
215215
{
216-
// Look up source translation using the database language code
217-
// (empty string for RESX/Android/iOS default language, actual code for JSON/i18next)
216+
// Look up source translation - check both conventions:
217+
// - CLI sync stores default language with LanguageCode = ""
218+
// - Web import stores with actual code (e.g., "en")
218219
var sourceTranslation = key.Translations
219-
.FirstOrDefault(t => t.LanguageCode == sourceLanguageDbCode && t.PluralForm == pluralForm);
220+
.FirstOrDefault(t => (t.LanguageCode == sourceLanguageDbCode || t.LanguageCode == sourceLanguage)
221+
&& t.PluralForm == pluralForm);
220222
sourceText = sourceTranslation?.Value;
221223
}
222224

cloud/src/LrmCloud.Web/Components/ExportProjectDialog.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<RadzenCheckBoxList @bind-Value="_selectedLanguages" Data="@Languages"
2727
TextProperty="Text" ValueProperty="Value"
2828
Orientation="Radzen.Orientation.Vertical"
29+
Style="padding-top: 0.5rem;"
2930
Disabled="@_isExporting" />
3031
}
3132
else

cloud/src/LrmCloud.Web/Pages/Projects/Detail.razor

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,10 @@ else
314314
},
315315
new Radzen.DialogOptions { Width = "600px" });
316316

317-
if (result is TranslateResponseDto translationResult && translationResult.Success)
317+
// Refresh data if translation occurred (stats + validation)
318+
if (result is not null)
318319
{
319-
// Refresh stats after translation
320-
_stats = await ResourceService.GetProjectStatsAsync(ProjectId);
320+
await LoadDataAsync();
321321
}
322322
}
323323

@@ -343,8 +343,8 @@ else
343343
},
344344
new Radzen.DialogOptions { Width = "500px" });
345345

346-
// Refresh data if import was successful
347-
if (result is true)
346+
// Refresh data if import was successful (or dialog closed after import)
347+
if (result is not false)
348348
{
349349
await LoadDataAsync();
350350
}

0 commit comments

Comments
 (0)