small bug fixes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Globalization;
|
||||
using cfs_tracker.Services;
|
||||
|
||||
namespace cfs_tracker.Helpers;
|
||||
|
||||
@@ -14,14 +15,14 @@ public static class DateHelper
|
||||
}
|
||||
|
||||
public static string ToGermanDateText(DateTime date) =>
|
||||
date.ToString("dddd, dd. MMMM yyyy", GermanCulture);
|
||||
date.ToString(LocalizationService.Translate("Date_LongDateFormat"), LocalizationService.GetCurrentCulture());
|
||||
|
||||
public static string ToGermanShortDay(DateTime date) =>
|
||||
date.ToString("ddd dd.MM.", GermanCulture);
|
||||
date.ToString(LocalizationService.Translate("Date_ShortDayFormat"), LocalizationService.GetCurrentCulture());
|
||||
|
||||
public static string ToGermanMonthYear(DateTime date) =>
|
||||
date.ToString("MMMM yyyy", GermanCulture);
|
||||
date.ToString(LocalizationService.Translate("Date_MonthYearFormat"), LocalizationService.GetCurrentCulture());
|
||||
|
||||
public static string ToGermanYear(DateTime date) =>
|
||||
date.ToString("yyyy", GermanCulture);
|
||||
date.ToString(LocalizationService.Translate("Date_YearFormat"), LocalizationService.GetCurrentCulture());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using cfs_tracker.Services;
|
||||
using Microsoft.Maui.Controls.Xaml;
|
||||
|
||||
namespace cfs_tracker.Helpers;
|
||||
|
||||
[ContentProperty(nameof(Key))]
|
||||
[AcceptEmptyServiceProvider]
|
||||
public sealed class TranslateExtension : IMarkupExtension<string>
|
||||
{
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
public string ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
return LocalizationService.Translate(Key);
|
||||
}
|
||||
|
||||
object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
return ProvideValue(serviceProvider);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user