Skip to content

Commit b38e8f2

Browse files
authored
Fix MudTextM3 Localization Issues (#245)
1 parent 483f982 commit b38e8f2

File tree

5 files changed

+61
-51
lines changed

5 files changed

+61
-51
lines changed

CodeBeam.MudBlazor.Extensions/Components/TypographyM3/MudTextM3.razor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.AspNetCore.Components;
22
using MudBlazor;
3+
using MudBlazor.Extensions;
34
using MudBlazor.Utilities;
45
using MudExtensions.Enums;
56

@@ -9,7 +10,7 @@ namespace MudExtensions
910
public partial class MudTextM3 : MudComponentBase
1011
{
1112
protected string ClassName => new CssBuilder("mud-typographym3")
12-
.AddClass($"mud-typographym3-{Typo.ToString().ToLower()}-{Size.ToString().ToLower()}") // .mud-typographym3-#{$style}-#{$size}
13+
.AddClass($"mud-typographym3-{Typo.ToDescriptionString()}-{Size.ToDescriptionString()}") // .mud-typographym3-#{$style}-#{$size}
1314
.AddClass(Class)
1415
.Build();
1516

CodeBeam.MudBlazor.Extensions/Components/TypographyProvider/MudTypographyProvider.razor

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,97 +10,97 @@
1010
<style>
1111
:root {
1212
@($"--mud-typographym3-display-large-font : {string.Join(',', TypographyM3.DisplayLarge.Font)};")
13-
@($"--mud-typographym3-display-large-line-height : {TypographyM3.DisplayLarge.LineHeight}rem;")
14-
@($"--mud-typographym3-display-large-size : {TypographyM3.DisplayLarge.Size}rem;")
15-
@($"--mud-typographym3-display-large-tracking : {TypographyM3.DisplayLarge.Tracking}rem;")
13+
@($"--mud-typographym3-display-large-line-height : {TypographyM3.DisplayLarge.LineHeight.ToInvariantString()}rem;")
14+
@($"--mud-typographym3-display-large-size : {TypographyM3.DisplayLarge.Size.ToInvariantString()}rem;")
15+
@($"--mud-typographym3-display-large-tracking : {TypographyM3.DisplayLarge.Tracking.ToInvariantString()}rem;")
1616
@($"--mud-typographym3-display-large-weight : {TypographyM3.DisplayLarge.Weight};")
1717
1818
@($"--mud-typographym3-display-medium-font : {string.Join(',', TypographyM3.DisplayMedium.Font)};")
19-
@($"--mud-typographym3-display-medium-line-height : {TypographyM3.DisplayMedium.LineHeight}rem;")
20-
@($"--mud-typographym3-display-medium-size : {TypographyM3.DisplayMedium.Size}rem;")
21-
@($"--mud-typographym3-display-medium-tracking : {TypographyM3.DisplayMedium.Tracking}rem;")
19+
@($"--mud-typographym3-display-medium-line-height : {TypographyM3.DisplayMedium.LineHeight.ToInvariantString()}rem;")
20+
@($"--mud-typographym3-display-medium-size : {TypographyM3.DisplayMedium.Size.ToInvariantString()}rem;")
21+
@($"--mud-typographym3-display-medium-tracking : {TypographyM3.DisplayMedium.Tracking.ToInvariantString()}rem;")
2222
@($"--mud-typographym3-display-medium-weight : {TypographyM3.DisplayMedium.Weight};")
2323
2424
@($"--mud-typographym3-display-small-font : {string.Join(',', TypographyM3.DisplaySmall.Font)};")
25-
@($"--mud-typographym3-display-small-line-height : {TypographyM3.DisplaySmall.LineHeight}rem;")
26-
@($"--mud-typographym3-display-small-size : {TypographyM3.DisplaySmall.Size}rem;")
27-
@($"--mud-typographym3-display-small-tracking : {TypographyM3.DisplaySmall.Tracking}rem;")
25+
@($"--mud-typographym3-display-small-line-height : {TypographyM3.DisplaySmall.LineHeight.ToInvariantString()}rem;")
26+
@($"--mud-typographym3-display-small-size : {TypographyM3.DisplaySmall.Size.ToInvariantString()}rem;")
27+
@($"--mud-typographym3-display-small-tracking : {TypographyM3.DisplaySmall.Tracking.ToInvariantString()}rem;")
2828
@($"--mud-typographym3-display-small-weight : {TypographyM3.DisplaySmall.Weight};")
2929
3030
3131
@($"--mud-typographym3-headline-large-font : {string.Join(',', TypographyM3.HeadlineLarge.Font)};")
32-
@($"--mud-typographym3-headline-large-line-height : {TypographyM3.HeadlineLarge.LineHeight}rem;")
33-
@($"--mud-typographym3-headline-large-size : {TypographyM3.HeadlineLarge.Size}rem;")
34-
@($"--mud-typographym3-headline-large-tracking : {TypographyM3.HeadlineLarge.Tracking}rem;")
32+
@($"--mud-typographym3-headline-large-line-height : {TypographyM3.HeadlineLarge.LineHeight.ToInvariantString()}rem;")
33+
@($"--mud-typographym3-headline-large-size : {TypographyM3.HeadlineLarge.Size.ToInvariantString()}rem;")
34+
@($"--mud-typographym3-headline-large-tracking : {TypographyM3.HeadlineLarge.Tracking.ToInvariantString()}rem;")
3535
@($"--mud-typographym3-headline-large-weight : {TypographyM3.HeadlineLarge.Weight};")
3636
3737
@($"--mud-typographym3-headline-medium-font : {string.Join(',', TypographyM3.HeadlineMedium.Font)};")
38-
@($"--mud-typographym3-headline-medium-line-height : {TypographyM3.HeadlineMedium.LineHeight}rem;")
39-
@($"--mud-typographym3-headline-medium-size : {TypographyM3.HeadlineMedium.Size}rem;")
40-
@($"--mud-typographym3-headline-medium-tracking : {TypographyM3.HeadlineMedium.Tracking}rem;")
38+
@($"--mud-typographym3-headline-medium-line-height : {TypographyM3.HeadlineMedium.LineHeight.ToInvariantString()}rem;")
39+
@($"--mud-typographym3-headline-medium-size : {TypographyM3.HeadlineMedium.Size.ToInvariantString()}rem;")
40+
@($"--mud-typographym3-headline-medium-tracking : {TypographyM3.HeadlineMedium.Tracking.ToInvariantString()}rem;")
4141
@($"--mud-typographym3-headline-medium-weight : {TypographyM3.HeadlineMedium.Weight};")
4242
4343
@($"--mud-typographym3-headline-small-font : {string.Join(',', TypographyM3.HeadlineSmall.Font)};")
44-
@($"--mud-typographym3-headline-small-line-height : {TypographyM3.HeadlineSmall.LineHeight}rem;")
45-
@($"--mud-typographym3-headline-small-size : {TypographyM3.HeadlineSmall.Size}rem;")
46-
@($"--mud-typographym3-headline-small-tracking : {TypographyM3.HeadlineSmall.Tracking}rem;")
44+
@($"--mud-typographym3-headline-small-line-height : {TypographyM3.HeadlineSmall.LineHeight.ToInvariantString()}rem;")
45+
@($"--mud-typographym3-headline-small-size : {TypographyM3.HeadlineSmall.Size.ToInvariantString()}rem;")
46+
@($"--mud-typographym3-headline-small-tracking : {TypographyM3.HeadlineSmall.Tracking.ToInvariantString()}rem;")
4747
@($"--mud-typographym3-headline-small-weight : {TypographyM3.HeadlineSmall.Weight};")
4848
4949
5050
@($"--mud-typographym3-title-large-font : {string.Join(',', TypographyM3.TitleLarge.Font)};")
51-
@($"--mud-typographym3-title-large-line-height : {TypographyM3.TitleLarge.LineHeight}rem;")
52-
@($"--mud-typographym3-title-large-size : {TypographyM3.TitleLarge.Size}rem;")
53-
@($"--mud-typographym3-title-large-tracking : {TypographyM3.TitleLarge.Tracking}rem;")
51+
@($"--mud-typographym3-title-large-line-height : {TypographyM3.TitleLarge.LineHeight.ToInvariantString()}rem;")
52+
@($"--mud-typographym3-title-large-size : {TypographyM3.TitleLarge.Size.ToInvariantString()}rem;")
53+
@($"--mud-typographym3-title-large-tracking : {TypographyM3.TitleLarge.Tracking.ToInvariantString()}rem;")
5454
@($"--mud-typographym3-title-large-weight : {TypographyM3.TitleLarge.Weight};")
5555
5656
@($"--mud-typographym3-title-medium-font : {string.Join(',', TypographyM3.TitleMedium.Font)};")
57-
@($"--mud-typographym3-title-medium-line-height : {TypographyM3.TitleMedium.LineHeight}rem;")
58-
@($"--mud-typographym3-title-medium-size : {TypographyM3.TitleMedium.Size}rem;")
59-
@($"--mud-typographym3-title-medium-tracking : {TypographyM3.TitleMedium.Tracking}rem;")
57+
@($"--mud-typographym3-title-medium-line-height : {TypographyM3.TitleMedium.LineHeight.ToInvariantString()}rem;")
58+
@($"--mud-typographym3-title-medium-size : {TypographyM3.TitleMedium.Size.ToInvariantString()}rem;")
59+
@($"--mud-typographym3-title-medium-tracking : {TypographyM3.TitleMedium.Tracking.ToInvariantString()}rem;")
6060
@($"--mud-typographym3-title-medium-weight : {TypographyM3.TitleMedium.Weight};")
6161
6262
@($"--mud-typographym3-title-small-font : {string.Join(',', TypographyM3.TitleSmall.Font)};")
63-
@($"--mud-typographym3-title-small-line-height : {TypographyM3.TitleSmall.LineHeight}rem;")
64-
@($"--mud-typographym3-title-small-size : {TypographyM3.TitleSmall.Size}rem;")
65-
@($"--mud-typographym3-title-small-tracking : {TypographyM3.TitleSmall.Tracking}rem;")
63+
@($"--mud-typographym3-title-small-line-height : {TypographyM3.TitleSmall.LineHeight.ToInvariantString()}rem;")
64+
@($"--mud-typographym3-title-small-size : {TypographyM3.TitleSmall.Size.ToInvariantString()}rem;")
65+
@($"--mud-typographym3-title-small-tracking : {TypographyM3.TitleSmall.Tracking.ToInvariantString()}rem;")
6666
@($"--mud-typographym3-title-small-weight : {TypographyM3.TitleSmall.Weight};")
6767
6868
6969
@($"--mud-typographym3-label-large-font : {string.Join(',', TypographyM3.LabelLarge.Font)};")
70-
@($"--mud-typographym3-label-large-line-height : {TypographyM3.LabelLarge.LineHeight}rem;")
71-
@($"--mud-typographym3-label-large-size : {TypographyM3.LabelLarge.Size}rem;")
72-
@($"--mud-typographym3-label-large-tracking : {TypographyM3.LabelLarge.Tracking}rem;")
70+
@($"--mud-typographym3-label-large-line-height : {TypographyM3.LabelLarge.LineHeight.ToInvariantString()}rem;")
71+
@($"--mud-typographym3-label-large-size : {TypographyM3.LabelLarge.Size.ToInvariantString()}rem;")
72+
@($"--mud-typographym3-label-large-tracking : {TypographyM3.LabelLarge.Tracking.ToInvariantString()}rem;")
7373
@($"--mud-typographym3-label-large-weight : {TypographyM3.LabelLarge.Weight};")
7474
7575
@($"--mud-typographym3-label-medium-font : {string.Join(',', TypographyM3.LabelMedium.Font)};")
76-
@($"--mud-typographym3-label-medium-line-height : {TypographyM3.LabelMedium.LineHeight}rem;")
77-
@($"--mud-typographym3-label-medium-size : {TypographyM3.LabelMedium.Size}rem;")
78-
@($"--mud-typographym3-label-medium-tracking : {TypographyM3.LabelMedium.Tracking}rem;")
76+
@($"--mud-typographym3-label-medium-line-height : {TypographyM3.LabelMedium.LineHeight.ToInvariantString()}rem;")
77+
@($"--mud-typographym3-label-medium-size : {TypographyM3.LabelMedium.Size.ToInvariantString()}rem;")
78+
@($"--mud-typographym3-label-medium-tracking : {TypographyM3.LabelMedium.Tracking.ToInvariantString()}rem;")
7979
@($"--mud-typographym3-label-medium-weight : {TypographyM3.LabelMedium.Weight};")
8080
8181
@($"--mud-typographym3-label-small-font : {string.Join(',', TypographyM3.LabelSmall.Font)};")
82-
@($"--mud-typographym3-label-small-line-height : {TypographyM3.LabelSmall.LineHeight}rem;")
83-
@($"--mud-typographym3-label-small-size : {TypographyM3.LabelSmall.Size}rem;")
84-
@($"--mud-typographym3-label-small-tracking : {TypographyM3.LabelSmall.Tracking}rem;")
82+
@($"--mud-typographym3-label-small-line-height : {TypographyM3.LabelSmall.LineHeight.ToInvariantString()}rem;")
83+
@($"--mud-typographym3-label-small-size : {TypographyM3.LabelSmall.Size.ToInvariantString()}rem;")
84+
@($"--mud-typographym3-label-small-tracking : {TypographyM3.LabelSmall.Tracking.ToInvariantString()}rem;")
8585
@($"--mud-typographym3-label-small-weight : {TypographyM3.LabelSmall.Weight};")
8686
8787
8888
@($"--mud-typographym3-body-large-font : {string.Join(',', TypographyM3.BodyLarge.Font)};")
89-
@($"--mud-typographym3-body-large-line-height : {TypographyM3.BodyLarge.LineHeight}rem;")
90-
@($"--mud-typographym3-body-large-size : {TypographyM3.BodyLarge.Size}rem;")
91-
@($"--mud-typographym3-body-large-tracking : {TypographyM3.BodyLarge.Tracking}rem;")
89+
@($"--mud-typographym3-body-large-line-height : {TypographyM3.BodyLarge.LineHeight.ToInvariantString()}rem;")
90+
@($"--mud-typographym3-body-large-size : {TypographyM3.BodyLarge.Size.ToInvariantString()}rem;")
91+
@($"--mud-typographym3-body-large-tracking : {TypographyM3.BodyLarge.Tracking.ToInvariantString()}rem;")
9292
@($"--mud-typographym3-body-large-weight : {TypographyM3.BodyLarge.Weight};")
9393
9494
@($"--mud-typographym3-body-medium-font : {string.Join(',', TypographyM3.BodyMedium.Font)};")
95-
@($"--mud-typographym3-body-medium-line-height : {TypographyM3.BodyMedium.LineHeight}rem;")
96-
@($"--mud-typographym3-body-medium-size : {TypographyM3.BodyMedium.Size}rem;")
97-
@($"--mud-typographym3-body-medium-tracking : {TypographyM3.BodyMedium.Tracking}rem;")
95+
@($"--mud-typographym3-body-medium-line-height : {TypographyM3.BodyMedium.LineHeight.ToInvariantString()}rem;")
96+
@($"--mud-typographym3-body-medium-size : {TypographyM3.BodyMedium.Size.ToInvariantString()}rem;")
97+
@($"--mud-typographym3-body-medium-tracking : {TypographyM3.BodyMedium.Tracking.ToInvariantString()}rem;")
9898
@($"--mud-typographym3-body-medium-weight : {TypographyM3.BodyMedium.Weight};")
9999
100100
@($"--mud-typographym3-body-small-font : {string.Join(',', TypographyM3.BodySmall.Font)};")
101-
@($"--mud-typographym3-body-small-line-height : {TypographyM3.BodySmall.LineHeight}rem;")
102-
@($"--mud-typographym3-body-small-size : {TypographyM3.BodySmall.Size}rem;")
103-
@($"--mud-typographym3-body-small-tracking : {TypographyM3.BodySmall.Tracking}rem;")
101+
@($"--mud-typographym3-body-small-line-height : {TypographyM3.BodySmall.LineHeight.ToInvariantString()}rem;")
102+
@($"--mud-typographym3-body-small-size : {TypographyM3.BodySmall.Size.ToInvariantString()}rem;")
103+
@($"--mud-typographym3-body-small-tracking : {TypographyM3.BodySmall.Tracking.ToInvariantString()}rem;")
104104
@($"--mud-typographym3-body-small-weight : {TypographyM3.BodySmall.Weight};")
105105
}
106106

CodeBeam.MudBlazor.Extensions/Enums/TypoM3.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ namespace MudExtensions.Enums
44
{
55
public enum TypoM3
66
{
7-
[Description("Display")]
7+
[Description("display")]
88
Display,
9-
[Description("Headline")]
9+
[Description("headline")]
1010
Headline,
11-
[Description("Title")]
11+
[Description("title")]
1212
Title,
13-
[Description("Body")]
13+
[Description("body")]
1414
Body,
15-
[Description("Label")]
15+
[Description("label")]
1616
Label
1717
}
1818
}

ComponentViewer.Docs/Pages/Components/TextM3Page.razor

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
@using MudExtensions.Components.TypographyM3;
44

55
<ExamplePage Title="MudTypographyM3">
6+
<ExampleCard ExampleName="TextM3ExampleIntro" Title="Intro & Tips" Description="" ShowCodeSection="false">
7+
<TextM3ExampleIntro />
8+
</ExampleCard>
69
<ExampleCard ExampleName="TypographyM3Example1" Title="Usage" Description="Material 3 typography design">
710
<TypographyM3Example1 />
811
</ExampleCard>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@using Microsoft.AspNetCore.Components
2+
@using MudBlazor.Extensions
3+
4+
<MudGrid>
5+
<MudAlert Class="mud-width-full" Severity="Severity.Info"><b>For MudTextM3 to work, you have to add <CodeBlock>MudTypographyProvider</CodeBlock> in the page, layout or app.razor</b></MudAlert>
6+
</MudGrid>

0 commit comments

Comments
 (0)