localise default custom theme name

This commit is contained in:
bluepilledgreat 2025-03-15 00:13:32 +00:00
parent a8158dec33
commit e768bae5d6
3 changed files with 16 additions and 2 deletions

View File

@ -973,6 +973,15 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Custom Theme {0}.
/// </summary>
public static string CustomTheme_DefaultName {
get {
return ResourceManager.GetString("CustomTheme.DefaultName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save changes to {0}?.
/// </summary>

View File

@ -1483,4 +1483,8 @@ Defaulting to {1}.</value>
<data name="CustomTheme.Templates.Simple.MoreExamples" xml:space="preserve">
<value>Find more custom bootstrapper examples at {0}</value>
</data>
<data name="CustomTheme.DefaultName" xml:space="preserve">
<value>Custom Theme {0}</value>
<comment>{0} is a string (e.g. '1', '1-1234')</comment>
</data>
</root>

View File

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