Skip to content

Commit 5a8a20c

Browse files
committed
Files.App.Services
1 parent 383d82c commit 5a8a20c

File tree

8 files changed

+33
-33
lines changed

8 files changed

+33
-33
lines changed

src/Files.App/Services/App/AppUpdateStoreService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ private static async Task<bool> ShowDialogAsync()
159159
//TODO: Use IDialogService in future.
160160
ContentDialog dialog = new()
161161
{
162-
Title = "ConsentDialogTitle".GetLocalizedResource(),
163-
Content = "ConsentDialogContent".GetLocalizedResource(),
164-
CloseButtonText = "Close".GetLocalizedResource(),
165-
PrimaryButtonText = "ConsentDialogPrimaryButtonText".GetLocalizedResource()
162+
Title = Strings.ConsentDialogTitle.GetLocalizedResource(),
163+
Content = Strings.ConsentDialogContent.GetLocalizedResource(),
164+
CloseButtonText = Strings.Close.GetLocalizedResource(),
165+
PrimaryButtonText = Strings.ConsentDialogPrimaryButtonText.GetLocalizedResource()
166166
};
167167

168168
if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))

src/Files.App/Services/DateTimeFormatter/AbstractDateTimeFormatter.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,36 @@ public ITimeSpanLabel ToTimeSpanLabel(DateTimeOffset offset, GroupByDateUnit uni
2727
return 0 switch
2828
{
2929
_ when now.Date < time.Date
30-
=> new Label("Future".GetLocalizedResource(), "\uED28", 1000000006),
30+
=> new Label(Strings.Future.GetLocalizedResource(), "\uED28", 1000000006),
3131
_ when now.Date == time.Date
32-
=> new Label("Today".GetLocalizedResource(), "\uE8D1", 1000000005),
32+
=> new Label(Strings.Today.GetLocalizedResource(), "\uE8D1", 1000000005),
3333
_ when now.AddDays(-1).Date == time.Date
34-
=> new Label("Yesterday".GetLocalizedResource(), "\uE8BF", 1000000004),
34+
=> new Label(Strings.Yesterday.GetLocalizedResource(), "\uE8BF", 1000000004),
3535

3636
// Group by day
3737
_ when unit == GroupByDateUnit.Day
3838
=> new Label(ToString(time, "D"), "\uE8BF", time.Year * 10000 + time.Month * 100 + time.Day),
3939

4040
_ when diff.Days <= 7 && GetWeekOfYear(now) == GetWeekOfYear(time)
41-
=> new Label("EarlierThisWeek".GetLocalizedResource(), "\uE8C0", 1000000003),
41+
=> new Label(Strings.EarlierThisWeek.GetLocalizedResource(), "\uE8C0", 1000000003),
4242
_ when diff.Days <= 14 && GetWeekOfYear(now.AddDays(-7)) == GetWeekOfYear(time)
43-
=> new Label("LastWeek".GetLocalizedResource(), "\uE8C0", 1000000002),
43+
=> new Label(Strings.LastWeek.GetLocalizedResource(), "\uE8C0", 1000000002),
4444
_ when now.Year == time.Year && now.Month == time.Month
45-
=> new Label("EarlierThisMonth".GetLocalizedResource(), "\uE787", 1000000001),
45+
=> new Label(Strings.EarlierThisMonth.GetLocalizedResource(), "\uE787", 1000000001),
4646
_ when now.AddMonths(-1).Year == time.Year && now.AddMonths(-1).Month == time.Month
47-
=> new Label("LastMonth".GetLocalizedResource(), "\uE787", 1000000000),
47+
=> new Label(Strings.LastMonth.GetLocalizedResource(), "\uE787", 1000000000),
4848

4949
// Group by month
5050
_ when unit == GroupByDateUnit.Month
5151
=> new Label(ToString(time, "Y"), "\uE787", time.Year * 10000 + time.Month * 100),
5252

5353
// Group by year
5454
_ when now.Year == time.Year
55-
=> new Label("EarlierThisYear".GetLocalizedResource(), "\uEC92", 10000001),
55+
=> new Label(Strings.EarlierThisYear.GetLocalizedResource(), "\uEC92", 10000001),
5656
_ when now.AddYears(-1).Year == time.Year
57-
=> new Label("LastYear".GetLocalizedResource(), "\uEC92", 10000000),
57+
=> new Label(Strings.LastYear.GetLocalizedResource(), "\uEC92", 10000000),
5858
_
59-
=> new Label(string.Format("YearN".GetLocalizedResource(), time.Year), "\uEC92", time.Year),
59+
=> new Label(string.Format(Strings.YearN.GetLocalizedResource(), time.Year), "\uEC92", time.Year),
6060
};
6161
}
6262

src/Files.App/Services/DateTimeFormatter/ApplicationDateTimeFormatter.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal sealed class ApplicationDateTimeFormatter : AbstractDateTimeFormatter
1414
/// Gets the name of the formatter.
1515
/// </summary>
1616
public override string Name
17-
=> "Application".GetLocalizedResource();
17+
=> Strings.Application.GetLocalizedResource();
1818

1919
/// <summary>
2020
/// Converts the provided <see cref="DateTimeOffset"/> to a short label.
@@ -33,15 +33,15 @@ public override string ToShortLabel(DateTimeOffset offset)
3333
return elapsed switch
3434
{
3535
{ TotalDays: >= 7 } => ToString(offset, "D"),
36-
{ TotalDays: >= 2 } => string.Format("DaysAgo_Plural".GetLocalizedResource(), elapsed.Days),
37-
{ TotalDays: >= 1 } => "DaysAgo_Singular".GetLocalizedResource(),
38-
{ TotalHours: >= 2 } => string.Format("HoursAgo_Plural".GetLocalizedResource(), elapsed.Hours),
39-
{ TotalHours: >= 1 } => "HoursAgo_Singular".GetLocalizedResource(),
40-
{ TotalMinutes: >= 2 } => string.Format("MinutesAgo_Plural".GetLocalizedResource(), elapsed.Minutes),
41-
{ TotalMinutes: >= 1 } => "MinutesAgo_Singular".GetLocalizedResource(),
42-
{ TotalSeconds: >= 2 } => string.Format("SecondsAgo_Plural".GetLocalizedResource(), elapsed.Seconds),
43-
{ TotalSeconds: >= 1 } => "SecondsAgo_Singular".GetLocalizedResource(),
44-
{ TotalSeconds: >= 0 } => "Now".GetLocalizedResource(),
36+
{ TotalDays: >= 2 } => string.Format(Strings.DaysAgo_Plural.GetLocalizedResource(), elapsed.Days),
37+
{ TotalDays: >= 1 } => Strings.DaysAgo_Singular.GetLocalizedResource(),
38+
{ TotalHours: >= 2 } => string.Format(Strings.HoursAgo_Plural.GetLocalizedResource(), elapsed.Hours),
39+
{ TotalHours: >= 1 } => Strings.HoursAgo_Singular.GetLocalizedResource(),
40+
{ TotalMinutes: >= 2 } => string.Format(Strings.MinutesAgo_Plural.GetLocalizedResource(), elapsed.Minutes),
41+
{ TotalMinutes: >= 1 } => Strings.MinutesAgo_Singular.GetLocalizedResource(),
42+
{ TotalSeconds: >= 2 } => string.Format(Strings.SecondsAgo_Plural.GetLocalizedResource(), elapsed.Seconds),
43+
{ TotalSeconds: >= 1 } => Strings.SecondsAgo_Singular.GetLocalizedResource(),
44+
{ TotalSeconds: >= 0 } => Strings.Now.GetLocalizedResource(),
4545
_ => ToString(offset, "D"),
4646
};
4747
}

src/Files.App/Services/DateTimeFormatter/SystemDateTimeFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Files.App.Services.DateTimeFormatter
99
internal sealed class SystemDateTimeFormatter : AbstractDateTimeFormatter
1010
{
1111
public override string Name
12-
=> "SystemTimeStyle".GetLocalizedResource();
12+
=> Strings.SystemTimeStyle.GetLocalizedResource();
1313

1414
public override string ToShortLabel(DateTimeOffset offset)
1515
{

src/Files.App/Services/DateTimeFormatter/UniversalDateTimeFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Files.App.Services.DateTimeFormatter
99
internal sealed class UniversalDateTimeFormatter : AbstractDateTimeFormatter
1010
{
1111
public override string Name
12-
=> "Universal".GetLocalizedResource();
12+
=> Strings.Universal.GetLocalizedResource();
1313

1414
public override string ToShortLabel(DateTimeOffset offset)
1515
{

src/Files.App/Services/Settings/FileTagsSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public TagViewModel GetTagById(string uid)
6969

7070
if (!string.IsNullOrEmpty(uid) && tag is null)
7171
{
72-
tag = new TagViewModel("Unknown".GetLocalizedResource(), "#9ea3a1", uid);
72+
tag = new TagViewModel(Strings.Unknown.GetLocalizedResource(), "#9ea3a1", uid);
7373
FileTagList = FileTagList.Append(tag).ToList();
7474
}
7575

src/Files.App/Services/Storage/StorageNetworkService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public NetworkService()
4343
var networkItem = new DriveItem()
4444
{
4545
DeviceID = "network-folder",
46-
Text = "Network".GetLocalizedResource(),
46+
Text = Strings.Network.GetLocalizedResource(),
4747
Path = Constants.UserEnvironmentPaths.NetworkFolderPath,
4848
Type = DriveType.Network,
4949
ItemType = NavigationControlItemType.Drive,
@@ -263,7 +263,7 @@ public async Task<bool> AuthenticateNetworkShare(string path)
263263
}
264264
else
265265
{
266-
await DialogDisplayHelper.ShowDialogAsync("NetworkFolderErrorDialogTitle".GetLocalizedResource(), res.ToString());
266+
await DialogDisplayHelper.ShowDialogAsync(Strings.NetworkFolderErrorDialogTitle.GetLocalizedResource(), res.ToString());
267267

268268
return false;
269269
}

src/Files.App/Services/Windows/WindowsJumpListService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private void AddFolder(string path, string group, JumpList instance)
131131
string? displayName = null;
132132

133133
if (path.StartsWith("\\\\SHELL", StringComparison.OrdinalIgnoreCase))
134-
displayName = "ThisPC".GetLocalizedResource();
134+
displayName = Strings.ThisPC.GetLocalizedResource();
135135

136136
if (path.EndsWith('\\'))
137137
{
@@ -153,11 +153,11 @@ private void AddFolder(string path, string group, JumpList instance)
153153
else if (path.Equals(Constants.UserEnvironmentPaths.DownloadsPath, StringComparison.OrdinalIgnoreCase))
154154
displayName = "ms-resource:///Resources/Downloads";
155155
else if (path.Equals(Constants.UserEnvironmentPaths.NetworkFolderPath, StringComparison.OrdinalIgnoreCase))
156-
displayName = "Network".GetLocalizedResource();
156+
displayName = Strings.Network.GetLocalizedResource();
157157
else if (path.Equals(Constants.UserEnvironmentPaths.RecycleBinPath, StringComparison.OrdinalIgnoreCase))
158-
displayName = "RecycleBin".GetLocalizedResource();
158+
displayName = Strings.RecycleBin.GetLocalizedResource();
159159
else if (path.Equals(Constants.UserEnvironmentPaths.MyComputerPath, StringComparison.OrdinalIgnoreCase))
160-
displayName = "ThisPC".GetLocalizedResource();
160+
displayName = Strings.ThisPC.GetLocalizedResource();
161161
else if (App.LibraryManager.TryGetLibrary(path, out LibraryLocationItem library))
162162
{
163163
var libName = Path.GetFileNameWithoutExtension(library.Path);

0 commit comments

Comments
 (0)