ワンクリックで
localized-attribute-migration
// Procedure for migrating DAX Studio OptionsViewModel attributes ([DisplayName], [Description], [Category], [Subcategory]) to their localized equivalents. Use when localizing the Options UI.
// Procedure for migrating DAX Studio OptionsViewModel attributes ([DisplayName], [Description], [Category], [Subcategory]) to their localized equivalents. Use when localizing the Options UI.
| name | localized-attribute-migration |
| description | Procedure for migrating DAX Studio OptionsViewModel attributes ([DisplayName], [Description], [Category], [Subcategory]) to their localized equivalents. Use when localizing the Options UI. |
DAX Studio's Options UI is built by PropertyList.cs which reads attributes via reflection:
DisplayNameAttribute → option labelDescriptionAttribute → help text below optionCategoryAttribute → tab groupingSubcategoryAttribute → sub-grouping within tabThese standard attributes require compile-time constant strings. To localize them, we use custom subclasses that accept a resource key and override the virtual property to return a localized value at runtime.
Located in DaxStudio.Common:
LocalizedDisplayNameAttribute extends DisplayNameAttributeLocalizedDescriptionAttribute extends DescriptionAttributeLocalizedCategoryAttribute extends CategoryAttributeLocalizedSubcategoryAttribute extends SubcategoryAttributeFor each property in OptionsViewModel.cs:
// BEFORE
[Category("Editor")]
[DisplayName("Editor Font Size")]
[Description("The font size used for the DAX editor")]
[Subcategory("Formatting")]
[SortOrder(20)]
[MinValue(6), MaxValue(120)]
[DataMember, DefaultValue(11d)]
public double EditorFontSize { get; set; }
// AFTER
[LocalizedCategory("Category_Editor")]
[LocalizedDisplayName("Options_EditorFontSize_DisplayName")]
[LocalizedDescription("Options_EditorFontSize_Description")]
[LocalizedSubcategory("Options_Formatting_Subcategory")]
[SortOrder(20)]
[MinValue(6), MaxValue(120)]
[DataMember, DefaultValue(11d)]
public double EditorFontSize { get; set; }
| Attribute | Pattern | Example |
|---|---|---|
| Category | Category_{Name} | Category_Editor |
| DisplayName | Options_{PropertyName}_DisplayName | Options_EditorFontSize_DisplayName |
| Description | Options_{PropertyName}_Description | Options_EditorFontSize_Description |
| Subcategory | Options_{Name}_Subcategory | Options_Formatting_Subcategory |
Add each key-value pair to src\DaxStudio.UI\Resources\Strings.resx with the original English text as the value.
These are the existing category values to create resource keys for:
[SortOrder], [MinValue], [MaxValue], [DataMember], [DefaultValue] — these are not user-visible text.[EnumDisplay] or [EnvironmentVariableAttribute] — these control behavior, not display text.[DisplayName] attribute are intentionally hidden from the UI — do not add one.PropertyList.cs should require ZERO changes — the localized attributes extend the standard ones, so GetCustomAttribute(typeof(DisplayNameAttribute)) still finds them.Build DAX Studio and run tests. Use when you need to verify changes compile correctly and all tests pass.
Step-by-step procedure for extracting hardcoded English strings from DAX Studio C# files and replacing them with resource references. Use when localizing ViewModels, services, or other C# code.
Procedure for generating translations for DAX Studio resource files. Use when creating or updating translations for target languages (es, fr, de, zh-Hans, ja).
Procedure for localizing Spectre.Console.Cli command and option descriptions in DaxStudio.CommandLine. Use when internationalizing the dscmd command-line tool.
Step-by-step procedure for extracting hardcoded English strings from a DAX Studio XAML view file and replacing them with {x:Static} resource references. Use when localizing or internationalizing XAML files.