Fix overall localization

This commit is contained in:
Atony committed 2026-08-25 19:02:55 -05:00
1 parent 34148499b7
commit 276ab0ac79
12 files changed
+97 -61

No files matched your search

+32 -29
View File
@@ -1,57 +1,60 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<string name="teleporterrole.name">Teleporter</string> <string name="ApiExample.Role.Teleporter">Teleporter</string>
<string name="teleporterrole.description">Zoom out and teleport across the map!</string> <string name="ApiExample.Role.Teleporter.IntroBlurb">Zoom out and teleport across the map!</string>
<string name="freezerrole.name">Freezer</string> <string name="ApiExample.Role.Teleporter.MedDescription">Zoom out and teleport across the map!</string>
<string name="freezerrole.description">Freeze another player for a duration of time.</string> <string name="ApiExample.Role.Teleporter.TabDescription">Zoom out and teleport across the map!</string>
<string name="mayorrole.name">Mayor</string> <string name="ApiExample.Role.Teleporter.WikiDescription">The Teleporter is a Crewmate role that can move around the map using their dope-ass ability.</string>
<string name="mayorrole.description">You get extra votes!</string> <string name="ApiExample.Role.Freezer">Freezer</string>
<string name="chamelonrole.name">Chamelon</string> <string name="ApiExample.Role.Freezer.TabDescription">Freeze another player for a duration of time.</string>
<string name="chamelonrole.description">Stay invisible while not moving.</string> <string name="ApiExample.Role.Mayor">Mayor</string>
<string name="outcastkillerrole.name">Outcast Killer</string> <string name="ApiExample.Role.Mayor.TabDescription">You get extra votes!</string>
<string name="outcastkillerrole.description">Outcast who can kill.</string> <string name="ApiExample.Role.Chamelon">Chamelon</string>
<string name="outcast.name">Outcast</string> <string name="ApiExample.Role.Chamelon.TabDescription">Stay invisible while not moving.</string>
<string name="ApiExample.Role.OutcastKiller">Outcast Killer</string>
<string name="ApiExample.Role.OutcastKiller.TabDescription">Outcast who can kill.</string>
<string name="outcast">Outcast</string>
<string name="outcast.roleTitle">OUTCAST</string> <string name="outcast.roleTitle">OUTCAST</string>
<string name="outcast.teamIntroDescription">You are an Outcast. You do not have a team.</string> <string name="outcast.teamIntroDescription">You are an Outcast. You do not have a team.</string>
<string name="button.think.name">Think</string> <string name="button.think">Think</string>
<string name="button.think.thinking">Thinking...</string> <string name="button.think.thinking">Thinking...</string>
<string name="button.freeze.name">Freeze</string> <string name="button.freeze">Freeze</string>
<string name="button.teleport.name">Teleport</string> <string name="button.teleport">Teleport</string>
<string name="button.callMeeting.name">Call Meeting</string> <string name="button.callMeeting">Call Meeting</string>
<string name="button.winGame.name">Win Game</string> <string name="button.winGame">Win Game</string>
<string name="modifier.captain.name">Captain</string> <string name="modifier.captain">Captain</string>
<string name="modifier.captain.description">You can call a meeting from anywhere on the map.</string> <string name="modifier.captain.TabDescription">You can call a meeting from anywhere on the map.</string>
<string name="modifier.freezed.name">Freezed</string> <string name="modifier.freezed">Freezed</string>
<string name="modifier.highPriority.name">High Priority</string> <string name="modifier.highPriority">High Priority</string>
<string name="modifier.highPriority.description">You are high priority! Idrk what this means either tbh...</string> <string name="modifier.highPriority.TabDescription">You are high priority! Idrk what this means either tbh...</string>
<string name="options.exampleOptions1.name">Example Options 1</string> <string name="options.exampleOptions1">Example Options 1</string>
<string name="options.exampleOptions1.toggleOpt1">Toggle Opt 1</string> <string name="options.exampleOptions1.toggleOpt1">Toggle Opt 1</string>
<string name="options.exampleOptions1.toggleOpt2">Toggle Opt 2</string> <string name="options.exampleOptions1.toggleOpt2">Toggle Opt 2</string>
<string name="options.exampleOptions1.numberOpt">Number Opt</string> <string name="options.exampleOptions1.numberOpt">Number Opt</string>
<string name="options.exampleOptions1.bestApi">Best API</string> <string name="options.exampleOptions1.bestApi">Best API</string>
<string name="options.exampleOptions2.name">Example Options 2</string> <string name="options.exampleOptions2">Example Options 2</string>
<string name="options.exampleOptions2.youMustChoseAPlayer">YOU MUST CHOSE A PLAYER</string> <string name="options.exampleOptions2.youMustChoseAPlayer">YOU MUST CHOSE A PLAYER</string>
<string name="options.exampleOptions2.ehWhatever">Eh whatever</string> <string name="options.exampleOptions2.ehWhatever">Eh whatever</string>
<string name="options.exampleOptions2.toggleOption1">Toggle Option 1</string> <string name="options.exampleOptions2.toggleOption1">Toggle Option 1</string>
<string name="options.exampleOptions2.toggleOption2">Toggle Option 2</string> <string name="options.exampleOptions2.toggleOption2">Toggle Option 2</string>
<string name="options.exampleOptions2.enumOpt">Enum Opt</string> <string name="options.exampleOptions2.enumOpt">Enum Opt</string>
<string name="options.captainSettings.name">Captain Settings</string> <string name="options.captainSettings">Captain Settings</string>
<string name="options.captainSettings.amount">Amount</string> <string name="options.captainSettings.amount">Amount</string>
<string name="options.captainSettings.chance">Chance</string> <string name="options.captainSettings.chance">Chance</string>
<string name="options.captainSettings.uses">Uses</string> <string name="options.captainSettings.uses">Uses</string>
<string name="options.freezeModifierSettings.name">Freeze</string> <string name="options.freezeModifierSettings">Freeze</string>
<string name="options.freezeModifierSettings.useColor">Use Color</string> <string name="options.freezeModifierSettings.useColor">Use Color</string>
<string name="options.generalModifier.name">General</string> <string name="options.generalModifier">General</string>
<string name="options.generalModifier.someBooleanOption">Some Boolean Option</string> <string name="options.generalModifier.someBooleanOption">Some Boolean Option</string>
<string name="options.generalModifier.numberOption">Number Option</string> <string name="options.generalModifier.numberOption">Number Option</string>
<string name="options.freezerRoleSettings.name">Custom Role</string> <string name="options.freezerRoleSettings">Custom Role</string>
<string name="options.freezerRoleSettings.freezeDuration">Freeze Duration</string> <string name="options.freezerRoleSettings.freezeDuration">Freeze Duration</string>
<string name="options.freezerRoleSettings.freezeUses">Freeze Uses</string> <string name="options.freezerRoleSettings.freezeUses">Freeze Uses</string>
<string name="options.teleporterOptions.name">Teleporter</string> <string name="options.teleporterOptions">Teleporter</string>
<string name="options.teleporterOptions.teleportCooldown">Teleport Cooldown</string> <string name="options.teleporterOptions.teleportCooldown">Teleport Cooldown</string>
<string name="options.teleporterOptions.teleportDuration">Teleport Duration</string> <string name="options.teleporterOptions.teleportDuration">Teleport Duration</string>
<string name="options.teleporterOptions.zoomDistance">Zoom Distance</string> <string name="options.teleporterOptions.zoomDistance">Zoom Distance</string>
<string name="settings.miraExample.name">Mira Example</string> <string name="settings.miraExample">Mira Example</string>
<string name="settings.miraExample.exampleBool">Example Bool</string> <string name="settings.miraExample.exampleBool">Example Bool</string>
<string name="settings.miraExample.exampleBool2">Example Bool 2</string> <string name="settings.miraExample.exampleBool2">Example Bool 2</string>
<string name="settings.miraExample.slider">Slider</string> <string name="settings.miraExample.slider">Slider</string>
+1 -1
View File
@@ -10,7 +10,7 @@ namespace MiraAPI.Example.Roles;
public class ChameloenRole : CrewmateRole, ICustomRole public class ChameloenRole : CrewmateRole, ICustomRole
{ {
public string IdPart => "chamelon"; public string IdPart => "ApiExample.Role.Chamelon";
public Color RoleColor => Palette.AcceptedGreen; public Color RoleColor => Palette.AcceptedGreen;
public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate; public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate;
+1 -1
View File
@@ -6,7 +6,7 @@ namespace MiraAPI.Example.Roles;
public class FreezerRole : ImpostorRole, ICustomRole public class FreezerRole : ImpostorRole, ICustomRole
{ {
public string IdPart => "freezer"; public string IdPart => "ApiExample.Role.Freezer";
public Color RoleColor => Palette.Blue; public Color RoleColor => Palette.Blue;
public ModdedRoleTeams Team => ModdedRoleTeams.Impostor; public ModdedRoleTeams Team => ModdedRoleTeams.Impostor;
+1 -1
View File
@@ -5,7 +5,7 @@ namespace MiraAPI.Example.Roles;
public class MayorRole : CrewmateRole, ICustomRole public class MayorRole : CrewmateRole, ICustomRole
{ {
public string IdPart => "mayor"; public string IdPart => "ApiExample.Role.Mayor";
public Color RoleColor => new Color32(221, 176, 152, 255); public Color RoleColor => new Color32(221, 176, 152, 255);
public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate; public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate;
public CustomRoleConfiguration Configuration => new(this); public CustomRoleConfiguration Configuration => new(this);
+1 -1
View File
@@ -8,7 +8,7 @@ namespace MiraAPI.Example.Roles;
public class NeutralKillerRole : ImpostorRole, ICustomRole public class NeutralKillerRole : ImpostorRole, ICustomRole
{ {
public string IdPart => "outcastKiller"; public string IdPart => "ApiExample.Role.OutcastKiller";
public Color RoleColor => Color.magenta; public Color RoleColor => Color.magenta;
public ModdedRoleTeams Team => ModdedRoleTeams.Custom; public ModdedRoleTeams Team => ModdedRoleTeams.Custom;
+1 -1
View File
@@ -5,7 +5,7 @@ namespace MiraAPI.Example.Roles;
public class TeleporterRole : CrewmateRole, ICustomRole public class TeleporterRole : CrewmateRole, ICustomRole
{ {
public string IdPart => "teleporter"; public string IdPart => "ApiExample.Role.Teleporter";
public Color RoleColor => new Color32(221, 176, 152, 255); public Color RoleColor => new Color32(221, 176, 152, 255);
public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate; public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate;
@@ -575,7 +575,7 @@ public static class RoleSettingMenuPatches
return; return;
} }
__instance.roleDescriptionText.text = customRole.RoleLongDescription.Translate(); __instance.roleDescriptionText.text = customRole.RoleMedDescription;
__instance.roleTitleText.text = role.GetRoleName(); __instance.roleTitleText.text = role.GetRoleName();
var imgBg = __instance.AdvancedRolesSettings.transform.FindChild("Imagebackground"); var imgBg = __instance.AdvancedRolesSettings.transform.FindChild("Imagebackground");
+8 -4
View File
@@ -1,7 +1,6 @@
using System.Linq; using System.Globalization;
using System.Linq;
using BepInEx.Configuration; using BepInEx.Configuration;
using MiraAPI.Utilities.Assets;
using UnityEngine;
namespace MiraAPI.PluginLoading; namespace MiraAPI.PluginLoading;
@@ -15,11 +14,16 @@ public interface IMiraPlugin
/// </summary> /// </summary>
public virtual bool DisplayOnOptionsMenu => true; public virtual bool DisplayOnOptionsMenu => true;
/// <summary>
/// Gets or sets a value for the localization id to use for anything registered under this mod.
/// </summary>
public virtual string ParentLocaleId => GetType().Name.ToLower(CultureInfo.InvariantCulture);
/// <summary> /// <summary>
/// Gets the name to display on the options menu. /// Gets the name to display on the options menu.
/// </summary> /// </summary>
string OptionsTitleText { get; } string OptionsTitleText { get; }
/// <summary> /// <summary>
/// Gets the abbreviated name to display for other mods to pick up. /// Gets the abbreviated name to display for other mods to pick up.
/// </summary> /// </summary>
+7 -7
View File
@@ -132,10 +132,10 @@ public static class CustomRoleManager
roleBehaviour.Role = (RoleTypes)roleId; roleBehaviour.Role = (RoleTypes)roleId;
roleBehaviour.TeamType = customRole.Team == ModdedRoleTeams.Custom ? RoleTeamTypes.Crewmate : (RoleTeamTypes)customRole.Team; roleBehaviour.TeamType = customRole.Team == ModdedRoleTeams.Custom ? RoleTeamTypes.Crewmate : (RoleTeamTypes)customRole.Team;
roleBehaviour.NameColor = customRole.RoleColor; roleBehaviour.NameColor = customRole.RoleColor;
roleBehaviour.StringName = MiraLocaleManager.GetOrCreateLocaleString(customRole.RoleName); roleBehaviour.StringName = MiraLocaleManager.GetOrCreateLocaleString(customRole.RoleNameLocale);
roleBehaviour.BlurbName = MiraLocaleManager.GetOrCreateLocaleString(customRole.RoleDescription); roleBehaviour.BlurbName = MiraLocaleManager.GetOrCreateLocaleString(customRole.RoleDescriptionLocale);
roleBehaviour.BlurbNameMed = MiraLocaleManager.GetOrCreateLocaleString(customRole.RoleMedDescription); roleBehaviour.BlurbNameMed = MiraLocaleManager.GetOrCreateLocaleString(customRole.RoleMedDescriptionLocale);
roleBehaviour.BlurbNameLong = MiraLocaleManager.GetOrCreateLocaleString(customRole.RoleLongDescription); roleBehaviour.BlurbNameLong = MiraLocaleManager.GetOrCreateLocaleString(customRole.RoleLongDescriptionLocale);
roleBehaviour.AffectedByLightAffectors = customRole.Configuration.AffectedByLightOnAirship; roleBehaviour.AffectedByLightAffectors = customRole.Configuration.AffectedByLightOnAirship;
roleBehaviour.CanBeKilled = customRole.Configuration.CanGetKilled; roleBehaviour.CanBeKilled = customRole.Configuration.CanGetKilled;
roleBehaviour.CanUseKillButton = customRole.Configuration.UseVanillaKillButton; roleBehaviour.CanUseKillButton = customRole.Configuration.UseVanillaKillButton;
@@ -187,7 +187,7 @@ public static class CustomRoleManager
if (useTaskHint && !overridesTaskText) if (useTaskHint && !overridesTaskText)
{ {
Error($"Role {customRole.RoleName.Translate()} is using RoleHintType.TaskHint but does not override SpawnTaskHeader!"); Error($"Role {customRole.RoleName} is using RoleHintType.TaskHint but does not override SpawnTaskHeader!");
} }
CustomRoles.Add(roleId, roleBehaviour); CustomRoles.Add(roleId, roleBehaviour);
@@ -255,9 +255,9 @@ public static class CustomRoleManager
{ {
var tabText = panel.tab.gameObject.GetComponentInChildren<TextMeshPro>(); var tabText = panel.tab.gameObject.GetComponentInChildren<TextMeshPro>();
var ogPanel = HudManager.Instance.TaskStuff.transform.FindChild("TaskPanel").gameObject.GetComponent<TaskPanelBehaviour>(); var ogPanel = HudManager.Instance.TaskStuff.transform.FindChild("TaskPanel").gameObject.GetComponent<TaskPanelBehaviour>();
if (tabText.text != role.RoleName.Translate()) if (tabText.text != role.RoleName)
{ {
tabText.text = role.RoleName.Translate(); tabText.text = role.RoleName;
} }
var y = ogPanel.taskText.textBounds.size.y + 1; var y = ogPanel.taskText.textBounds.size.y + 1;
+2 -2
View File
@@ -104,9 +104,9 @@ public static class CustomRoleUtils
public static StringBuilder CreateForRole(ICustomRole role) public static StringBuilder CreateForRole(ICustomRole role)
{ {
var taskStringBuilder = new StringBuilder(); var taskStringBuilder = new StringBuilder();
taskStringBuilder.AppendLine(CultureInfo.InvariantCulture, $"{role.RoleColor.ToTextColor()}Your role is <b>{role.RoleName.Translate()}.</b></color>"); taskStringBuilder.AppendLine(CultureInfo.InvariantCulture, $"{role.RoleColor.ToTextColor()}Your role is <b>{role.RoleName}.</b></color>");
taskStringBuilder.Append("<size=70%>"); taskStringBuilder.Append("<size=70%>");
taskStringBuilder.AppendLine(CultureInfo.InvariantCulture, $"{role.RoleLongDescription.Translate()}"); taskStringBuilder.AppendLine(CultureInfo.InvariantCulture, $"{role.RoleLongDescription}");
return taskStringBuilder; return taskStringBuilder;
} }
+41 -12
View File
@@ -1,5 +1,4 @@
using System; using System;
using System.Globalization;
using System.Text; using System.Text;
using BepInEx.Configuration; using BepInEx.Configuration;
using MiraAPI.GameOptions; using MiraAPI.GameOptions;
@@ -18,27 +17,57 @@ public interface ICustomRole : IOptionable
/// <summary> /// <summary>
/// Gets the id part used to build the role's translation keys. /// Gets the id part used to build the role's translation keys.
/// </summary> /// </summary>
string IdPart => GetType().Name.ToLower(CultureInfo.InvariantCulture); string IdPart => GetType().Name;
/// <summary> /// <summary>
/// Gets the name of the role. /// Gets the name of the role.
/// </summary> /// </summary>
string RoleName => MiraLocaleManager.BuildTranslationId(IdPart, "name"); string RoleName => MiraLocaleManager.Get(RoleNameLocale);
/// <summary>
/// Gets the role's name id for localization.
/// </summary>
string RoleNameLocale => IdPart;
/// <summary> /// <summary>
/// Gets the description of the role. Used in the Intro Cutscene. /// Gets the description of the role. Used in the Intro Cutscene.
/// </summary> /// </summary>
string RoleDescription => MiraLocaleManager.BuildTranslationId(IdPart, "description"); string RoleDescription => MiraLocaleManager.Get(RoleDescriptionLocale);
/// <summary> /// <summary>
/// Gets the medium description of the role. Used in the role guide. /// Gets the role's intro blurb id for localization.
/// </summary> /// </summary>
string RoleMedDescription => RoleDescription; string RoleDescriptionLocale => MiraLocaleManager.BuildTranslationId(IdPart, "IntroBlurb");
/// <summary> /// <summary>
/// Gets the long description of the role. Used in the Role Tab and Role Options. /// Gets the medium description of the role. Used in the role guide and options menu.
/// </summary> /// </summary>
string RoleLongDescription => MiraLocaleManager.BuildTranslationId(IdPart, "description"); string RoleMedDescription => MiraLocaleManager.Get(RoleMedDescriptionLocale);
/// <summary>
/// Gets the role's medium description id for localization.
/// </summary>
string RoleMedDescriptionLocale => MiraLocaleManager.BuildTranslationId(IdPart, "MedDescription");
/// <summary>
/// Gets the long description of the role. Used in the Role Tab.
/// </summary>
string RoleLongDescription => MiraLocaleManager.Get(RoleLongDescriptionLocale);
/// <summary>
/// Gets the role's long description id for localization.
/// </summary>
string RoleLongDescriptionLocale => MiraLocaleManager.BuildTranslationId(IdPart, "TabDescription");
/// <summary>
/// Gets the wiki description of the role. Used in the wiki, but not currently required.
/// </summary>
string RoleWikiDescription => MiraLocaleManager.Get(RoleLongDescriptionLocale);
/// <summary>
/// Gets the role's wiki description id for localization.
/// </summary>
string RoleWikiDescriptionLocale => MiraLocaleManager.BuildTranslationId(IdPart, "WikiDescription");
/// <summary> /// <summary>
/// Gets the faction / alignment of the role. Used in the role guide. /// Gets the faction / alignment of the role. Used in the role guide.
@@ -187,7 +216,7 @@ public interface ICustomRole : IOptionable
{ {
if (!Configuration.CanModifyChance) if (!Configuration.CanModifyChance)
{ {
Error($"Cannot modify chance for role: {RoleName.Translate()}"); Error($"Cannot modify chance for role: {RoleName}");
return; return;
} }
@@ -197,7 +226,7 @@ public interface ICustomRole : IOptionable
return; return;
} }
Error($"Error getting chance configuration for role: {RoleName.Translate()}"); Error($"Error getting chance configuration for role: {RoleName}");
} }
/// <summary> /// <summary>
@@ -212,7 +241,7 @@ public interface ICustomRole : IOptionable
return; return;
} }
Error($"Error getting count configuration for role: {RoleName.Translate()}"); Error($"Error getting count configuration for role: {RoleName}");
} }
/// <summary> /// <summary>
@@ -252,7 +281,7 @@ public interface ICustomRole : IOptionable
/// <returns>A string with a custom ejection message or <see langword="null"/>.</returns> /// <returns>A string with a custom ejection message or <see langword="null"/>.</returns>
string? GetCustomEjectionMessage(NetworkedPlayerInfo player) string? GetCustomEjectionMessage(NetworkedPlayerInfo player)
{ {
return Team == ModdedRoleTeams.Impostor ? $"{player.PlayerName} was The {RoleName.Translate()}" : null; return Team == ModdedRoleTeams.Impostor ? $"{player.PlayerName} was The {RoleName}" : null;
} }
/// <summary> /// <summary>
+1 -1
View File
@@ -537,7 +537,7 @@ public static class Helpers
{ {
if (role is ICustomRole custom) if (role is ICustomRole custom)
{ {
return custom.RoleName.Translate(); return custom.RoleName;
} }
return role.NiceName; return role.NiceName;
} }