Skip to content

Commit

Permalink
Allow for localization of app buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
cheese3660 committed Jan 18, 2024
1 parent feabaac commit 195b3b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ SpaceWarp/Console/On,Text,,On,On,On,开
SpaceWarp/Console/Off,Text,,Off,Off,Off,关
SpaceWarp/AvcDialog/Title,Text,,spacewarp.avc,spacewarp.avc,spacewarp.avc,spacewarp.avc
SpaceWarp/AvcDialog/MainText,Text,,Allow Space Warp to automatically check for mod updates online?,Permitir que o Space Warp verifique automaticamente se há atualizações de mods online?,Autoriser Space Warp à vérifier automatiquement les mises à jour de mods en ligne ?,允许 Space Warp 自动在线检查模组更新?
SpaceWarp/AvcDialog/MinorText,Text,,*You can change this later in the settings menu.,*Pode alterá-lo mais tarde no menu de definições.,*Vous pouvez modifier plus tard dans le menu des réglages.,*您可以稍后在设置菜单中更改此设置。
SpaceWarp/AvcDialog/MinorText,Text,,*You can change this later in the settings menu.,*Pode alterá-lo mais tarde no menu de definições.,*Vous pouvez modifier plus tard dans le menu des réglages.,*您可以稍后在设置菜单中更改此设置。
SpaceWarp/Menu/Apps,Text,,Apps,Aplicativos,Applications,应用
15 changes: 6 additions & 9 deletions src/SpaceWarp.UI/Backend/UI/Appbar/AppbarBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static GameObject AddButton(string buttonText, Sprite buttonIcon, string
var localizer = text.gameObject.GetComponent<Localize>();
if (localizer)
{
UnityObject.Destroy(localizer);
localizer.Term = buttonText;
}

// Change the icon.
Expand Down Expand Up @@ -260,7 +260,7 @@ public static void AddOABButton(string buttonText, Sprite buttonIcon, string but
var localizer = text.gameObject.GetComponent<Localize>();
if (localizer)
{
UnityObject.Destroy(localizer);
localizer.Term = buttonText;
}

// Change the icon.
Expand Down Expand Up @@ -356,13 +356,9 @@ private static GameObject CreateKSCTray()
var title = kscAppTrayButton.GetChild("TXT-Launchpad");
{
// Suppress renaming of the button to Launchpad
title.GetComponent<TextMeshProUGUI>().text = "Apps"; // Set the text in case term does not exist
var localizer = title.GetComponent<Localize>();
if (localizer)
{
UnityObject.Destroy(localizer);
}
var text = title.GetComponent<TextMeshProUGUI>();
text.text = "Apps";
localizer.Term = "SpaceWarp/Menu/Apps";
}

// Get the popup tray and rename it
Expand Down Expand Up @@ -437,7 +433,8 @@ public static void AddKSCButton(string buttonText, Sprite buttonIcon, string but
var localizer = modText.gameObject.GetComponent<Localize>();
if (localizer)
{
UnityObject.Destroy(localizer);
// UnityObject.Destroy(localizer);
localizer.Term = buttonText;
}

// Change the icon
Expand Down
1 change: 1 addition & 0 deletions src/SpaceWarp.UI/Modules/UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public override void PreInitializeModule()
/// <inheritdoc/>
public override void InitializeModule()
{

ModuleLogger.LogInfo("Initializing UI");
if (VersionChecking.Instance.ConfigFirstLaunch.Value)
{
Expand Down

0 comments on commit 195b3b7

Please sign in to comment.