Skip to content

Commit

Permalink
localization pt1
Browse files Browse the repository at this point in the history
  • Loading branch information
Reezonate committed Dec 6, 2023
1 parent 5f3c208 commit 6b6dd07
Show file tree
Hide file tree
Showing 18 changed files with 102 additions and 74 deletions.
5 changes: 1 addition & 4 deletions BeatLeader.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Parameters/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"&gt;&lt;ExtraRule Prefix="__" Suffix="" Style="aaBb" /&gt;&lt;ExtraRule Prefix="____" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"&gt;&lt;ExtraRule Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;ExtraRule Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\Hermanest\Desktop\BSLegacyLauncher\Installed Versions\Beat Saber 1.29.1\Beat Saber_Data\Managed\Main.dll" /&gt;&#xD;
&lt;Assembly Path="C:\Users\Hermanest\Desktop\BSLegacyLauncher\Installed Versions\Beat Saber 1.29.1\Plugins\BSML.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String>
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer /&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/InlayHints/GeneralInlayHintsOptions/EnableInlayHints/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=approvers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Beatmaps/@EntryIndexedValue">True</s:Boolean>
Expand Down
14 changes: 7 additions & 7 deletions Source/2_Core/Models/ScoresContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ internal static Sprite Icon(this ScoresContext context) {
};
}

internal static string Name(this ScoresContext context) {
internal static string LocalizedName(this ScoresContext context) {
return context switch {
ScoresContext.Modifiers => "General",
ScoresContext.Standard => "No Mods",
ScoresContext.Nopause => "No Pauses",
ScoresContext.Golf => "Golf",
ScoresContext.SCPM => "SCPM",
_ => "General"
ScoresContext.Modifiers => "<bll>ls-general-context</bll>",
ScoresContext.Standard => "<bll>ls-no-mods-context</bll>",
ScoresContext.Nopause => "<bll>ls-no-pauses-context</bll>",
ScoresContext.Golf => "<bll>ls-golf-context</bll>",
ScoresContext.SCPM => "<bll>ls-scpm-context</bll>",
_ => "<bll>ls-general-context</bll>"
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace BeatLeader.Components {
internal class ReplayDetailPanel : ReeUIComponentV2 {
#region Configuration

private const string WatchText = "Watch";
private const string DownloadText = "Download map";
private const string WatchText = "<bll>ls-watch-replay-short</bll>";
private const string DownloadText = "<bll>ls-download-map</bll>";

#endregion

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using BeatLeader.DataManager;
using BeatLeader.Manager;
using BeatSaberMarkupLanguage.Attributes;
Expand Down Expand Up @@ -77,8 +76,8 @@ private void OnOculusMigrationRequiredChanged(bool value) {

#region ModVersion

private const string OutdatedModVersionText = "<color=#FF8888>Mod version is outdated!";
private const string UpdatedModVersionText = "<color=#88FF88>Mod version is up to date!";
private const string OutdatedModVersionText = "<color=#FF8888><bll>ls-mod-is-outdated</bll>!";
private const string UpdatedModVersionText = "<color=#88FF88><bll>ls-mod-is-up-to-date</bll>!";

private string _versionInfoText = "";

Expand Down Expand Up @@ -151,7 +150,7 @@ private static void UpdatePlaylistButton(Button button, PlaylistsManager.Playlis
PlaylistsManager.PlaylistState.NotFound => "<color=#FF8888>",
PlaylistsManager.PlaylistState.Outdated => "<color=#FFFF88>",
PlaylistsManager.PlaylistState.UpToDate => "<color=#88FF88>",
_ => throw new ArgumentOutOfRangeException(nameof(playlistState), playlistState, null)
_ => ""
};

button.GetComponentInChildren<TextMeshProUGUI>().text = $"{prefix}{playlistType}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void SetContext(ScoresContext value) {
private void UpdateVisuals() {
if (!IsParsed) return;

_buttonText.text = _context.Name();
_buttonText.text = _context.LocalizedName();
HoverHint = _context.Description();

if (_context == PluginConfig.ScoresContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void Update() {
private static string FormatCursorText(float songTime, float accuracy) {
var fullMinutes = Mathf.FloorToInt(songTime / 60.0f);
var remainingSeconds = Mathf.FloorToInt(Mathf.Abs(songTime % 60.0f));
return $"<color=#B856FF>time: </color>{fullMinutes}:{remainingSeconds:00} <color=#B856FF>accuracy: </color>{accuracy * 100.0f:F2}<size=70%>%";
return $"<color=#B856FF><bll>ls-time</bll>: </color>{fullMinutes}:{remainingSeconds:00} <color=#B856FF><bll>ls-accuracy</bll>: </color>{accuracy * 100.0f:F2}<size=70%>%";
}

private float GetAccuracy(float viewTime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
using HMUI;
using JetBrains.Annotations;
using UnityEngine;
using Transform = UnityEngine.Transform;
using Vector3 = UnityEngine.Vector3;

namespace BeatLeader.Components {
internal class MiniProfileButtons : ReeUIComponentV2 {
Expand Down Expand Up @@ -120,10 +118,10 @@ private void UpdateFriendButton() {
_isFriend = ProfileManager.IsFriend(_player);

if (_isFriend) {
_friendButton.SetLabel("Remove friend");
_friendButton.SetLabel("<bll>ls-remove-from-followed</bll>");
_friendButton.SetState(MiniProfileButton.State.InteractableGlowing);
} else {
_friendButton.SetLabel("Add friend");
_friendButton.SetLabel("<bll>ls-add-to-followed</bll>");
_friendButton.SetState(MiniProfileButton.State.InteractableFaded);
}
}
Expand Down Expand Up @@ -157,10 +155,10 @@ private void UpdateHideButton() {
_isHidden = HiddenPlayersCache.IsHidden(_player);

if (_isHidden) {
_hideButton.SetLabel("Reveal player");
_hideButton.SetLabel("<bll>ls-reveal-player</bll>");
_hideButton.SetState(MiniProfileButton.State.InteractableGlowing);
} else {
_hideButton.SetLabel("Hide player");
_hideButton.SetLabel("<bll>ls-hide-player</bll>");
_hideButton.SetState(MiniProfileButton.State.InteractableFaded);
}
}
Expand All @@ -179,7 +177,7 @@ private void HideButtonOnClick() {

private void InitializeProfileButton() {
_profileButton.Setup(BundleLoader.ProfileIcon, true);
_profileButton.SetLabel("Open profile");
_profileButton.SetLabel("<bll>ls-open-profile</bll>");
_profileButton.OnClick += OnProfileButtonClick;
}

Expand All @@ -194,7 +192,7 @@ private void OnProfileButtonClick() {
private static Color TwitterColor => new Color(0.1f, 0.6f, 1.0f, 1.0f);
private static Color TwitchColor => new Color(0.5f, 0.3f, 1.0f, 1.0f);
private static Color YoutubeColor => new Color(1.0f, 0.0f, 0.0f, 1.0f);


private readonly Dictionary<string, SocialsButtonInfo> _socialsButtons = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void InitializePlayButton() {
}

private void RefreshPlayButtonText(bool downloading) {
_playButtonText.text = downloading ? "Cancel" : "Watch Replay";
_playButtonText.text = downloading ? "<bll>ls-cancel</bll>" : "<bll>ls-watch-replay</bll>";
}

private void SetPlayButtonInteractable(bool interactable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ private bool Active {
#region OnInitialize

protected override void OnInitialize() {
_hintField.Setup("<alpha=#66>Player Settings");
_hintField.Setup("<alpha=#66><bll>ls-replayer-settings</bll>");

_showUIToggle.Setup(BundleLoader.UIIcon, "Enable UI", _hintField);
_showUIToggle.Setup(BundleLoader.UIIcon, "<bll>ls-replayer-enable-ui</bll>", _hintField);
_showUIToggle.Value = !PluginConfig.ReplayerSettings.AutoHideUI;
_showUIToggle.OnClick += _ => UpdateReplayerSettings();

_loadEnvironmentToggle.Setup(BundleLoader.SceneIcon, "Load player environment", _hintField);
_loadEnvironmentToggle.Setup(BundleLoader.SceneIcon, "<bll>ls-replayer-load-environment</bll>", _hintField);
_loadEnvironmentToggle.Value = PluginConfig.ReplayerSettings.LoadPlayerEnvironment;
_loadEnvironmentToggle.OnClick += _ => UpdateReplayerSettings();

_loadJumpDistanceToggle.Setup(BundleLoader.JumpDistanceIcon, "Load player JD", _hintField);
_loadJumpDistanceToggle.Setup(BundleLoader.JumpDistanceIcon, "<bll>ls-replayer-load-jd</bll>", _hintField);
_loadJumpDistanceToggle.Value = PluginConfig.ReplayerSettings.LoadPlayerJumpDistance;
_loadJumpDistanceToggle.OnClick += _ => UpdateReplayerSettings();

_saveToggle.Setup(BundleLoader.SaveIcon, "Save after download", _hintField);
_saveToggle.Setup(BundleLoader.SaveIcon, "<bll>ls-replayer-store-locally</bll>", _hintField);
_saveToggle.Value = PluginConfig.EnableReplayCaching;
_saveToggle.OnClick += OnSaveToggleValueChanged;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ internal class ScoreOverviewPage1 : ReeUIComponentV2 {

public void SetScore(Score score) {
TimeSetText = GetTimeSetString(score);
ScoreText = GetStringWithLabel(FormatUtils.FormatScore(score.modifiedScore), "score");
ScoreText = GetStringWithLabel(FormatUtils.FormatScore(score.modifiedScore), "<bll>ls-score</bll>");
_accText.Text1 = GetStringWithLabel(
FormatUtils.FormatAcc(score.accuracy),
"accuracy " + (!score.fullCombo ? $"<size=60%><color={Good}>[?]</color></size>" : ""));
"<bll>ls-accuracy</bll> " + (!score.fullCombo ? $"<size=60%><color={Good}>[?]</color></size>" : ""));
_accText.Text2 = GetStringWithLabel(
FormatUtils.FormatAcc(score.fcAccuracy),
$"<color={Good}>fc accuracy</color>");
$"<color={Good}>FC <bll>ls-accuracy</bll></color>");
_accText.HoverEnabled = !score.fullCombo;
PpText = GetStringWithLabel(FormatUtils.FormatPP(score.pp), "pp");
DetailsText = GetDetailsString(score);
Expand Down Expand Up @@ -84,17 +84,17 @@ private static string GetDetailsString(Score score) {
var sb = new StringBuilder();

sb.Append("<line-height=80%>");
sb.Append($"<color={Faded}>Pauses: <color={Neutral}>{score.pauses} ");
sb.Append($"<color={Faded}><bll>ls-pauses</bll>: <color={Neutral}>{score.pauses} ");
sb.AppendLine(score.modifiers.IsEmpty()
? $"<color={Faded}>No Modifiers"
: $"<color={Faded}>Modifiers: <color={Neutral}>{score.modifiers}"
? $"<color={Faded}><bll>ls-modifiers</bll>: -"
: $"<color={Faded}><bll>ls-modifiers</bll>: <color={Neutral}>{score.modifiers}"
);

if (score.fullCombo) sb.Append($"<color={Good}>Full Combo</color> ");
if (score.missedNotes > 0) sb.Append($"<color={Faded}>Misses: <color={Bad}>{score.missedNotes}</color> ");
if (score.badCuts > 0) sb.Append($"<color={Faded}>Bad cuts: <color={Bad}>{score.badCuts}</color> ");
if (score.bombCuts > 0) sb.Append($"<color={Faded}>Bomb cuts: <color={Bad}>{score.bombCuts}</color> ");
if (score.wallsHit > 0) sb.Append($"<color={Faded}>Walls hit: <color={Bad}>{score.wallsHit}</color> ");
if (score.missedNotes > 0) sb.Append($"<color={Faded}><bll>ls-misses</bll>: <color={Bad}>{score.missedNotes}</color> ");
if (score.badCuts > 0) sb.Append($"<color={Faded}><bll>ls-bad-cuts</bll>: <color={Bad}>{score.badCuts}</color> ");
if (score.bombCuts > 0) sb.Append($"<color={Faded}><bll>ls-bomb-cuts</bll>: <color={Bad}>{score.bombCuts}</color> ");
if (score.wallsHit > 0) sb.Append($"<color={Faded}><bll>ls-walls-hit</bll>: <color={Bad}>{score.wallsHit}</color> ");

return sb.ToString();
}
Expand Down
33 changes: 31 additions & 2 deletions Source/8_UI/SettingsPanel/SettingsPanelUI.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using BeatSaberMarkupLanguage.Attributes;
using BeatSaberMarkupLanguage.Components;
using System.Collections.Generic;
using BeatSaberMarkupLanguage.Attributes;
using BeatSaberMarkupLanguage.Util;
using JetBrains.Annotations;

Expand All @@ -20,5 +20,34 @@ private bool MenuButtonEnabled {
}

#endregion

#region Language

[UIValue("override-language"), UsedImplicitly]
private bool OverrideLanguage {
get => PluginConfig.OverrideLanguage;
set {
PluginConfig.OverrideLanguage = value;
NotifyPropertyChanged();
}
}

[UIValue("language-choices"), UsedImplicitly]
private List<BLLanguage> _languageOptions = BLLocalization.SupportedLanguagesSorted();

[UIValue("language-choice"), UsedImplicitly]
private BLLanguage _languageValue = PluginConfig.SelectedLanguage;

[UIAction("language-on-change"), UsedImplicitly]
private void LanguageOnChange(BLLanguage selectedValue) {
PluginConfig.SelectedLanguage = selectedValue;
}

[UIAction("language-formatter"), UsedImplicitly]
private string LanguageFormatter(BLLanguage selectedValue) {
return BLLocalization.GetLanguageName(selectedValue);
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</vertical>
<horizontal pref-height="10" spacing="3">
<button interactable="~delete-button-interactable"
text="Delete" pref-height="10"
text="&lt;bll&gt;ls-delete&lt;/bll&gt;" pref-height="10"
click-event="show-deletion-modal"
horizontal-fit="Unconstrained"/>
<primary-button interactable="~watch-button-interactable"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<horizontal pref-height="20">
<vertical spacing="0.5" vertical-fit="PreferredSize">
<horizontal pref-height="5" active="~oculus-migration-button-active" spacing="2" horizontal-fit="PreferredSize">
<text text="Sign up to use website" font-color="#FFFF88" align="Center"/>
<button text="Sign up" on-click="oculus-migration-button-on-click"/>
<text text="&lt;bll&gt;ls-oculus-signup-hint&lt;/bll&gt;" font-color="#FFFF88" align="Center"/>
<button text="&lt;bll&gt;ls-oculus-signup-button&lt;/bll&gt;" on-click="oculus-migration-button-on-click"/>
</horizontal>
<horizontal pref-height="5" spacing="2" horizontal-fit="PreferredSize">
<text text="~version-info-text" align="Center"/>
<button text="Update" active="~version-update-button-active" on-click="version-update-button-on-click"/>
<button text="&lt;bll&gt;ls-update-mod-button&lt;/bll&gt;" active="~version-update-button-active" on-click="version-update-button-on-click"/>
</horizontal>
<horizontal pref-height="4">
<text text="&lt;u&gt;Playlists" font-size="3" font-color="#999999" align="Center"/>
<text text="&lt;bll&gt;ls-playlists&lt;/bll&gt;" underlined="true" font-size="3" font-color="#999999" align="Center"/>
</horizontal>
<horizontal pref-height="5" spacing="2" horizontal-fit="PreferredSize">
<button pref-width="16" id="nominated-playlist-button" text="A"/>
Expand All @@ -21,7 +21,7 @@
</vertical>
</horizontal>
<horizontal pad-top="2" pref-height="4">
<text text="&lt;u&gt;BeatLeader community" font-size="3.4" font-color="#999999" align="Center"/>
<text text="&lt;bll&gt;ls-bl-community&lt;/bll&gt;" underlined="true" font-size="3.4" font-color="#999999" align="Center"/>
</horizontal>
<horizontal pref-height="6" spacing="1" horizontal-fit="PreferredSize">
<clickable-image src="#BL_Website" pref-width="~image-width" preserve-aspect="true" on-click="website-on-click"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<vertical id="container" spacing="0" pad="2" vertical-fit="PreferredSize" bg="round-rect-panel">
<text text="&lt;u&gt;Scores Context" font-size="3.0" font-color="#999999" align="Center"/>
<text text="&lt;bll&gt;ls-scores-context&lt;/bll&gt;" underlined="true" font-size="3.0" font-color="#999999" align="Center"/>
</vertical>
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<vertical id="container" pref-width="42" pad="2" spacing="0.4" vertical-fit="PreferredSize" bg="round-rect-panel">
<text text="&lt;u&gt;Leaderboard Settings" font-size="4.0" font-color="#999999" align="Center"/>
<toggle-setting text="Avatar" value="avatar-mask-value" apply-on-change="true"/>
<toggle-setting text="Country" value="country-mask-value" apply-on-change="true"/>
<toggle-setting text="Clans" value="clans-mask-value" apply-on-change="true"/>
<toggle-setting text="Score" value="score-mask-value" apply-on-change="true"/>
<toggle-setting text="Time" value="time-mask-value" apply-on-change="true"/>
<toggle-setting text="Mistakes" value="mistakes-mask-value" apply-on-change="true"/>
<toggle-setting text="Pauses" value="pauses-mask-value" apply-on-change="true"/>
<vertical id="container" pad="2" spacing="1" vertical-fit="PreferredSize" bg="round-rect-panel">
<text text="&lt;bll&gt;ls-leaderboard-settings&lt;/bll&gt;" underlined="true" font-size="4.0" font-color="#999999" align="Center"/>

<vertical pref-width="42" spacing="0.4" vertical-fit="PreferredSize">
<toggle-setting text="&lt;bll&gt;ls-avatar&lt;/bll&gt;" value="avatar-mask-value" apply-on-change="true"/>
<toggle-setting text="&lt;bll&gt;ls-country&lt;/bll&gt;" value="country-mask-value" apply-on-change="true"/>
<toggle-setting text="&lt;bll&gt;ls-clans&lt;/bll&gt;" value="clans-mask-value" apply-on-change="true"/>
<toggle-setting text="&lt;bll&gt;ls-score&lt;/bll&gt;" value="score-mask-value" apply-on-change="true"/>
<toggle-setting text="&lt;bll&gt;ls-time&lt;/bll&gt;" value="time-mask-value" apply-on-change="true"/>
<toggle-setting text="&lt;bll&gt;ls-mistakes&lt;/bll&gt;" value="mistakes-mask-value" apply-on-change="true"/>
<toggle-setting text="&lt;bll&gt;ls-pauses&lt;/bll&gt;" value="pauses-mask-value" apply-on-change="true"/>
</vertical>
</vertical>
Loading

0 comments on commit 6b6dd07

Please sign in to comment.