From 56e9550de41391ae42bec6341106df7f4187b545 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 5 Apr 2025 16:47:14 +0800 Subject: [PATCH 1/9] Add useful links --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index e005e9c..6bec2b8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ # Flow Launcher Localization Toolkit Localization toolkit for Flow Launcher and its plugins + +Useful links: + +* [Flow Launcher localization toolkit guide](https://www.flowlauncher.com/docs/#/localization-toolkit) +* [.Net plugin development guide](https://www.flowlauncher.com/docs/#/develop-dotnet-plugins) From 2bfccc5ea812c1ecd2032f76e93abf476aff4ed6 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 5 Apr 2025 17:28:42 +0800 Subject: [PATCH 2/9] Add localization documents --- localization-toolkit.md | 92 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 localization-toolkit.md diff --git a/localization-toolkit.md b/localization-toolkit.md new file mode 100644 index 0000000..8b52ae9 --- /dev/null +++ b/localization-toolkit.md @@ -0,0 +1,92 @@ +Localization toolkit is for Flow C# plugin developers to improve their localization experience. + +## Initialization + +For C# Plugins, we need to install and reference [Flow.Launcher.Localization](www.nuget.org/packages/Flow.Launcher.Localization) by Nuget. + +## Build properties + +### `FLLUseDependencyInjection` + +Whether to use depenedency injection to get `IPublicAPI` instance. Default by false. + +If set to `false`, the `Main` class that implements **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** or **[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)** must have a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property which must be at least `internal static`. + +If set to `true`, we can access `IPublicAPI` instance from `PublicApi.Instance` in the project by dependency injection. +And the `Main` class does not need to have a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property. +(Not recommended for plugin projects because this will make plugins only compabible with Flow 1.20.0 or higher) + +## Usage + +### Main class + +`Main` class must implement [IPluginI18n](/API-Reference/Flow.Launcher.Plugin/IPluginI18n.md). + +If `FLLUseDependencyInjection` is set to `false`, `Main` class must have a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property like: + +``` +public class Main : IPlugin, IPluginI18n // Must implement IPluginI18n +{ + internal static PluginInitContext Context { get; private set; } = null!; // At least internal static property + private static IPublicAPI API => Context.API; + + ... +} +``` + +### Localized strings + +With this toolkit, we can replace `Context.API.GetTranslation("flowlauncher_plugin_localization_demo_plugin_name")` with `Localize.flowlauncher_plugin_localization_demo_plugin_name()`. + +And we can also replace `string.Format(Context.API.GetTranslation("flowlauncher_plugin_localization_demo_plugin_used"), string.Empty, null, string.Empty)` with `Localize.flowlauncher_plugin_localization_demo_plugin_used(string.Empty, null, string.Empty)`. + +### Localized enums + +If you have enum types like `DemoEnum` that needs localization in displaying them on a combo box control. You can add `EnumLocalize` attribute to enable localiztion support. +For all fields in this `EnumType`, if you want to specific one localization key for this field, you can use `EnumLocalizeKey` attribute; or if you want to specific one constant value for this field, you can use `EnumLocalizeValue` attribute. + +``` +[EnumLocalize] // Enable localization support +public enum DemoEnum +{ + [EnumLocalizeKey("localize_key_1")] // Specific localization key + Value1, + + [EnumLocalizeValue("localize_value_2")] // Specific localization value + Value2, + + [EnumLocalizeKey("localize_key_3")] // If key and value both exist, will prefer localization key + [EnumLocalizeValue("localize_value_3")] + Value3, + + [EnumLocalizeKey(nameof(Localize.flowlauncher_plugin_localization_demo_plugin_description))] // Use Localize class + Value4, +} +``` + +Then you can get `DemoEnumData` class. + +In view model class which needs to display it on a combo box control, you can add two fields for binding `ItemSource` and `SelectedValue` like: + +``` +public List AllDemoEnums { get; } = DemoEnumData.GetValues(); // ItemSource of ComboBox + +public DemoEnum SelectedDemoEnum { get; set; } // SelectedValue of ComboBox +``` + +``` + +``` + +If you want to update localization strings when culture info changes, you can call this function to update. + +``` +private void UpdateEnumDropdownLocalizations() +{ + DemoEnumData.UpdateLabels(AllDemoEnums); +} +``` From b142344ea35a58fd1143bb581f59d1686d2e64f0 Mon Sep 17 00:00:00 2001 From: Jack Ye <1160210343@qq.com> Date: Sat, 5 Apr 2025 17:31:51 +0800 Subject: [PATCH 3/9] Update localization-toolkit.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- localization-toolkit.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/localization-toolkit.md b/localization-toolkit.md index 8b52ae9..076aa1b 100644 --- a/localization-toolkit.md +++ b/localization-toolkit.md @@ -8,8 +8,7 @@ For C# Plugins, we need to install and reference [Flow.Launcher.Localization](ww ### `FLLUseDependencyInjection` -Whether to use depenedency injection to get `IPublicAPI` instance. Default by false. - +Whether to use dependency injection to get `IPublicAPI` instance. Default by false. If set to `false`, the `Main` class that implements **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** or **[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)** must have a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property which must be at least `internal static`. If set to `true`, we can access `IPublicAPI` instance from `PublicApi.Instance` in the project by dependency injection. From bb14c8d5da52d4e8eb14c8bf7532271334810a73 Mon Sep 17 00:00:00 2001 From: Jack Ye <1160210343@qq.com> Date: Sat, 5 Apr 2025 17:31:56 +0800 Subject: [PATCH 4/9] Update localization-toolkit.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- localization-toolkit.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/localization-toolkit.md b/localization-toolkit.md index 076aa1b..86e7c67 100644 --- a/localization-toolkit.md +++ b/localization-toolkit.md @@ -13,8 +13,7 @@ If set to `false`, the `Main` class that implements **[IPlugin](/API-Reference/F If set to `true`, we can access `IPublicAPI` instance from `PublicApi.Instance` in the project by dependency injection. And the `Main` class does not need to have a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property. -(Not recommended for plugin projects because this will make plugins only compabible with Flow 1.20.0 or higher) - +(Not recommended for plugin projects because this will make plugins only compatible with Flow 1.20.0 or higher) ## Usage ### Main class From 6981a8f3526cc05788d849cb48ab96c6d96014e4 Mon Sep 17 00:00:00 2001 From: Jack Ye <1160210343@qq.com> Date: Sat, 5 Apr 2025 17:32:03 +0800 Subject: [PATCH 5/9] Update localization-toolkit.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- localization-toolkit.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localization-toolkit.md b/localization-toolkit.md index 86e7c67..ce82145 100644 --- a/localization-toolkit.md +++ b/localization-toolkit.md @@ -40,7 +40,7 @@ And we can also replace `string.Format(Context.API.GetTranslation("flowlauncher_ ### Localized enums -If you have enum types like `DemoEnum` that needs localization in displaying them on a combo box control. You can add `EnumLocalize` attribute to enable localiztion support. +If you have enum types like `DemoEnum` that needs localization in displaying them on a combo box control. You can add `EnumLocalize` attribute to enable localization support. For all fields in this `EnumType`, if you want to specific one localization key for this field, you can use `EnumLocalizeKey` attribute; or if you want to specific one constant value for this field, you can use `EnumLocalizeValue` attribute. ``` From cc4405e53f3c60053092db2782a5a75e2c4453f1 Mon Sep 17 00:00:00 2001 From: Yusyuriv Date: Sat, 5 Apr 2025 22:36:15 +0600 Subject: [PATCH 6/9] Rephrase documentation --- README.md | 4 +- localization-toolkit.md | 112 +++++++++++++++++++++++++--------------- 2 files changed, 72 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 6bec2b8..750e0fb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Flow Launcher Localization Toolkit -Localization toolkit for Flow Launcher and its plugins +Localization toolkit for Flow Launcher and its plugins. Useful links: * [Flow Launcher localization toolkit guide](https://www.flowlauncher.com/docs/#/localization-toolkit) -* [.Net plugin development guide](https://www.flowlauncher.com/docs/#/develop-dotnet-plugins) +* [.NET plugin development guide](https://www.flowlauncher.com/docs/#/develop-dotnet-plugins) diff --git a/localization-toolkit.md b/localization-toolkit.md index ce82145..609e9b9 100644 --- a/localization-toolkit.md +++ b/localization-toolkit.md @@ -1,78 +1,109 @@ -Localization toolkit is for Flow C# plugin developers to improve their localization experience. +The Localization Toolkit helps Flow Launcher C# plugin developers make the localization process easier. -## Initialization +## Getting Started -For C# Plugins, we need to install and reference [Flow.Launcher.Localization](www.nuget.org/packages/Flow.Launcher.Localization) by Nuget. +For C# plugins, install and reference [Flow.Launcher.Localization](www.nuget.org/packages/Flow.Launcher.Localization) via NuGet. -## Build properties +## Build Properties + +These are properties you can configure in your `.csproj` file to customize the localization process. You can set them in the `` section. For example, to set the `FLLUseDependencyInjection` property to `true`, add the following lines: + +```xml + + true + +``` ### `FLLUseDependencyInjection` -Whether to use dependency injection to get `IPublicAPI` instance. Default by false. -If set to `false`, the `Main` class that implements **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** or **[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)** must have a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property which must be at least `internal static`. +This flag specifies whether to use dependency injection to obtain an IPublicAPI instance. The default is `false`. +- If set to `false`, the Main class (which must implement **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** or **[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)**) + must have a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property that is at least `internal static`. +- If set to `true`, you can access the `IPublicAPI` instance via `PublicApi.Instance` using dependency injection, and the Main class does not need to include a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property. + (Note: This approach is not recommended for plugin projects at the moment since it limits compatibility to Flow Launcher 1.20.0 or later.) -If set to `true`, we can access `IPublicAPI` instance from `PublicApi.Instance` in the project by dependency injection. -And the `Main` class does not need to have a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property. -(Not recommended for plugin projects because this will make plugins only compatible with Flow 1.20.0 or higher) ## Usage -### Main class +### Main Class -`Main` class must implement [IPluginI18n](/API-Reference/Flow.Launcher.Plugin/IPluginI18n.md). +The Main class must implement [IPluginI18n](/API-Reference/Flow.Launcher.Plugin/IPluginI18n.md). -If `FLLUseDependencyInjection` is set to `false`, `Main` class must have a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property like: +If `FLLUseDependencyInjection` is `false`, include a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property, for example: -``` -public class Main : IPlugin, IPluginI18n // Must implement IPluginI18n +```csharp + // Must implement IPluginI18n +public class Main : IPlugin, IPluginI18n { - internal static PluginInitContext Context { get; private set; } = null!; // At least internal static property - private static IPublicAPI API => Context.API; - - ... + // Must be at least internal static + internal static PluginInitContext Context { get; private set; } = null!; } ``` -### Localized strings +### Localized Strings + +You can simplify your code by replacing calls like: +```csharp +Context.API.GetTranslation("flowlauncher_plugin_localization_demo_plugin_name") +``` +with: +```csharp +Localize.flowlauncher_plugin_localization_demo_plugin_name() +``` -With this toolkit, we can replace `Context.API.GetTranslation("flowlauncher_plugin_localization_demo_plugin_name")` with `Localize.flowlauncher_plugin_localization_demo_plugin_name()`. +If your localization string uses variables, it becomes even simpler! From this: +```csharp +string.Format(Context.API.GetTranslation("flowlauncher_plugin_localization_demo_value_with_keys"), firstName, lastName); +``` +To this: +```csharp +Localize.flowlauncher_plugin_localization_demo_value_with_keys(firstName, lastName); +``` -And we can also replace `string.Format(Context.API.GetTranslation("flowlauncher_plugin_localization_demo_plugin_used"), string.Empty, null, string.Empty)` with `Localize.flowlauncher_plugin_localization_demo_plugin_used(string.Empty, null, string.Empty)`. +### Localized Enums -### Localized enums +For enum types (e.g., DemoEnum) that need localization in UI controls such as combo boxes, use the `EnumLocalize` attribute to enable localization. For each enum field: +- Use `EnumLocalizeKey` to provide a custom localization key. +- Use `EnumLocalizeValue` to provide a constant localization string. -If you have enum types like `DemoEnum` that needs localization in displaying them on a combo box control. You can add `EnumLocalize` attribute to enable localization support. -For all fields in this `EnumType`, if you want to specific one localization key for this field, you can use `EnumLocalizeKey` attribute; or if you want to specific one constant value for this field, you can use `EnumLocalizeValue` attribute. +Example: -``` +```csharp [EnumLocalize] // Enable localization support public enum DemoEnum { - [EnumLocalizeKey("localize_key_1")] // Specific localization key + // Specific localization key + [EnumLocalizeKey("localize_key_1")] Value1, - [EnumLocalizeValue("localize_value_2")] // Specific localization value + // Specific localization value + [EnumLocalizeValue("This is my enum value localization")] Value2, - [EnumLocalizeKey("localize_key_3")] // If key and value both exist, will prefer localization key - [EnumLocalizeValue("localize_value_3")] + // Key takes precedence if both are present + [EnumLocalizeKey("localize_key_3")] + [EnumLocalizeValue("Localization Value")] Value3, - [EnumLocalizeKey(nameof(Localize.flowlauncher_plugin_localization_demo_plugin_description))] // Use Localize class + // Using the Localize class. This way, you can't misspell localization keys, and if you rename + // them in your .xaml file, you won't forget to rename them here as well because the build will fail. + [EnumLocalizeKey(nameof(Localize.flowlauncher_plugin_localization_demo_plugin_description))] Value4, } ``` -Then you can get `DemoEnumData` class. +Then, use the generated DemoEnumData class within your view model to bind to a combo box: -In view model class which needs to display it on a combo box control, you can add two fields for binding `ItemSource` and `SelectedValue` like: +```csharp +// ComboBox ItemSource +public List AllDemoEnums { get; } = DemoEnumData.GetValues(); +// ComboBox SelectedValue +public DemoEnum SelectedDemoEnum { get; set; } ``` -public List AllDemoEnums { get; } = DemoEnumData.GetValues(); // ItemSource of ComboBox -public DemoEnum SelectedDemoEnum { get; set; } // SelectedValue of ComboBox -``` +In your XAML, bind as follows: -``` +```xml ``` -If you want to update localization strings when culture info changes, you can call this function to update. +To update localization strings when the language changes, you can call: -``` -private void UpdateEnumDropdownLocalizations() -{ - DemoEnumData.UpdateLabels(AllDemoEnums); -} +```csharp +DemoEnumData.UpdateLabels(AllDemoEnums); ``` From e73aea4e8bf3236cc5d8e271f6648c3b35993197 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 6 Apr 2025 09:43:47 +0800 Subject: [PATCH 7/9] Improve enum class names --- Flow.Launcher.Localization.Shared/Constants.cs | 1 - .../Localize/EnumSourceGenerator.cs | 2 +- localization-toolkit.md | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher.Localization.Shared/Constants.cs b/Flow.Launcher.Localization.Shared/Constants.cs index 8932aa9..5be30a0 100644 --- a/Flow.Launcher.Localization.Shared/Constants.cs +++ b/Flow.Launcher.Localization.Shared/Constants.cs @@ -20,7 +20,6 @@ public static class Constants public const string OldLocalizationMethodName = "GetTranslation"; public const string StringFormatMethodName = "Format"; public const string StringFormatTypeName = "string"; - public const string EnumLocalizeClassSuffix = "Data"; public const string EnumLocalizeAttributeName = "EnumLocalizeAttribute"; public const string EnumLocalizeKeyAttributeName = "EnumLocalizeKeyAttribute"; public const string EnumLocalizeValueAttributeName = "EnumLocalizeValueAttribute"; diff --git a/Flow.Launcher.Localization.SourceGenerators/Localize/EnumSourceGenerator.cs b/Flow.Launcher.Localization.SourceGenerators/Localize/EnumSourceGenerator.cs index 76a218f..503134c 100644 --- a/Flow.Launcher.Localization.SourceGenerators/Localize/EnumSourceGenerator.cs +++ b/Flow.Launcher.Localization.SourceGenerators/Localize/EnumSourceGenerator.cs @@ -174,7 +174,7 @@ private void GenerateSource( var enumFullName = enumSymbol.ToDisplayString(new SymbolDisplayFormat( globalNamespaceStyle: SymbolDisplayGlobalNamespaceStyle.Omitted, // Remove global:: symbol typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces)); - var enumDataClassName = $"{enumSymbol.Name}{Constants.EnumLocalizeClassSuffix}"; + var enumDataClassName = $"{enumSymbol.Name}{Constants.ClassName}"; var enumName = enumSymbol.Name; var enumNamespace = enumSymbol.ContainingNamespace.ToDisplayString(); var tabString = Helper.Spacing(1); diff --git a/localization-toolkit.md b/localization-toolkit.md index 609e9b9..f59c16a 100644 --- a/localization-toolkit.md +++ b/localization-toolkit.md @@ -91,11 +91,11 @@ public enum DemoEnum } ``` -Then, use the generated DemoEnumData class within your view model to bind to a combo box: +Then, use the generated `DemoEnumLocalize` class within your view model to bind to a combo box control: ```csharp // ComboBox ItemSource -public List AllDemoEnums { get; } = DemoEnumData.GetValues(); +public List AllDemoEnums { get; } = DemoEnumLocalize.GetValues(); // ComboBox SelectedValue public DemoEnum SelectedDemoEnum { get; set; } @@ -114,5 +114,5 @@ In your XAML, bind as follows: To update localization strings when the language changes, you can call: ```csharp -DemoEnumData.UpdateLabels(AllDemoEnums); +DemoEnumLocalize.UpdateLabels(AllDemoEnums); ``` From d99720157ded9483ec4282d8b08baa43d8273964 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 6 Apr 2025 10:02:48 +0800 Subject: [PATCH 8/9] Improve code strings --- localization-toolkit.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/localization-toolkit.md b/localization-toolkit.md index f59c16a..be3fc6c 100644 --- a/localization-toolkit.md +++ b/localization-toolkit.md @@ -16,7 +16,7 @@ These are properties you can configure in your `.csproj` file to customize the l ### `FLLUseDependencyInjection` -This flag specifies whether to use dependency injection to obtain an IPublicAPI instance. The default is `false`. +This flag specifies whether to use dependency injection to obtain an `IPublicAPI` instance. The default is `false`. - If set to `false`, the Main class (which must implement **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** or **[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)**) must have a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property that is at least `internal static`. - If set to `true`, you can access the `IPublicAPI` instance via `PublicApi.Instance` using dependency injection, and the Main class does not need to include a [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) property. @@ -61,7 +61,7 @@ Localize.flowlauncher_plugin_localization_demo_value_with_keys(firstName, lastNa ### Localized Enums -For enum types (e.g., DemoEnum) that need localization in UI controls such as combo boxes, use the `EnumLocalize` attribute to enable localization. For each enum field: +For enum types (e.g., `DemoEnum`) that need localization in UI controls such as combo boxes, use the `EnumLocalize` attribute to enable localization. For each enum field: - Use `EnumLocalizeKey` to provide a custom localization key. - Use `EnumLocalizeValue` to provide a constant localization string. From 231ca93242de56eafa505c53df02225da4d80c44 Mon Sep 17 00:00:00 2001 From: Yusyuriv Date: Sun, 6 Apr 2025 09:20:10 +0600 Subject: [PATCH 9/9] Correct generated enum data class name --- Flow.Launcher.Localization.Shared/Constants.cs | 1 + .../Localize/EnumSourceGenerator.cs | 2 +- localization-toolkit.md | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher.Localization.Shared/Constants.cs b/Flow.Launcher.Localization.Shared/Constants.cs index 5be30a0..3b3fe06 100644 --- a/Flow.Launcher.Localization.Shared/Constants.cs +++ b/Flow.Launcher.Localization.Shared/Constants.cs @@ -20,6 +20,7 @@ public static class Constants public const string OldLocalizationMethodName = "GetTranslation"; public const string StringFormatMethodName = "Format"; public const string StringFormatTypeName = "string"; + public const string EnumLocalizeClassSuffix = "Localized"; public const string EnumLocalizeAttributeName = "EnumLocalizeAttribute"; public const string EnumLocalizeKeyAttributeName = "EnumLocalizeKeyAttribute"; public const string EnumLocalizeValueAttributeName = "EnumLocalizeValueAttribute"; diff --git a/Flow.Launcher.Localization.SourceGenerators/Localize/EnumSourceGenerator.cs b/Flow.Launcher.Localization.SourceGenerators/Localize/EnumSourceGenerator.cs index 503134c..76a218f 100644 --- a/Flow.Launcher.Localization.SourceGenerators/Localize/EnumSourceGenerator.cs +++ b/Flow.Launcher.Localization.SourceGenerators/Localize/EnumSourceGenerator.cs @@ -174,7 +174,7 @@ private void GenerateSource( var enumFullName = enumSymbol.ToDisplayString(new SymbolDisplayFormat( globalNamespaceStyle: SymbolDisplayGlobalNamespaceStyle.Omitted, // Remove global:: symbol typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces)); - var enumDataClassName = $"{enumSymbol.Name}{Constants.ClassName}"; + var enumDataClassName = $"{enumSymbol.Name}{Constants.EnumLocalizeClassSuffix}"; var enumName = enumSymbol.Name; var enumNamespace = enumSymbol.ContainingNamespace.ToDisplayString(); var tabString = Helper.Spacing(1); diff --git a/localization-toolkit.md b/localization-toolkit.md index be3fc6c..247ac58 100644 --- a/localization-toolkit.md +++ b/localization-toolkit.md @@ -91,11 +91,11 @@ public enum DemoEnum } ``` -Then, use the generated `DemoEnumLocalize` class within your view model to bind to a combo box control: +Then, use the generated `DemoEnumLocalized` class within your view model to bind to a combo box control: ```csharp // ComboBox ItemSource -public List AllDemoEnums { get; } = DemoEnumLocalize.GetValues(); +public List AllDemoEnums { get; } = DemoEnumLocalized.GetValues(); // ComboBox SelectedValue public DemoEnum SelectedDemoEnum { get; set; }