mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Fix local tabs not being localized without hovering
This commit is contained in:
1 parent
a3ed901a18
commit
e532e558b6
3 files changed
+19
-1
No files matched your search
@@ -49,6 +49,11 @@ public abstract class LocalSettingsTab(ConfigFile config)
|
||||
/// </summary>
|
||||
public TabGroup? TabButton { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="TextMeshPro"/>s alongside the locale keys for them.
|
||||
/// </summary>
|
||||
public static Dictionary<TextMeshPro, string> TabGroups { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of <see cref="ILocalSetting"/>s.
|
||||
/// </summary>
|
||||
@@ -237,6 +242,7 @@ public abstract class LocalSettingsTab(ConfigFile config)
|
||||
tabButtonText.transform.localScale = new Vector3(0.9f, 0.9f);
|
||||
tabButtonText.alignment = TextAlignmentOptions.Right;
|
||||
tabButtonText.text = $"<b>{GetShortName(TabName.Translate())}</b>";
|
||||
TabGroups.Add(tabButtonText, TabName);
|
||||
|
||||
var tabButton = tabButtonObject.GetComponent<PassiveButton>();
|
||||
var rollover = tabButtonObject.Rollover;
|
||||
@@ -311,7 +317,7 @@ public abstract class LocalSettingsTab(ConfigFile config)
|
||||
offset += 0.5f;
|
||||
}
|
||||
|
||||
private static string GetShortName(string name)
|
||||
internal static string GetShortName(string name)
|
||||
{
|
||||
var shortName = string.Empty;
|
||||
name.Split(' ').Do(x => shortName += x[0]);
|
||||
|
||||
@@ -69,6 +69,7 @@ public static class OptionsMenuPatches
|
||||
int i = 0;
|
||||
int tabIdx = 0;
|
||||
int page = 1;
|
||||
LocalSettingsTab.TabGroups.Clear();
|
||||
foreach (var settings in LocalSettingsManager.AvailableTabs)
|
||||
{
|
||||
var tab = settings.CreateTab(__instance);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using Il2CppInterop.Runtime.InteropTypes.Arrays;
|
||||
using MiraAPI.LocalSettings;
|
||||
using Reactor.Localization;
|
||||
using Reactor.Localization.Providers;
|
||||
using Reactor.Utilities;
|
||||
@@ -38,6 +39,16 @@ public class MiraLocalizationProvider : LocalizationProvider
|
||||
{
|
||||
MiraApiPlugin.Culture = new(culture);
|
||||
}
|
||||
|
||||
foreach (var tab in LocalSettingsTab.TabGroups)
|
||||
{
|
||||
if (tab.Key == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
tab.Key.text = $"<b>{LocalSettingsTab.GetShortName(tab.Value.Translate())}</b>";
|
||||
}
|
||||
/*Warning($"<?xml version='1.0' encoding='UTF-8'?>");
|
||||
Warning($"<resources>");
|
||||
foreach (var stringName in TranslationController.Instance.currentLanguage.AllStrings)
|
||||
|
||||
Reference in new issue
Block a user