localise custom theme editor

This commit is contained in:
bluepilledgreat 2025-03-11 18:41:03 +00:00
parent 94ed521d31
commit 3cfa9a0aad
4 changed files with 92 additions and 7 deletions

View File

@ -856,6 +856,69 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Save changes to {0}?.
/// </summary>
public static string CustomTheme_Editor_ConfirmSave {
get {
return ResourceManager.GetString("CustomTheme.Editor.ConfirmSave", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open Theme Directory.
/// </summary>
public static string CustomTheme_Editor_OpenThemeDirectory {
get {
return ResourceManager.GetString("CustomTheme.Editor.OpenThemeDirectory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Preview.
/// </summary>
public static string CustomTheme_Editor_Preview {
get {
return ResourceManager.GetString("CustomTheme.Editor.Preview", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save.
/// </summary>
public static string CustomTheme_Editor_Save {
get {
return ResourceManager.GetString("CustomTheme.Editor.Save", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to An error occurred while saving your theme..
/// </summary>
public static string CustomTheme_Editor_Save_Error {
get {
return ResourceManager.GetString("CustomTheme.Editor.Save.Error", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Theme successfully saved!.
/// </summary>
public static string CustomTheme_Editor_Save_Success {
get {
return ResourceManager.GetString("CustomTheme.Editor.Save.Success", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Editing &quot;{0}&quot;.
/// </summary>
public static string CustomTheme_Editor_Title {
get {
return ResourceManager.GetString("CustomTheme.Editor.Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}.{1} uses blacklisted scheme {2}.
/// </summary>

View File

@ -1366,4 +1366,25 @@ Please close any applications that may be using Roblox's files, and relaunch.</v
<data name="CustomTheme.ElementTypeCreationFailed" xml:space="preserve">
<value>{0} failed to create {1}: {2}</value>
</data>
<data name="CustomTheme.Editor.Title" xml:space="preserve">
<value>Editing "{0}"</value>
</data>
<data name="CustomTheme.Editor.Save.Success" xml:space="preserve">
<value>Theme successfully saved!</value>
</data>
<data name="CustomTheme.Editor.Save.Error" xml:space="preserve">
<value>An error occurred while saving your theme.</value>
</data>
<data name="CustomTheme.Editor.ConfirmSave" xml:space="preserve">
<value>Save changes to {0}?</value>
</data>
<data name="CustomTheme.Editor.Save" xml:space="preserve">
<value>Save</value>
</data>
<data name="CustomTheme.Editor.Preview" xml:space="preserve">
<value>Preview</value>
</data>
<data name="CustomTheme.Editor.OpenThemeDirectory" xml:space="preserve">
<value>Open Theme Directory</value>
</data>
</root>

View File

@ -8,6 +8,7 @@
xmlns:dmodels="clr-namespace:Bloxstrap.UI.ViewModels.Editor"
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="{Binding Path=Title, Mode=OneTime}"
Width="1000"
@ -48,7 +49,7 @@
Grid.Row="2"
Margin="10"
Command="{Binding Path=OpenThemeFolderCommand, Mode=OneTime}"
Content="Open Theme Folder" />
Content="{x:Static resources:Strings.CustomTheme_Editor_OpenThemeDirectory}" />
<Grid
Grid.Row="2"
@ -63,14 +64,14 @@
Grid.Column="0"
Margin="0,0,4,0"
Command="{Binding Path=PreviewCommand, Mode=OneTime}"
Content="Preview" />
Content="{x:Static resources:Strings.CustomTheme_Editor_Preview}" />
<ui:Button
Grid.Column="1"
Margin="4,0,0,0"
Appearance="Primary"
Command="{Binding Path=SaveCommand, Mode=OneTime}"
Content="Save" />
Content="{x:Static resources:Strings.CustomTheme_Editor_Save}" />
</Grid>
<ui:Snackbar

View File

@ -147,7 +147,7 @@ namespace Bloxstrap.UI.Elements.Editor
_viewModel.ThemeSavedCallback = ThemeSavedCallback;
_viewModel.Directory = directory;
_viewModel.Name = name;
_viewModel.Title = $"Editing \"{name}\"";
_viewModel.Title = string.Format(Strings.CustomTheme_Editor_Title, name);
_viewModel.Code = themeContents;
DataContext = _viewModel;
@ -173,9 +173,9 @@ namespace Bloxstrap.UI.Elements.Editor
private void ThemeSavedCallback(bool success, string message)
{
if (success)
Snackbar.Show("Settings saved!", message, Wpf.Ui.Common.SymbolRegular.CheckmarkCircle32, Wpf.Ui.Common.ControlAppearance.Success);
Snackbar.Show(Strings.CustomTheme_Editor_Save_Success, message, Wpf.Ui.Common.SymbolRegular.CheckmarkCircle32, Wpf.Ui.Common.ControlAppearance.Success);
else
Snackbar.Show("Error", message, Wpf.Ui.Common.SymbolRegular.ErrorCircle24, Wpf.Ui.Common.ControlAppearance.Danger);
Snackbar.Show(Strings.CustomTheme_Editor_Save_Error, message, Wpf.Ui.Common.SymbolRegular.ErrorCircle24, Wpf.Ui.Common.ControlAppearance.Danger);
}
private static string ToCRLF(string text)
@ -194,7 +194,7 @@ namespace Bloxstrap.UI.Elements.Editor
if (!_viewModel.CodeChanged)
return;
var result = Frontend.ShowMessageBox($"Save changes to {_viewModel.Name}?", MessageBoxImage.Information, MessageBoxButton.YesNoCancel);
var result = Frontend.ShowMessageBox(string.Format(Strings.CustomTheme_Editor_ConfirmSave, _viewModel.Name), MessageBoxImage.Information, MessageBoxButton.YesNoCancel);
if (result == MessageBoxResult.Cancel)
{
e.Cancel = true;