XAML String Extraction for i18n
Step 1: Add Resource Namespace
If not already present, add to the root element:
xmlns:loc="clr-namespace:DaxStudio.UI.Resources"
Step 2: Identify Extractable Strings
Scan ALL attributes for hardcoded English text. Target attributes include:
Content, Text, Header, Title, ToolTip
Watermark, Label, Description
ScreenTipTitle, ScreenTipText (Fluent.Ribbon)
GroupName (when user-visible)
NullValueText, EmptyText, PlaceholderText
Step 3: Generate Resource Key
Follow this naming convention:
| View Context |
Pattern |
Example |
| RibbonView |
Ribbon_{Purpose} |
Ribbon_RunQuery |
| RibbonView tooltip |
Ribbon_{Purpose}_Tooltip |
Ribbon_RunQuery_Tooltip |
| Dialog |
{Dialog}_{Purpose} |
ConnectionDialog_ServerLabel |
| Tool pane |
{Pane}_{Purpose} |
MetadataPane_SearchWatermark |
| Column header |
Column_{Name} |
Column_Duration |
| Tab header |
Tab_{Name} |
Tab_QueryResults |
Step 4: Replace String
<!-- BEFORE -->
<Button Content="Run Query" ToolTip="Execute the current DAX query (F5)"/>
<!-- AFTER -->
<Button Content="{x:Static loc:Strings.Ribbon_RunQuery}"
ToolTip="{x:Static loc:Strings.Ribbon_RunQuery_Tooltip}"/>
Step 5: Record Resx Entries
For each extraction, record the key and English value to add to src\DaxStudio.UI\Resources\Strings.resx:
Ribbon_RunQuery = Run Query
Ribbon_RunQuery_Tooltip = Execute the current DAX query (F5)
Exclusion Rules
Do NOT extract:
- Binding expressions:
{Binding ...}, {StaticResource ...}, {DynamicResource ...}
- DAX keywords: EVALUATE, CALCULATE, SUMMARIZE, MEASURE, VAR, RETURN
- Technical terms: VertiPaq, Storage Engine, Formula Engine, DirectQuery, xmSQL
- Product names: DAX Studio, Power BI, Analysis Services, Excel, Power Pivot
- Empty strings, whitespace, or numeric-only values
- Icon characters (single glyphs used as icons)
- Keyboard shortcuts: Ctrl+C, F5, Ctrl+Shift+Enter
Fluent:KeyTip.Keys values (keyboard accelerators)
- Converter parameters that are not user-visible
- Design-time data (
d:DesignData, d:DataContext)
1---2name: xaml-string-extraction3description: 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.4---56# XAML String Extraction for i18n78## Step 1: Add Resource Namespace910If not already present, add to the root element:11```xml12xmlns:loc="clr-namespace:DaxStudio.UI.Resources"13```1415## Step 2: Identify Extractable Strings1617Scan ALL attributes for hardcoded English text. Target attributes include:18- `Content`, `Text`, `Header`, `Title`, `ToolTip`19- `Watermark`, `Label`, `Description`20- `ScreenTipTitle`, `ScreenTipText` (Fluent.Ribbon)21- `GroupName` (when user-visible)22- `NullValueText`, `EmptyText`, `PlaceholderText`2324## Step 3: Generate Resource Key2526Follow this naming convention:2728| View Context | Pattern | Example |29|-------------|---------|---------|30| RibbonView | `Ribbon_{Purpose}` | `Ribbon_RunQuery` |31| RibbonView tooltip | `Ribbon_{Purpose}_Tooltip` | `Ribbon_RunQuery_Tooltip` |32| Dialog | `{Dialog}_{Purpose}` | `ConnectionDialog_ServerLabel` |33| Tool pane | `{Pane}_{Purpose}` | `MetadataPane_SearchWatermark` |34| Column header | `Column_{Name}` | `Column_Duration` |35| Tab header | `Tab_{Name}` | `Tab_QueryResults` |3637## Step 4: Replace String3839```xml40<!-- BEFORE -->41<Button Content="Run Query" ToolTip="Execute the current DAX query (F5)"/>4243<!-- AFTER -->44<Button Content="{x:Static loc:Strings.Ribbon_RunQuery}"45 ToolTip="{x:Static loc:Strings.Ribbon_RunQuery_Tooltip}"/>46```4748## Step 5: Record Resx Entries4950For each extraction, record the key and English value to add to `src\DaxStudio.UI\Resources\Strings.resx`:51```52Ribbon_RunQuery = Run Query53Ribbon_RunQuery_Tooltip = Execute the current DAX query (F5)54```5556## Exclusion Rules5758Do NOT extract:59- Binding expressions: `{Binding ...}`, `{StaticResource ...}`, `{DynamicResource ...}`60- DAX keywords: EVALUATE, CALCULATE, SUMMARIZE, MEASURE, VAR, RETURN61- Technical terms: VertiPaq, Storage Engine, Formula Engine, DirectQuery, xmSQL62- Product names: DAX Studio, Power BI, Analysis Services, Excel, Power Pivot63- Empty strings, whitespace, or numeric-only values64- Icon characters (single glyphs used as icons)65- Keyboard shortcuts: Ctrl+C, F5, Ctrl+Shift+Enter66- `Fluent:KeyTip.Keys` values (keyboard accelerators)67- Converter parameters that are not user-visible68- Design-time data (`d:DesignData`, `d:DataContext`)