Skip to content

Commit

Permalink
Merge pull request #78 from InfernoDragon0/main
Browse files Browse the repository at this point in the history
fix: patch another method
  • Loading branch information
xhayper authored May 22, 2023
2 parents e4d4cab + b664ba3 commit 6ec5ace
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions COTL_API/CustomLocalization/CustomLocalizationPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ private static bool TermData_GetTranslation(ref string __result, TermData __inst
return false;
}

[HarmonyPatch(typeof(LanguageSourceData), "TryGetTranslation")]
[HarmonyPrefix]
private static bool LanguageSourceData_TryGetTranslation(string term, ref string Translation, ref bool __result)
{
var lang = SettingsManager.Settings.Game.Language;
if (!LocalizationMap.ContainsKey(lang)) return true;
if (!LocalizationMap[lang].ContainsKey(term)) return true;
Translation = LocalizationMap[lang][term];
__result = true;

return false;
}

[HarmonyPatch(typeof(GameSettings), nameof(GameSettings.OnLanguageChanged))]
[HarmonyPrefix]
private static bool GameSettings_OnLanguageChanged(GameSettings __instance, int index)
Expand Down

0 comments on commit 6ec5ace

Please sign in to comment.