translate template comments

This commit is contained in:
bluepilledgreat 2025-03-15 00:09:18 +00:00
parent 9ef6579a41
commit a8158dec33
6 changed files with 67 additions and 5 deletions

View File

@ -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;
}
}
}
}

View File

@ -1,4 +1,4 @@
<BloxstrapCustomBootstrapper Version="1" Height="320" Width="500">
<!-- Put UI elements here -->
<!-- Examples of custom bootstrappers can be found at https://github.com/bloxstraplabs/custom-bootstrapper-examples -->
<!-- {0} -->
<!-- {1} -->
</BloxstrapCustomBootstrapper>

View File

@ -1,5 +1,5 @@
<BloxstrapCustomBootstrapper Version="1" Height="320" Width="520" IgnoreTitleBarInset="True" Theme="Default" Margin="30">
<!-- Find more custom bootstrapper examples at https://github.com/bloxstraplabs/custom-bootstrapper-examples -->
<!-- {0} -->
<TitleBar Title="" ShowMinimize="False" ShowClose="False" />
<Image Source="{Icon}" Height="100" Width="100" HorizontalAlignment="Center" Margin="0,15,0,0" />

View File

@ -1271,6 +1271,33 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Examples of custom bootstrappers can be found at {0}.
/// </summary>
public static string CustomTheme_Templates_Blank_MoreExamples {
get {
return ResourceManager.GetString("CustomTheme.Templates.Blank.MoreExamples", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Put UI elements here.
/// </summary>
public static string CustomTheme_Templates_Blank_UIElements {
get {
return ResourceManager.GetString("CustomTheme.Templates.Blank.UIElements", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Find more custom bootstrapper examples at {0}.
/// </summary>
public static string CustomTheme_Templates_Simple_MoreExamples {
get {
return ResourceManager.GetString("CustomTheme.Templates.Simple.MoreExamples", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Add Fast Flag.
/// </summary>

View File

@ -1474,4 +1474,13 @@ Defaulting to {1}.</value>
<data name="Menu.Behaviour.BackgroundUpdates.Description" xml:space="preserve">
<value>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.</value>
</data>
<data name="CustomTheme.Templates.Blank.UIElements" xml:space="preserve">
<value>Put UI elements here</value>
</data>
<data name="CustomTheme.Templates.Blank.MoreExamples" xml:space="preserve">
<value>Examples of custom bootstrappers can be found at {0}</value>
</data>
<data name="CustomTheme.Templates.Simple.MoreExamples" xml:space="preserve">
<value>Find more custom bootstrapper examples at {0}</value>
</data>
</root>

View File

@ -76,7 +76,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);
}