File tree Expand file tree Collapse file tree 4 files changed +40
-1
lines changed Expand file tree Collapse file tree 4 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1212 <PackageId >FmgLib.MauiMarkup</PackageId >
1313 <Summary >FmgLib.MauiMarkup with C# Markup classes and fluent helper methods</Summary >
1414 <Title >FmgLib.MauiMarkup</Title >
15- <Version >9.0.0 </Version >
15+ <Version >9.0.1 </Version >
1616 <Authors >FmgYazılım</Authors >
1717 <Company >Fmg Yazılım</Company >
1818 <Copyright >©2024</Copyright >
Original file line number Diff line number Diff line change 1+ using System . Globalization ;
2+
3+ namespace FmgLib . MauiMarkup ;
4+
5+ public static class TranslateExtension
6+ {
7+ public static string ToTranslate ( this string key )
8+ {
9+ return Translator . Instance [ key ] ;
10+ }
11+
12+ public static string ToTranslate ( this string key , string cultureName )
13+ {
14+ return Translator . Instance . TranslateString ( key , CultureInfo . GetCultureInfo ( cultureName ) ) ;
15+ }
16+
17+
18+ public static string ToTranslateResx ( this string key )
19+ {
20+ return TranslatorResx . Instance [ key ] ;
21+ }
22+
23+ public static string ToTranslateResx ( this string key , string cultureName )
24+ {
25+ return TranslatorResx . Instance . TranslateString ( key , CultureInfo . GetCultureInfo ( cultureName ) ) ;
26+ }
27+ }
Original file line number Diff line number Diff line change 11using System . ComponentModel ;
2+ using System . Globalization ;
23using FmgLib . MauiMarkup . Localization ;
34
45namespace FmgLib . MauiMarkup ;
@@ -14,5 +15,10 @@ public string this[string key]
1415 return LocalizationData . Data . GetTranslation ( key , CurrentCulture . Name ) ;
1516 }
1617 }
18+
19+ public string TranslateString ( string key , CultureInfo culture )
20+ {
21+ return LocalizationData . Data . GetTranslation ( key , culture . Name ) ;
22+ }
1723}
1824
Original file line number Diff line number Diff line change 11using System . ComponentModel ;
2+ using System . Globalization ;
23using System . Resources ;
34using FmgLib . MauiMarkup . Localization ;
45
@@ -17,4 +18,9 @@ public string this[string key]
1718 return ResourceManager . GetString ( key , CurrentCulture ) ;
1819 }
1920 }
21+
22+ public string TranslateString ( string key , CultureInfo culture )
23+ {
24+ return ResourceManager . GetString ( key , culture ) ;
25+ }
2026}
You can’t perform that action at this time.
0 commit comments