-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMoreLocales.cs
More file actions
102 lines (94 loc) · 3.55 KB
/
MoreLocales.cs
File metadata and controls
102 lines (94 loc) · 3.55 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
* Copyright (C) 2025 qAngel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
global using Microsoft.Xna.Framework;
global using Microsoft.Xna.Framework.Graphics;
global using Mono.Cecil.Cil;
global using MonoMod.Cil;
global using MoreLocales.Core;
global using MoreLocales.Utilities;
global using ReLogic.Graphics;
global using Terraria.ModLoader;
using MoreLocales.Common;
using System;
using System.Windows.Forms;
using Terraria.Localization;
namespace MoreLocales;
/// <summary>
/// A super cool localization extension mod. <para/>
/// <see href="https://github.com/queueAngel/MoreLocales"/>
/// </summary>
public class MoreLocales : Mod
{
internal static LocalizedText InvalidGrammaticalGenderError;
internal static LocalizedText InvalidGrammaticalNumberError;
internal static LocalizedText InvalidInflectionError;
/// <summary>
/// The instance of MoreLocales.
/// </summary>
public static MoreLocales Instance { get; private set; }
static MoreLocales()
{
LocalizationTweaks.Apply();
}
/// <inheritdoc/>
public MoreLocales()
{
Instance = this;
MoreLocalesAPI.ProtectFilesFromLegacyMarking(Instance);
MoreLocalesAPI.InitCustomCultureModsArray();
MoreLocalesAPI._canRegister = true;
MoreLocalesAPI.DoLoad();
}
/// <inheritdoc/>
public override void Load()
{
AssetHelper.Setup(Instance);
FontHelperV2.DoLoad();
LangFeaturesPlus.DoLoad();
MoreLocalesAPI.DoSafeLoad();
}
/// <inheritdoc/>
public override void PostSetupContent()
{
InvalidGrammaticalGenderError = GetLocalization("Misc.Error.InvalidGrammaticalGender");
InvalidGrammaticalNumberError = GetLocalization("Misc.Error.InvalidGrammaticalNumber");
InvalidInflectionError = GetLocalization("Misc.Error.InvalidInflection");
LangUtils.InitCategories();
BetterLangMenuV2.InitAssetsSafe();
MoreLocalesSets._didFirstLoad = true;
MoreLocalesSets.ReloadedLocalizations();
MoreLocalesAPI.cachedVanillaCulture = LanguageManager.Instance.ActiveCulture.LegacyId;
MoreLocalesAPI.LoadCustomCultureData();
if (FontHelperV2.CharDataInlined && OperatingSystem.IsWindows())
MessageBox.Show(GetLocalization("Misc.Error.FontPatchingError").Value, Language.GetTextValue("Error.Error"));
}
/// <inheritdoc/>
public override object Call(params object[] args)
{
throw new InvalidOperationException
("""
MoreLocales does not have a Mod.Call API. Using a weakReference is your only option if you do not wish for this mod to be a dependency in your mod.
This is in order to avoid extreme verbosity. Please consult the wiki for further information: https://github.com/queueAngel/MoreLocales/wiki/Home
""");
}
/// <inheritdoc/>
public override void Unload()
{
MoreLocalesAPI.DoUnload();
LocalizationTweaks.Unapply();
}
}