Skip to content

Commit e993f5e

Browse files
authored
Code Quality: Improved display of singular and plural strings (#17036)
1 parent c489032 commit e993f5e

30 files changed

+63
-71
lines changed

src/Files.App/Actions/Content/Archives/Compress/CompressIntoArchiveAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public override string Label
1313
=> Strings.CreateArchive.GetLocalizedResource();
1414

1515
public override string Description
16-
=> Strings.CompressIntoArchiveDescription.GetLocalizedResource();
16+
=> Strings.CompressIntoArchiveDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1717

1818
public CompressIntoArchiveAction()
1919
{

src/Files.App/Actions/Content/Archives/Compress/CompressIntoSevenZipAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public override string Label
99
=> string.Format(Strings.CreateNamedArchive.GetLocalizedResource(), $"{StorageArchiveService.GenerateArchiveNameFromItems(context.SelectedItems)}.7z");
1010

1111
public override string Description
12-
=> Strings.CompressIntoSevenZipDescription.GetLocalizedResource();
12+
=> Strings.CompressIntoSevenZipDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1313

1414
public CompressIntoSevenZipAction()
1515
{

src/Files.App/Actions/Content/Archives/Compress/CompressIntoZipAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public override string Label
99
=> string.Format(Strings.CreateNamedArchive.GetLocalizedResource(), $"{StorageArchiveService.GenerateArchiveNameFromItems(context.SelectedItems)}.zip");
1010

1111
public override string Description
12-
=> Strings.CompressIntoZipDescription.GetLocalizedResource();
12+
=> Strings.CompressIntoZipDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1313

1414
public CompressIntoZipAction()
1515
{

src/Files.App/Actions/Content/Archives/Decompress/DecompressArchive.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public override string Label
1717
=> Strings.ExtractFiles.GetLocalizedResource();
1818

1919
public override string Description
20-
=> Strings.DecompressArchiveDescription.GetLocalizedResource();
20+
=> Strings.DecompressArchiveDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
2121

2222
public override HotKey HotKey
2323
=> new(Keys.E, KeyModifiers.Ctrl);

src/Files.App/Actions/Content/Archives/Decompress/DecompressArchiveHere.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public override string Label
99
=> Strings.ExtractHere.GetLocalizedResource();
1010

1111
public override string Description
12-
=> Strings.DecompressArchiveHereDescription.GetLocalizedResource();
12+
=> Strings.DecompressArchiveHereDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1313

1414
public DecompressArchiveHere()
1515
{

src/Files.App/Actions/Content/Archives/Decompress/DecompressArchiveHereSmart.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public override string Label
99
=> Strings.ExtractHereSmart.GetLocalizedResource();
1010

1111
public override string Description
12-
=> Strings.DecompressArchiveHereSmartDescription.GetLocalizedResource();
12+
=> Strings.DecompressArchiveHereSmartDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1313

1414
public override HotKey HotKey
1515
=> new(Keys.E, KeyModifiers.CtrlShift);

src/Files.App/Actions/Content/Archives/Decompress/DecompressArchiveToChildFolderAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public override string Label
1515
=> ComputeLabel();
1616

1717
public override string Description
18-
=> Strings.DecompressArchiveToChildFolderDescription.GetLocalizedResource();
18+
=> Strings.DecompressArchiveToChildFolderDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1919

2020
public DecompressArchiveToChildFolderAction()
2121
{

src/Files.App/Actions/Content/ImageManipulation/BaseRotateAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Files.App.Actions
88
{
99
internal abstract class BaseRotateAction : ObservableObject, IAction
1010
{
11-
private readonly IContentPageContext context;
11+
protected readonly IContentPageContext context;
1212

1313
private readonly InfoPaneViewModel _infoPaneViewModel;
1414

src/Files.App/Actions/Content/ImageManipulation/RotateLeftAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public override string Label
1111
=> Strings.RotateLeft.GetLocalizedResource();
1212

1313
public override string Description
14-
=> Strings.RotateLeftDescription.GetLocalizedResource();
14+
=> Strings.RotateLeftDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1515

1616
public override RichGlyph Glyph
1717
=> new(themedIconStyle: "App.ThemedIcons.ImageRotate.ACW");

src/Files.App/Actions/Content/ImageManipulation/RotateRightAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public override string Label
1111
=> Strings.RotateRight.GetLocalizedResource();
1212

1313
public override string Description
14-
=> Strings.RotateRightDescription.GetLocalizedResource();
14+
=> Strings.RotateRightDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1515

1616
public override RichGlyph Glyph
1717
=> new(themedIconStyle: "App.ThemedIcons.ImageRotate.CW");

src/Files.App/Actions/Content/Install/InstallCertificateAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public string Label
1313
=> Strings.Install.GetLocalizedResource();
1414

1515
public string Description
16-
=> Strings.InstallCertificateDescription.GetLocalizedResource();
16+
=> Strings.InstallCertificateDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1717

1818
public RichGlyph Glyph
1919
=> new("\uEB95");

src/Files.App/Actions/Content/Install/InstallFontAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public string Label
1414
=> Strings.Install.GetLocalizedResource();
1515

1616
public string Description
17-
=> Strings.InstallFontDescription.GetLocalizedResource();
17+
=> Strings.InstallFontDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1818

1919
public RichGlyph Glyph
2020
=> new(themedIconStyle: "App.ThemedIcons.Actions.FontInstall");

src/Files.App/Actions/Content/Install/InstallInfDriverAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public string Label
1313
=> Strings.Install.GetLocalizedResource();
1414

1515
public string Description
16-
=> Strings.InstallInfDriverDescription.GetLocalizedResource();
16+
=> Strings.InstallInfDriverDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1717

1818
public RichGlyph Glyph
1919
=> new("\uE9F5");

src/Files.App/Actions/Content/Share/ShareItemAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public string Label
1313
=> Strings.Share.GetLocalizedResource();
1414

1515
public string Description
16-
=> Strings.ShareItemDescription.GetLocalizedResource();
16+
=> Strings.ShareItemDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1717

1818
public RichGlyph Glyph
1919
=> new(themedIconStyle: "App.ThemedIcons.Share");

src/Files.App/Actions/FileSystem/CreateAlternateDataStreamAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public string Label
1717
=> Strings.CreateAlternateDataStream.GetLocalizedResource();
1818

1919
public string Description
20-
=> Strings.CreateAlternateDataStreamDescription.GetLocalizedResource();
20+
=> Strings.CreateAlternateDataStreamDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
2121

2222
public RichGlyph Glyph
2323
=> new RichGlyph(themedIconStyle: "App.ThemedIcons.AltDataStream");

src/Files.App/Actions/FileSystem/CreateFolderWithSelectionAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public string Label
1111
=> Strings.CreateFolderWithSelection.GetLocalizedResource();
1212

1313
public string Description
14-
=> Strings.CreateFolderWithSelectionDescription.GetLocalizedResource();
14+
=> Strings.CreateFolderWithSelectionDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1515

1616
public RichGlyph Glyph
1717
=> new(themedIconStyle: "App.ThemedIcons.New.Folder");

src/Files.App/Actions/FileSystem/CreateShortcutAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public string Label
1111
=> Strings.CreateShortcut.GetLocalizedResource();
1212

1313
public string Description
14-
=> Strings.CreateShortcutDescription.GetLocalizedResource();
14+
=> Strings.CreateShortcutDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1515

1616
public RichGlyph Glyph
1717
=> new(themedIconStyle: "App.ThemedIcons.URL");

src/Files.App/Actions/FileSystem/DeleteItemAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public string Label
99
=> Strings.Delete.GetLocalizedResource();
1010

1111
public string Description
12-
=> Strings.DeleteItemDescription.GetLocalizedResource();
12+
=> Strings.DeleteItemDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1313

1414
public RichGlyph Glyph
1515
=> new RichGlyph(themedIconStyle: "App.ThemedIcons.Delete");

src/Files.App/Actions/FileSystem/DeleteItemPermanentlyAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public string Label
99
=> Strings.DeletePermanently.GetLocalizedResource();
1010

1111
public string Description
12-
=> Strings.DeleteItemPermanentlyDescription.GetLocalizedResource();
12+
=> Strings.DeleteItemPermanentlyDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1313

1414
public HotKey HotKey
1515
=> new(Keys.Delete, KeyModifiers.Shift);

src/Files.App/Actions/FileSystem/OpenItemAction.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public string Label
1414
=> Strings.Open.GetLocalizedResource();
1515

1616
public string Description
17-
=> Strings.OpenItemDescription.GetLocalizedResource();
18-
17+
=> Strings.OpenItemDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
18+
1919
public RichGlyph Glyph
2020
=> new(themedIconStyle: "App.ThemedIcons.OpenFile");
2121

@@ -58,7 +58,7 @@ public string Label
5858
=> Strings.OpenWith.GetLocalizedResource();
5959

6060
public string Description
61-
=> Strings.OpenItemWithApplicationPickerDescription.GetLocalizedResource();
61+
=> Strings.OpenItemWithApplicationPickerDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
6262

6363
public RichGlyph Glyph
6464
=> new(themedIconStyle: "App.ThemedIcons.OpenWith");

src/Files.App/Actions/FileSystem/PasteItemAction.cs

-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4-
using CommunityToolkit.Mvvm.ComponentModel;
5-
using CommunityToolkit.Mvvm.DependencyInjection;
6-
using Files.App.Data.Models;
7-
using Files.App.Extensions;
8-
using Files.App.Helpers;
9-
using System.ComponentModel;
10-
using System.Threading.Tasks;
11-
124
namespace Files.App.Actions
135
{
146
internal sealed partial class PasteItemAction : ObservableObject, IAction

src/Files.App/Actions/FileSystem/RestoreRecycleBinAction.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public string Label
1515
=> Strings.Restore.GetLocalizedResource();
1616

1717
public string Description
18-
=> Strings.RestoreRecycleBinDescription.GetLocalizedResource();
18+
=> Strings.RestoreRecycleBinDescription.GetLocalizedFormatResource(context.SelectedItems.Count);
1919

2020
public RichGlyph Glyph
2121
=> new(themedIconStyle: "App.ThemedIcons.RestoreDeleted");
@@ -37,7 +37,7 @@ public async Task ExecuteAsync(object? parameter = null)
3737
var confirmationDialog = new ContentDialog()
3838
{
3939
Title = Strings.ConfirmRestoreSelectionBinDialogTitle.GetLocalizedResource(),
40-
Content = string.Format(Strings.ConfirmRestoreSelectionBinDialogContent.GetLocalizedResource(), context.SelectedItems.Count),
40+
Content = string.Format(Strings.ConfirmRestoreSelectionBinDialogContent.GetLocalizedFormatResource(context.SelectedItems.Count), context.SelectedItems.Count),
4141
PrimaryButtonText = Strings.Yes.GetLocalizedResource(),
4242
SecondaryButtonText = Strings.Cancel.GetLocalizedResource(),
4343
DefaultButton = ContentDialogButton.Primary

src/Files.App/Actions/FileSystem/Transfer/CopyItemAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public string Label
1111
=> Strings.Copy.GetLocalizedResource();
1212

1313
public string Description
14-
=> Strings.CopyItemDescription.GetLocalizedResource();
14+
=> Strings.CopyItemDescription.GetLocalizedFormatResource(ContentPageContext.SelectedItems.Count);
1515

1616
public RichGlyph Glyph
1717
=> new(themedIconStyle: "App.ThemedIcons.Copy");

src/Files.App/Actions/FileSystem/Transfer/CutItemAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public string Label
1111
=> Strings.Cut.GetLocalizedResource();
1212

1313
public string Description
14-
=> Strings.CutItemDescription.GetLocalizedResource();
14+
=> Strings.CutItemDescription.GetLocalizedFormatResource(ContentPageContext.SelectedItems.Count);
1515

1616
public RichGlyph Glyph
1717
=> new(themedIconStyle: "App.ThemedIcons.Cut");

src/Files.App/Actions/Sidebar/PinFolderToSidebarAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public string Label
1414
=> Strings.PinFolderToSidebar.GetLocalizedResource();
1515

1616
public string Description
17-
=> Strings.PinFolderToSidebarDescription.GetLocalizedResource();
17+
=> Strings.PinFolderToSidebarDescription.GetLocalizedFormatResource(context.HasSelection ? context.SelectedItems.Count : 1);
1818

1919
public RichGlyph Glyph
2020
=> new(themedIconStyle: "App.ThemedIcons.FavoritePin");

src/Files.App/Actions/Sidebar/UnpinFolderToSidebarAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public string Label
1212
=> Strings.UnpinFolderFromSidebar.GetLocalizedResource();
1313

1414
public string Description
15-
=> Strings.UnpinFolderFromSidebarDescription.GetLocalizedResource();
15+
=> Strings.UnpinFolderFromSidebarDescription.GetLocalizedFormatResource(context.HasSelection ? context.SelectedItems.Count : 1);
1616

1717
public RichGlyph Glyph
1818
=> new(themedIconStyle: "App.ThemedIcons.FavoritePinRemove");

src/Files.App/Actions/Start/PinToStartAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public string Label
1515
=> Strings.PinItemToStart_Text.GetLocalizedResource();
1616

1717
public string Description
18-
=> Strings.PinToStartDescription.GetLocalizedResource();
18+
=> Strings.PinToStartDescription.GetLocalizedFormatResource(context.HasSelection ? context.SelectedItems.Count : 1);
1919

2020
public RichGlyph Glyph
2121
=> new(themedIconStyle: "App.ThemedIcons.FavoritePin");

src/Files.App/Actions/Start/UnpinFromStartAction.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public string Label
1515
=> Strings.UnpinItemFromStart_Text.GetLocalizedResource();
1616

1717
public string Description
18-
=> Strings.UnpinFromStartDescription.GetLocalizedResource();
18+
=> Strings.UnpinFromStartDescription.GetLocalizedFormatResource(context.HasSelection ? context.SelectedItems.Count : 1);
1919

2020
public RichGlyph Glyph
2121
=> new(themedIconStyle: "App.ThemedIcons.FavoritePinRemove");

0 commit comments

Comments
 (0)