Skip to content

Commit

Permalink
System for better management of enum names
Browse files Browse the repository at this point in the history
eradicates all those redundant translations
  • Loading branch information
pizzaboxer committed Jul 4, 2024
1 parent f99978b commit cc4c380
Show file tree
Hide file tree
Showing 20 changed files with 145 additions and 321 deletions.
2 changes: 1 addition & 1 deletion Bloxstrap/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
</Setter>
</Style>

<converters:ResourceConverter x:Key="ResourceConverter" />
<converters:StringFormatConverter x:Key="StringFormatConverter" />
<converters:RangeConverter x:Key="RangeConverter" />
<converters:EnumNameConverter x:Key="EnumNameConverter" />
</ResourceDictionary>
</Application.Resources>
</Application>
7 changes: 7 additions & 0 deletions Bloxstrap/Enums/BootstrapperIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
{
public enum BootstrapperIcon
{
[EnumName(StaticName = "Bloxstrap")]
IconBloxstrap,
[EnumName(StaticName = "2008")]
Icon2008,
[EnumName(StaticName = "2011")]
Icon2011,
IconEarly2015,
IconLate2015,
[EnumName(StaticName = "2017")]
Icon2017,
[EnumName(StaticName = "2019")]
Icon2019,
[EnumName(StaticName = "2022")]
Icon2022,
[EnumName(FromTranslation = "Common.Custom")]
IconCustom
}
}
1 change: 1 addition & 0 deletions Bloxstrap/Enums/BootstrapperStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum BootstrapperStyle
ProgressDialog,
ClassicFluentDialog,
ByfronDialog,
[EnumName(StaticName = "Bloxstrap")]
FluentDialog,
FluentAeroDialog
}
Expand Down
1 change: 1 addition & 0 deletions Bloxstrap/Enums/CursorType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public enum CursorType
{
[EnumName(FromTranslation = "Common.Default")]
Default,
From2006,
From2013
Expand Down
1 change: 1 addition & 0 deletions Bloxstrap/Enums/FlagPresets/InGameMenuVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public enum InGameMenuVersion
{
[EnumName(FromTranslation = "Common.Default")]
Default,
V1,
V2,
Expand Down
4 changes: 4 additions & 0 deletions Bloxstrap/Enums/FlagPresets/MSAAMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
{
public enum MSAAMode
{
[EnumName(FromTranslation = "Common.Automatic")]
Default,
[EnumName(StaticName = "1x")]
x1,
[EnumName(StaticName = "2x")]
x2,
[EnumName(StaticName = "4x")]
x4
}
}
9 changes: 0 additions & 9 deletions Bloxstrap/Enums/FlagPresets/MaterialVersion.cs

This file was deleted.

5 changes: 3 additions & 2 deletions Bloxstrap/Enums/FlagPresets/RenderingMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
{
public enum RenderingMode
{
[EnumName(FromTranslation = "Common.Automatic")]
Default,
Vulkan,
// Vulkan,
D3D11,
D3D10,
OpenGL
// OpenGL
}
}
1 change: 1 addition & 0 deletions Bloxstrap/Enums/FlagPresets/TextureQuality.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public enum TextureQuality
{
[EnumName(FromTranslation = "Common.Automatic")]
Default,
Level0,
Level1,
Expand Down
1 change: 1 addition & 0 deletions Bloxstrap/Enums/Theme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public enum Theme
{
[EnumName(FromTranslation = "Common.SystemDefault")]
Default,
Light,
Dark
Expand Down
12 changes: 4 additions & 8 deletions Bloxstrap/Locale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal static class Locale

public static readonly Dictionary<string, string> SupportedLocales = new()
{
{ "nil", Strings.Enums_Theme_Default }, // /shrug
{ "nil", Strings.Common_SystemDefault },
{ "en", "English" },
{ "en-US", "English (United States)" },
{ "ar", "العربية" },
Expand Down Expand Up @@ -55,13 +55,9 @@ internal static class Locale

public static List<string> GetLanguages()
{
var languages = new List<string>()
{
Strings.Enums_Theme_Default,
"English",
"English (United States)"
};

var languages = new List<string>();

languages.AddRange(SupportedLocales.Values.Take(3));
languages.AddRange(SupportedLocales.Values.Where(x => !languages.Contains(x)).OrderBy(x => x));

return languages;
Expand Down
14 changes: 14 additions & 0 deletions Bloxstrap/Models/Attributes/EnumNameAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bloxstrap.Models.Attributes
{
class EnumNameAttribute : Attribute
{
public string? StaticName { get; set; }
public string? FromTranslation { get; set; }
}
}
1 change: 0 additions & 1 deletion Bloxstrap/Models/BootstrapperIconEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace Bloxstrap.Models
public class BootstrapperIconEntry
{
public BootstrapperIcon IconType { get; set; }
public string Name => IconType.ToString();
public ImageSource ImageSource => IconType.GetIcon().GetImageSource();
}
}
Loading

0 comments on commit cc4c380

Please sign in to comment.