Skip to content

Commit

Permalink
Update TranslationOverwriteService.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyline300 committed Oct 12, 2024
1 parent 25f52cb commit c22fb79
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object TranslationOverwriteService {
override def overwrite(original: Translations, modded: Translations): Translations = {
val moddedMap = toMap(modded)
val updated = original.languages.map { language =>
// returns the value associated to the key (objName)
// returns the value associated to the key: objName
// if there is no key that matches in the moddedMap, return original translation name
val overwrittenLanguageTranslation = moddedMap.getOrElse(language.objName, language.translation)
// updates the original with the modded translations for each name
Expand All @@ -22,9 +22,11 @@ object TranslationOverwriteService {
Translations(updated)
}

private def toMap(translations: Translations): Map[ObjectName, String] =
private def toMap(translations: Translations): Map[ObjectName, String] = {
// changes the Translations to a key pair
translations.languages.map { language =>
language.objName -> language.translation
}.toMap
}
}
}

0 comments on commit c22fb79

Please sign in to comment.