-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLocalizationRoundabout.cs
More file actions
33 lines (29 loc) · 1.05 KB
/
LocalizationRoundabout.cs
File metadata and controls
33 lines (29 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Reflection;
using Terraria.Localization;
using Terraria.ModLoader;
//Courtesy of scalie
namespace HypnosMod
{
internal class LocalizationRewriter : ModSystem
{
public static readonly MethodInfo refreshInfo = typeof(LocalizationLoader).GetMethod("UpdateLocalizationFilesForMod", BindingFlags.NonPublic | BindingFlags.Static, new Type[] { typeof(Mod), typeof(string), typeof(GameCulture) });
public override void PostSetupContent()
{
#if DEBUG
refreshInfo.Invoke(null, new object[] { HypnosMod.instance, null, Language.ActiveCulture });
#endif
}
}
internal static class LocalizationRoundabout
{
public static readonly PropertyInfo valueProp = typeof(LocalizedText).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance);
public static void SetDefault(this LocalizedText text, string value)
{
#if DEBUG
LanguageManager.Instance.GetOrRegister(text.Key, () => value);
valueProp.SetValue(text, value);
#endif
}
}
}