Skip to content

Commit 09a8e83

Browse files
authored
Merge pull request #71 from Schlabbi/master
Fixed an issue where translations would go missing
2 parents f3cb6ef + 396a283 commit 09a8e83

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

sources/LocalizationEditor/Providers/LocalizationsDataSource.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,13 @@ final class LocalizationsDataSource: NSObject {
251251

252252
selectedLocalizationGroup.localizations.forEach({ localization in
253253
let newTranslation = localizationProvider.addKeyToLocalization(localization: localization, key: key, message: message)
254-
data[key] = [localization.language: newTranslation]
254+
// If we already created the entry in the data dict, do not overwrite the entry entirely.
255+
// Instead just add the data to the already present entry.
256+
if data[key] != nil {
257+
data[key]?[localization.language] = newTranslation
258+
} else {
259+
data[key] = [localization.language: newTranslation]
260+
}
255261
})
256262
}
257263

0 commit comments

Comments
 (0)