From 338ebba191a850935015cbb80ac42486c173fd59 Mon Sep 17 00:00:00 2001
From: Matt <97983689+bluepilledgreat@users.noreply.github.com>
Date: Sat, 15 Mar 2025 00:17:23 +0000
Subject: [PATCH] Localise more custom dialog related strings (#4881)
* translate template comments
* localise default custom theme name
---
Bloxstrap/Extensions/CustomThemeTemplateEx.cs | 28 ++++++++++++++-
.../CustomBootstrapperTemplate_Blank.xml | 4 +--
.../CustomBootstrapperTemplate_Simple.xml | 2 +-
Bloxstrap/Resources/Strings.Designer.cs | 36 +++++++++++++++++++
Bloxstrap/Resources/Strings.resx | 13 +++++++
.../Dialogs/AddCustomThemeDialog.xaml.cs | 7 ++--
6 files changed, 83 insertions(+), 7 deletions(-)
diff --git a/Bloxstrap/Extensions/CustomThemeTemplateEx.cs b/Bloxstrap/Extensions/CustomThemeTemplateEx.cs
index 4088f02..ed9dcea 100644
--- a/Bloxstrap/Extensions/CustomThemeTemplateEx.cs
+++ b/Bloxstrap/Extensions/CustomThemeTemplateEx.cs
@@ -1,10 +1,36 @@
-namespace Bloxstrap.Extensions
+using System.Text;
+
+namespace Bloxstrap.Extensions
{
static class CustomThemeTemplateEx
{
+ const string EXAMPLES_URL = "https://github.com/bloxstraplabs/custom-bootstrapper-examples";
+
public static string GetFileName(this CustomThemeTemplate template)
{
return $"CustomBootstrapperTemplate_{template}.xml";
}
+
+ public static string GetFileContents(this CustomThemeTemplate template)
+ {
+ string contents = Encoding.UTF8.GetString(Resource.Get(template.GetFileName()).Result);
+
+ switch (template)
+ {
+ case CustomThemeTemplate.Blank:
+ {
+ string moreText = string.Format(Strings.CustomTheme_Templates_Blank_MoreExamples, EXAMPLES_URL);
+ return string.Format(contents, Strings.CustomTheme_Templates_Blank_UIElements, moreText);
+ }
+ case CustomThemeTemplate.Simple:
+ {
+ string moreText = string.Format(Strings.CustomTheme_Templates_Simple_MoreExamples, EXAMPLES_URL);
+ return string.Format(contents, moreText);
+ }
+ default:
+ Debug.Assert(false);
+ return contents;
+ }
+ }
}
}
diff --git a/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml b/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml
index 99efce9..3945086 100644
--- a/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml
+++ b/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml
@@ -1,4 +1,4 @@
-
-
+
+
\ No newline at end of file
diff --git a/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml b/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml
index 7664806..abe586d 100644
--- a/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml
+++ b/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs
index 5395778..848b724 100644
--- a/Bloxstrap/Resources/Strings.Designer.cs
+++ b/Bloxstrap/Resources/Strings.Designer.cs
@@ -973,6 +973,15 @@ namespace Bloxstrap.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Custom Theme {0}.
+ ///
+ public static string CustomTheme_DefaultName {
+ get {
+ return ResourceManager.GetString("CustomTheme.DefaultName", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Save changes to {0}?.
///
@@ -1271,6 +1280,33 @@ namespace Bloxstrap.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Examples of custom bootstrappers can be found at {0}.
+ ///
+ public static string CustomTheme_Templates_Blank_MoreExamples {
+ get {
+ return ResourceManager.GetString("CustomTheme.Templates.Blank.MoreExamples", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Put UI elements here.
+ ///
+ public static string CustomTheme_Templates_Blank_UIElements {
+ get {
+ return ResourceManager.GetString("CustomTheme.Templates.Blank.UIElements", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Find more custom bootstrapper examples at {0}.
+ ///
+ public static string CustomTheme_Templates_Simple_MoreExamples {
+ get {
+ return ResourceManager.GetString("CustomTheme.Templates.Simple.MoreExamples", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Add Fast Flag.
///
diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx
index 7c42f6a..f0355ae 100644
--- a/Bloxstrap/Resources/Strings.resx
+++ b/Bloxstrap/Resources/Strings.resx
@@ -1474,4 +1474,17 @@ Defaulting to {1}.
Update Roblox in the background instead of waiting. Not recommended for slow networks. At least 3GB of free storage space is required for this feature to work.
+
+ Put UI elements here
+
+
+ Examples of custom bootstrappers can be found at {0}
+
+
+ Find more custom bootstrapper examples at {0}
+
+
+ Custom Theme {0}
+ {0} is a string (e.g. '1', '1-1234')
+
\ No newline at end of file
diff --git a/Bloxstrap/UI/Elements/Dialogs/AddCustomThemeDialog.xaml.cs b/Bloxstrap/UI/Elements/Dialogs/AddCustomThemeDialog.xaml.cs
index 94ce4a8..9d88c8c 100644
--- a/Bloxstrap/UI/Elements/Dialogs/AddCustomThemeDialog.xaml.cs
+++ b/Bloxstrap/UI/Elements/Dialogs/AddCustomThemeDialog.xaml.cs
@@ -39,11 +39,12 @@ namespace Bloxstrap.UI.Elements.Dialogs
{
int count = Directory.GetDirectories(Paths.CustomThemes).Count();
- string name = $"Custom Theme {count + 1}";
+ int i = count + 1;
+ string name = string.Format(Strings.CustomTheme_DefaultName, i);
// TODO: this sucks
if (File.Exists(GetThemePath(name)))
- name += " " + Random.Shared.Next(1, 100000).ToString(); // easy
+ name = string.Format(Strings.CustomTheme_DefaultName, $"{i}-{Random.Shared.Next(1, 100000)}"); // easy
return name;
}
@@ -76,7 +77,7 @@ namespace Bloxstrap.UI.Elements.Dialogs
string themeFilePath = Path.Combine(dir, "Theme.xml");
- string templateContent = Encoding.UTF8.GetString(Resource.Get(template.GetFileName()).Result);
+ string templateContent = template.GetFileContents();
File.WriteAllText(themeFilePath, templateContent);
}