diff --git a/src/Files.App/ViewModels/Dialogs/AddItemDialog/AddItemDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/AddItemDialog/AddItemDialogViewModel.cs index f30b2ab05a84..4665d89c7007 100644 --- a/src/Files.App/ViewModels/Dialogs/AddItemDialog/AddItemDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/AddItemDialog/AddItemDialogViewModel.cs @@ -33,8 +33,8 @@ public async Task AddItemsToListAsync(IEnumerable itemTypes) AddItemsList.Add(new() { - Header = "Folder".ToLocalized(), - SubHeader = "AddDialogListFolderSubHeader".ToLocalized(), + Header = Strings.Folder.ToLocalized(), + SubHeader = Strings.AddDialogListFolderSubHeader.ToLocalized(), Glyph = "\xE838", IsItemEnabled = true, ItemResult = new() @@ -45,8 +45,8 @@ public async Task AddItemsToListAsync(IEnumerable itemTypes) AddItemsList.Add(new() { - Header = "File".ToLocalized(), - SubHeader = "AddDialogListFileSubHeader".ToLocalized(), + Header = Strings.File.ToLocalized(), + SubHeader = Strings.AddDialogListFileSubHeader.ToLocalized(), Glyph = "\xE8A5", IsItemEnabled = true, ItemResult = new() @@ -58,8 +58,8 @@ public async Task AddItemsToListAsync(IEnumerable itemTypes) AddItemsList.Add(new() { - Header = "Shortcut".ToLocalized(), - SubHeader = "AddDialogListShortcutSubHeader".ToLocalized(), + Header = Strings.Shortcut.ToLocalized(), + SubHeader = Strings.AddDialogListShortcutSubHeader.ToLocalized(), Glyph = "\uE71B", IsItemEnabled = true, ItemResult = new() diff --git a/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogViewModel.cs index 2ea9bf4f20d9..ef4f0f93991f 100644 --- a/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/FileSystemDialog/FileSystemDialogViewModel.cs @@ -149,14 +149,14 @@ public static FileSystemDialogViewModel GetDialogViewModel(FileSystemDialogMode if (dialogMode.ConflictsExist) { - titleText = "ConflictingItemsDialogTitle".GetLocalizedFormatResource(totalCount); + titleText = Strings.ConflictingItemsDialogTitle.GetLocalizedFormatResource(totalCount); descriptionText = nonConflictingItems.Count > 0 - ? "ConflictingItemsDialogSubtitleConflictsNonConflicts".GetLocalizedFormatResource(conflictingItems.Count, nonConflictingItems.Count) - : "ConflictingItemsDialogSubtitleConflicts".GetLocalizedFormatResource(conflictingItems.Count); + ? Strings.ConflictingItemsDialogSubtitleConflictsNonConflicts.GetLocalizedFormatResource(conflictingItems.Count, nonConflictingItems.Count) + : Strings.ConflictingItemsDialogSubtitleConflicts.GetLocalizedFormatResource(conflictingItems.Count); - primaryButtonText = "ConflictingItemsDialogPrimaryButtonText".ToLocalized(); - secondaryButtonText = "Cancel".ToLocalized(); + primaryButtonText = Strings.ConflictingItemsDialogPrimaryButtonText.ToLocalized(); + secondaryButtonText = Strings.Cancel.ToLocalized(); } else { @@ -164,33 +164,33 @@ public static FileSystemDialogViewModel GetDialogViewModel(FileSystemDialogMode { case FilesystemOperationType.Copy: { - titleText = "CopyItemsDialogTitle".GetLocalizedFormatResource(totalCount); + titleText = Strings.CopyItemsDialogTitle.GetLocalizedFormatResource(totalCount); - descriptionText = "CopyItemsDialogSubtitle".GetLocalizedFormatResource(totalCount); - primaryButtonText = "Copy".ToLocalized(); - secondaryButtonText = "Cancel".ToLocalized(); + descriptionText = Strings.CopyItemsDialogSubtitle.GetLocalizedFormatResource(totalCount); + primaryButtonText = Strings.Copy.ToLocalized(); + secondaryButtonText = Strings.Cancel.ToLocalized(); break; } case FilesystemOperationType.Move: { - titleText = "MoveItemsDialogTitle".GetLocalizedFormatResource(totalCount); + titleText = Strings.MoveItemsDialogTitle.GetLocalizedFormatResource(totalCount); - descriptionText = "MoveItemsDialogSubtitle".GetLocalizedFormatResource(totalCount); - primaryButtonText = "MoveItemsDialogPrimaryButtonText".ToLocalized(); - secondaryButtonText = "Cancel".ToLocalized(); + descriptionText = Strings.MoveItemsDialogSubtitle.GetLocalizedFormatResource(totalCount); + primaryButtonText = Strings.MoveItemsDialogPrimaryButtonText.ToLocalized(); + secondaryButtonText = Strings.Cancel.ToLocalized(); break; } case FilesystemOperationType.Delete: { - titleText = "DeleteItemsDialogTitle".GetLocalizedFormatResource(totalCount); + titleText = Strings.DeleteItemsDialogTitle.GetLocalizedFormatResource(totalCount); - descriptionText = "DeleteItemsDialogSubtitle".GetLocalizedFormatResource(totalCount); - primaryButtonText = "Delete".ToLocalized(); - secondaryButtonText = "Cancel".ToLocalized(); + descriptionText = Strings.DeleteItemsDialogSubtitle.GetLocalizedFormatResource(totalCount); + primaryButtonText = Strings.Delete.ToLocalized(); + secondaryButtonText = Strings.Cancel.ToLocalized(); isInDeleteMode = true; diff --git a/src/Files.App/ViewModels/Dialogs/ReorderSidebarItemsDialogViewModel.cs b/src/Files.App/ViewModels/Dialogs/ReorderSidebarItemsDialogViewModel.cs index 1c9de997c62e..37ddb169000d 100644 --- a/src/Files.App/ViewModels/Dialogs/ReorderSidebarItemsDialogViewModel.cs +++ b/src/Files.App/ViewModels/Dialogs/ReorderSidebarItemsDialogViewModel.cs @@ -9,7 +9,7 @@ public sealed partial class ReorderSidebarItemsDialogViewModel : ObservableObjec { private readonly IQuickAccessService quickAccessService = Ioc.Default.GetRequiredService(); - public string HeaderText = "ReorderSidebarItemsDialogText".GetLocalizedResource(); + public string HeaderText = Strings.ReorderSidebarItemsDialogText.GetLocalizedResource(); public ICommand PrimaryButtonCommand { get; private set; } public ObservableCollection SidebarPinnedFolderItems = new(App.QuickAccessManager.Model._PinnedFolderItems diff --git a/src/Files.App/ViewModels/Layouts/BaseLayoutViewModel.cs b/src/Files.App/ViewModels/Layouts/BaseLayoutViewModel.cs index b427cef768a1..6ae143728a80 100644 --- a/src/Files.App/ViewModels/Layouts/BaseLayoutViewModel.cs +++ b/src/Files.App/ViewModels/Layouts/BaseLayoutViewModel.cs @@ -125,23 +125,23 @@ public async Task DragOverAsync(DragEventArgs e) e.DragUIOverride.IsCaptionVisible = true; if (pwd.StartsWith(Constants.UserEnvironmentPaths.RecycleBinPath, StringComparison.Ordinal)) { - e.DragUIOverride.Caption = string.Format("MoveToFolderCaptionText".GetLocalizedResource(), folderName); + e.DragUIOverride.Caption = string.Format(Strings.MoveToFolderCaptionText.GetLocalizedResource(), folderName); // Some applications such as Edge can't raise the drop event by the Move flag (#14008), so we set the Copy flag as well. e.AcceptedOperation = DataPackageOperation.Move | DataPackageOperation.Copy; } else if (e.Modifiers.HasFlag(DragDropModifiers.Alt) || e.Modifiers.HasFlag(DragDropModifiers.Control | DragDropModifiers.Shift)) { - e.DragUIOverride.Caption = string.Format("LinkToFolderCaptionText".GetLocalizedResource(), folderName); + e.DragUIOverride.Caption = string.Format(Strings.LinkToFolderCaptionText.GetLocalizedResource(), folderName); e.AcceptedOperation = DataPackageOperation.Link; } else if (e.Modifiers.HasFlag(DragDropModifiers.Control)) { - e.DragUIOverride.Caption = string.Format("CopyToFolderCaptionText".GetLocalizedResource(), folderName); + e.DragUIOverride.Caption = string.Format(Strings.CopyToFolderCaptionText.GetLocalizedResource(), folderName); e.AcceptedOperation = DataPackageOperation.Copy; } else if (e.Modifiers.HasFlag(DragDropModifiers.Shift)) { - e.DragUIOverride.Caption = string.Format("MoveToFolderCaptionText".GetLocalizedResource(), folderName); + e.DragUIOverride.Caption = string.Format(Strings.MoveToFolderCaptionText.GetLocalizedResource(), folderName); // Some applications such as Edge can't raise the drop event by the Move flag (#14008), so we set the Copy flag as well. e.AcceptedOperation = DataPackageOperation.Move | DataPackageOperation.Copy; } @@ -150,18 +150,18 @@ x.Item is ZipStorageFile || x.Item is ZipStorageFolder) || ZipStorageFolder.IsZipPath(pwd)) { - e.DragUIOverride.Caption = string.Format("CopyToFolderCaptionText".GetLocalizedResource(), folderName); + e.DragUIOverride.Caption = string.Format(Strings.CopyToFolderCaptionText.GetLocalizedResource(), folderName); e.AcceptedOperation = DataPackageOperation.Copy; } else if (draggedItems.AreItemsInSameDrive(_associatedInstance.ShellViewModel.WorkingDirectory)) { - e.DragUIOverride.Caption = string.Format("MoveToFolderCaptionText".GetLocalizedResource(), folderName); + e.DragUIOverride.Caption = string.Format(Strings.MoveToFolderCaptionText.GetLocalizedResource(), folderName); // Some applications such as Edge can't raise the drop event by the Move flag (#14008), so we set the Copy flag as well. e.AcceptedOperation = DataPackageOperation.Move | DataPackageOperation.Copy; } else { - e.DragUIOverride.Caption = string.Format("CopyToFolderCaptionText".GetLocalizedResource(), folderName); + e.DragUIOverride.Caption = string.Format(Strings.CopyToFolderCaptionText.GetLocalizedResource(), folderName); e.AcceptedOperation = DataPackageOperation.Copy; } diff --git a/src/Files.App/ViewModels/Properties/BasePropertiesPage.cs b/src/Files.App/ViewModels/Properties/BasePropertiesPage.cs index b9b29c15a7a8..d5dda9ffe37a 100644 --- a/src/Files.App/ViewModels/Properties/BasePropertiesPage.cs +++ b/src/Files.App/ViewModels/Properties/BasePropertiesPage.cs @@ -86,7 +86,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) string[] extensions = [ - "BitmapFiles".GetLocalizedResource(), "*.bmp", + Strings.BitmapFiles.GetLocalizedResource(), "*.bmp", "JPEG", "*.jpg;*.jpeg", "PNG", "*.png", ]; diff --git a/src/Files.App/ViewModels/Properties/CompatibilityViewModel.cs b/src/Files.App/ViewModels/Properties/CompatibilityViewModel.cs index a08ba34fee83..41935ce228d8 100644 --- a/src/Files.App/ViewModels/Properties/CompatibilityViewModel.cs +++ b/src/Files.App/ViewModels/Properties/CompatibilityViewModel.cs @@ -85,26 +85,26 @@ public CompatibilityViewModel(ListedItem item) CompatibilityOptions = WindowsCompatibilityService.GetCompatibilityOptionsForPath(ItemPath); - CompatibilityModes.Add(WindowsCompatModeKind.None, "None".GetLocalizedResource()); + CompatibilityModes.Add(WindowsCompatModeKind.None, Strings.None.GetLocalizedResource()); CompatibilityModes.Add(WindowsCompatModeKind.WindowsVista, "Windows Vista"); CompatibilityModes.Add(WindowsCompatModeKind.WindowsVistaSP1, "Windows Vista (Service Pack 1)"); CompatibilityModes.Add(WindowsCompatModeKind.WindowsVistaSP2, "Windows Vista (Service Pack 2)"); CompatibilityModes.Add(WindowsCompatModeKind.Windows7, "Windows 7"); CompatibilityModes.Add(WindowsCompatModeKind.Windows8, "Windows 8"); - ReducedColorModes.Add(WindowsCompatReducedColorModeKind.None, "CompatibilityNoReducedColor".GetLocalizedResource()); - ReducedColorModes.Add(WindowsCompatReducedColorModeKind.Color8Bit, "CompatibilityReducedColorModeColor8bit".GetLocalizedResource()); - ReducedColorModes.Add(WindowsCompatReducedColorModeKind.Color16Bit, "CompatibilityReducedColorModeColor16bit".GetLocalizedResource()); + ReducedColorModes.Add(WindowsCompatReducedColorModeKind.None, Strings.CompatibilityNoReducedColor.GetLocalizedResource()); + ReducedColorModes.Add(WindowsCompatReducedColorModeKind.Color8Bit, Strings.CompatibilityReducedColorModeColor8bit.GetLocalizedResource()); + ReducedColorModes.Add(WindowsCompatReducedColorModeKind.Color16Bit, Strings.CompatibilityReducedColorModeColor16bit.GetLocalizedResource()); - HighDpiOptions.Add(WindowsCompatDPIOptionKind.None, "CompatibilityDoNotAdjustDPI".GetLocalizedResource()); - HighDpiOptions.Add(WindowsCompatDPIOptionKind.UseDPIOnLogin, "CompatibilityOnWindowsLogin".GetLocalizedResource()); - HighDpiOptions.Add(WindowsCompatDPIOptionKind.UseDPIOnProgramStart, "CompatibilityOnProgramStart".GetLocalizedResource()); + HighDpiOptions.Add(WindowsCompatDPIOptionKind.None, Strings.CompatibilityDoNotAdjustDPI.GetLocalizedResource()); + HighDpiOptions.Add(WindowsCompatDPIOptionKind.UseDPIOnLogin, Strings.CompatibilityOnWindowsLogin.GetLocalizedResource()); + HighDpiOptions.Add(WindowsCompatDPIOptionKind.UseDPIOnProgramStart, Strings.CompatibilityOnProgramStart.GetLocalizedResource()); - HighDpiOverrides.Add(WindowsCompatDpiOverrideKind.None, "CompatibilityDoNotOverrideDPI".GetLocalizedResource()); - HighDpiOverrides.Add(WindowsCompatDpiOverrideKind.Advanced, "Advanced".GetLocalizedResource()); - HighDpiOverrides.Add(WindowsCompatDpiOverrideKind.Application, "Application".GetLocalizedResource()); - HighDpiOverrides.Add(WindowsCompatDpiOverrideKind.System, "System".GetLocalizedResource()); - HighDpiOverrides.Add(WindowsCompatDpiOverrideKind.SystemAdvanced, "CompatibilitySystemEnhanced".GetLocalizedResource()); + HighDpiOverrides.Add(WindowsCompatDpiOverrideKind.None, Strings.CompatibilityDoNotOverrideDPI.GetLocalizedResource()); + HighDpiOverrides.Add(WindowsCompatDpiOverrideKind.Advanced, Strings.Advanced.GetLocalizedResource()); + HighDpiOverrides.Add(WindowsCompatDpiOverrideKind.Application, Strings.Application.GetLocalizedResource()); + HighDpiOverrides.Add(WindowsCompatDpiOverrideKind.System, Strings.System.GetLocalizedResource()); + HighDpiOverrides.Add(WindowsCompatDpiOverrideKind.SystemAdvanced, Strings.CompatibilitySystemEnhanced.GetLocalizedResource()); RunTroubleshooterCommand = new AsyncRelayCommand(ExecuteRunTroubleshooterCommand); } diff --git a/src/Files.App/ViewModels/Properties/HashesViewModel.cs b/src/Files.App/ViewModels/Properties/HashesViewModel.cs index 7bd2df6c4303..f40242c7fbbb 100644 --- a/src/Files.App/ViewModels/Properties/HashesViewModel.cs +++ b/src/Files.App/ViewModels/Properties/HashesViewModel.cs @@ -71,7 +71,7 @@ private void ToggleIsEnabled(string? algorithm) // Don't calculate hashes for online files if (_item.SyncStatusUI.SyncStatus is CloudDriveSyncStatus.FileOnline or CloudDriveSyncStatus.FolderOnline) { - hashInfoItem.HashValue = "CalculationOnlineFileHashError".GetLocalizedResource(); + hashInfoItem.HashValue = Strings.CalculationOnlineFileHashError.GetLocalizedResource(); return; } @@ -106,11 +106,11 @@ private void ToggleIsEnabled(string? algorithm) catch (IOException) { // File is currently open - hashInfoItem.HashValue = "CalculationErrorFileIsOpen".GetLocalizedResource(); + hashInfoItem.HashValue = Strings.CalculationErrorFileIsOpen.GetLocalizedResource(); } catch (Exception) { - hashInfoItem.HashValue = "CalculationError".GetLocalizedResource(); + hashInfoItem.HashValue = Strings.CalculationError.GetLocalizedResource(); } finally { diff --git a/src/Files.App/ViewModels/Properties/Items/BaseProperties.cs b/src/Files.App/ViewModels/Properties/Items/BaseProperties.cs index 375168617d6c..ea436c4f654e 100644 --- a/src/Files.App/ViewModels/Properties/Items/BaseProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/BaseProperties.cs @@ -122,8 +122,8 @@ await Dispatcher.EnqueueOrInvokeAsync(() => public void SetItemsCountString() { ViewModel.FilesAndFoldersCountString = ViewModel.LocationsCount > 0 - ? "PropertiesFilesAndFoldersAndLocationsCount".GetLocalizedFormatResource(ViewModel.FilesCount, ViewModel.FoldersCount, ViewModel.LocationsCount) - : "PropertiesFilesAndFoldersCountString".GetLocalizedFormatResource(ViewModel.FilesCount, ViewModel.FoldersCount); + ? Strings.PropertiesFilesAndFoldersAndLocationsCount.GetLocalizedFormatResource(ViewModel.FilesCount, ViewModel.FoldersCount, ViewModel.LocationsCount) + : Strings.PropertiesFilesAndFoldersCountString.GetLocalizedFormatResource(ViewModel.FilesCount, ViewModel.FoldersCount); } } } diff --git a/src/Files.App/ViewModels/Properties/Items/CombinedFileProperties.cs b/src/Files.App/ViewModels/Properties/Items/CombinedFileProperties.cs index 4c5f8f0364de..6ea1ac913791 100644 --- a/src/Files.App/ViewModels/Properties/Items/CombinedFileProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/CombinedFileProperties.cs @@ -64,8 +64,8 @@ public async Task GetSystemFilePropertiesAsync() else if (props.Where(x => x.Property == prop.Property).Any(x => !Equals(x.Value, prop.Value))) { // Has multiple values - prop.Value = prop.IsReadOnly ? "MultipleValues".GetLocalizedResource() : null; - prop.PlaceholderText = "MultipleValues".GetLocalizedResource(); + prop.Value = prop.IsReadOnly ? Strings.MultipleValues.GetLocalizedResource() : null; + prop.PlaceholderText = Strings.MultipleValues.GetLocalizedResource(); } } } diff --git a/src/Files.App/ViewModels/Properties/Items/CombinedProperties.cs b/src/Files.App/ViewModels/Properties/Items/CombinedProperties.cs index fdf1b04bd88a..5b49a6a626ec 100644 --- a/src/Files.App/ViewModels/Properties/Items/CombinedProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/CombinedProperties.cs @@ -41,18 +41,18 @@ public sealed override void GetBaseProperties() if (List.All(x => x.ItemType.Equals(List.First().ItemType))) { - ViewModel.ItemType = string.Format("PropertiesDriveItemTypesEquals".GetLocalizedResource(), List.First().ItemType); + ViewModel.ItemType = string.Format(Strings.PropertiesDriveItemTypesEquals.GetLocalizedResource(), List.First().ItemType); } else { - ViewModel.ItemType = "PropertiesDriveItemTypeDifferent".GetLocalizedResource(); + ViewModel.ItemType = Strings.PropertiesDriveItemTypeDifferent.GetLocalizedResource(); } var itemsPath = List.Select(Item => (Item as RecycleBinItem)?.ItemOriginalFolder ?? (Path.IsPathRooted(Item.ItemPath) ? Path.GetDirectoryName(Item.ItemPath) : Item.ItemPath)); if (itemsPath.Distinct().Count() == 1) - ViewModel.ItemLocation = string.Format("PropertiesCombinedItemLocation".GetLocalizedResource(), itemsPath.First()); + ViewModel.ItemLocation = string.Format(Strings.PropertiesCombinedItemLocation.GetLocalizedResource(), itemsPath.First()); } } diff --git a/src/Files.App/ViewModels/Properties/Items/FileProperties.cs b/src/Files.App/ViewModels/Properties/Items/FileProperties.cs index d0de82a45d27..5520d956b98b 100644 --- a/src/Files.App/ViewModels/Properties/Items/FileProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/FileProperties.cs @@ -58,8 +58,8 @@ public override void GetBaseProperties() FileExtensionHelpers.IsExecutableFile(shortcutItem.TargetPath) || FileExtensionHelpers.IsMsiFile(shortcutItem.TargetPath); - ViewModel.ShortcutItemType = isApplication ? "Application".GetLocalizedResource() : - Item.IsLinkItem ? "PropertiesShortcutTypeLink".GetLocalizedResource() : "File".GetLocalizedResource(); + ViewModel.ShortcutItemType = isApplication ? Strings.Application.GetLocalizedResource() : + Item.IsLinkItem ? Strings.PropertiesShortcutTypeLink.GetLocalizedResource() : Strings.File.GetLocalizedResource(); ViewModel.ShortcutItemPath = shortcutItem.TargetPath; ViewModel.IsShortcutItemPathReadOnly = shortcutItem.IsSymLink; ViewModel.ShortcutItemWorkingDir = shortcutItem.WorkingDirectory; diff --git a/src/Files.App/ViewModels/Properties/Items/FolderProperties.cs b/src/Files.App/ViewModels/Properties/Items/FolderProperties.cs index 0dd47ef2610a..3fea309141ed 100644 --- a/src/Files.App/ViewModels/Properties/Items/FolderProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/FolderProperties.cs @@ -51,7 +51,7 @@ public override void GetBaseProperties() if (Item.IsShortcut) { var shortcutItem = (ShortcutItem)Item; - ViewModel.ShortcutItemType = "Folder".GetLocalizedResource(); + ViewModel.ShortcutItemType = Strings.Folder.GetLocalizedResource(); ViewModel.ShortcutItemPath = shortcutItem.TargetPath; ViewModel.IsShortcutItemPathReadOnly = false; ViewModel.ShortcutItemWorkingDir = shortcutItem.WorkingDirectory; diff --git a/src/Files.App/ViewModels/Properties/Items/LibraryProperties.cs b/src/Files.App/ViewModels/Properties/Items/LibraryProperties.cs index 4e62982a8dbc..d6883f436593 100644 --- a/src/Files.App/ViewModels/Properties/Items/LibraryProperties.cs +++ b/src/Files.App/ViewModels/Properties/Items/LibraryProperties.cs @@ -101,7 +101,7 @@ public async override Task GetSpecialPropertiesAsync() } else { - ViewModel.FilesAndFoldersCountString = "LibraryNoLocations/Text".GetLocalizedResource(); + ViewModel.FilesAndFoldersCountString = Strings.LibraryNoLocations_Text.GetLocalizedResource(); } } diff --git a/src/Files.App/ViewModels/Properties/SecurityAdvancedViewModel.cs b/src/Files.App/ViewModels/Properties/SecurityAdvancedViewModel.cs index c3562be015a2..3201b42c06a7 100644 --- a/src/Files.App/ViewModels/Properties/SecurityAdvancedViewModel.cs +++ b/src/Files.App/ViewModels/Properties/SecurityAdvancedViewModel.cs @@ -180,14 +180,14 @@ private void LoadAccessControlEntry() if (error is WIN32_ERROR.ERROR_ACCESS_DENIED) { ErrorMessage = - "SecurityRequireReadPermissions".GetLocalizedResource() + + Strings.SecurityRequireReadPermissions.GetLocalizedResource() + "\r\n\r\n" + - "SecuritySuggestToTakeOwnership".GetLocalizedResource(); + Strings.SecuritySuggestToTakeOwnership.GetLocalizedResource(); } else { ErrorMessage = - "SecurityUnableToDisplayPermissions".GetLocalizedResource() + + Strings.SecurityUnableToDisplayPermissions.GetLocalizedResource() + "\r\n\r\n" + error.ToString(); } diff --git a/src/Files.App/ViewModels/Properties/SecurityViewModel.cs b/src/Files.App/ViewModels/Properties/SecurityViewModel.cs index a49a56135300..388ac13faa5e 100644 --- a/src/Files.App/ViewModels/Properties/SecurityViewModel.cs +++ b/src/Files.App/ViewModels/Properties/SecurityViewModel.cs @@ -36,8 +36,8 @@ SelectedAccessControlEntry is not null && public string SelectedItemHeaderText => SelectedAccessControlEntry is null - ? "Permissions".GetLocalizedResource() - : string.Format("SecurityPermissionsHeaderText".GetLocalizedResource(), SelectedAccessControlEntry?.Principal.DisplayName); + ? Strings.Permissions.GetLocalizedResource() + : string.Format(Strings.SecurityPermissionsHeaderText.GetLocalizedResource(), SelectedAccessControlEntry?.Principal.DisplayName); private AccessControlList _AccessControlList; public AccessControlList AccessControlList @@ -98,8 +98,8 @@ public SecurityViewModel(PropertiesPageNavigationParameter parameter) { DisplayElements = false; ErrorMessage = error is WIN32_ERROR.ERROR_ACCESS_DENIED - ? "SecurityRequireReadPermissions".GetLocalizedResource() + "\r\n" + "SecurityClickAdvancedPermissions".GetLocalizedResource() - : "SecurityUnableToDisplayPermissions".GetLocalizedResource(); + ? Strings.SecurityRequireReadPermissions.GetLocalizedResource() + "\r\n" + Strings.SecurityClickAdvancedPermissions.GetLocalizedResource() + : Strings.SecurityUnableToDisplayPermissions.GetLocalizedResource(); } else { diff --git a/src/Files.App/ViewModels/Settings/AboutViewModel.cs b/src/Files.App/ViewModels/Settings/AboutViewModel.cs index 3a43e2c43e97..d8529882c12b 100644 --- a/src/Files.App/ViewModels/Settings/AboutViewModel.cs +++ b/src/Files.App/ViewModels/Settings/AboutViewModel.cs @@ -24,7 +24,7 @@ public sealed partial class AboutViewModel : ObservableObject // Properties public string Version - => string.Format($"{"SettingsAboutVersionTitle".GetLocalizedResource()} {AppVersion.Major}.{AppVersion.Minor}.{AppVersion.Build}.{AppVersion.Revision}"); + => string.Format($"{Strings.SettingsAboutVersionTitle.GetLocalizedResource()} {AppVersion.Major}.{AppVersion.Minor}.{AppVersion.Build}.{AppVersion.Revision}"); public string AppName => Package.Current.DisplayName; diff --git a/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs b/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs index 17cd5b02e1e2..9e3d608c9312 100644 --- a/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs +++ b/src/Files.App/ViewModels/Settings/AdvancedViewModel.cs @@ -160,7 +160,7 @@ private async Task SetAsOpenFileDialogAsync() private async Task ImportSettingsAsync() { - string[] extensions = ["ZipFileCapitalized".GetLocalizedResource(), "*.zip"]; + string[] extensions = [Strings.ZipFileCapitalized.GetLocalizedResource(), "*.zip"]; bool result = CommonDialogService.Open_FileOpenDialog(MainWindow.Instance.WindowHandle, false, extensions, Environment.SpecialFolder.Desktop, out var filePath); if (!result) return; @@ -200,13 +200,13 @@ private async Task ImportSettingsAsync() { App.Logger.LogWarning(ex, "Error importing settings"); UIHelpers.CloseAllDialogs(); - await DialogDisplayHelper.ShowDialogAsync("SettingsImportErrorTitle".GetLocalizedResource(), "SettingsImportErrorDescription".GetLocalizedResource()); + await DialogDisplayHelper.ShowDialogAsync(Strings.SettingsImportErrorTitle.GetLocalizedResource(), Strings.SettingsImportErrorDescription.GetLocalizedResource()); } } private async Task ExportSettingsAsync() { - string[] extensions = ["ZipFileCapitalized".GetLocalizedResource(), "*.zip" ]; + string[] extensions = [Strings.ZipFileCapitalized.GetLocalizedResource(), "*.zip" ]; bool result = CommonDialogService.Open_FileSaveDialog(MainWindow.Instance.WindowHandle, false, extensions, Environment.SpecialFolder.Desktop, out var filePath); if (!result) return; diff --git a/src/Files.App/ViewModels/Settings/AppearanceViewModel.cs b/src/Files.App/ViewModels/Settings/AppearanceViewModel.cs index f98d72b2ced3..06f79b19f866 100644 --- a/src/Files.App/ViewModels/Settings/AppearanceViewModel.cs +++ b/src/Files.App/ViewModels/Settings/AppearanceViewModel.cs @@ -37,16 +37,16 @@ public AppearanceViewModel(IUserSettingsService userSettingsService, IResourcesS Themes = [ - "Default".GetLocalizedResource(), - "LightTheme".GetLocalizedResource(), - "DarkTheme".GetLocalizedResource() + Strings.Default.GetLocalizedResource(), + Strings.LightTheme.GetLocalizedResource(), + Strings.DarkTheme.GetLocalizedResource() ]; - BackdropMaterialTypes.Add(BackdropMaterialType.Solid, "None".GetLocalizedResource()); - BackdropMaterialTypes.Add(BackdropMaterialType.Acrylic, "Acrylic".GetLocalizedResource()); - BackdropMaterialTypes.Add(BackdropMaterialType.ThinAcrylic, "ThinAcrylic".GetLocalizedResource()); - BackdropMaterialTypes.Add(BackdropMaterialType.Mica, "Mica".GetLocalizedResource()); - BackdropMaterialTypes.Add(BackdropMaterialType.MicaAlt, "MicaAlt".GetLocalizedResource()); + BackdropMaterialTypes.Add(BackdropMaterialType.Solid, Strings.None.GetLocalizedResource()); + BackdropMaterialTypes.Add(BackdropMaterialType.Acrylic, Strings.Acrylic.GetLocalizedResource()); + BackdropMaterialTypes.Add(BackdropMaterialType.ThinAcrylic, Strings.ThinAcrylic.GetLocalizedResource()); + BackdropMaterialTypes.Add(BackdropMaterialType.Mica, Strings.Mica.GetLocalizedResource()); + BackdropMaterialTypes.Add(BackdropMaterialType.MicaAlt, Strings.MicaAlt.GetLocalizedResource()); selectedBackdropMaterial = BackdropMaterialTypes[UserSettingsService.AppearanceSettingsService.AppThemeBackdropMaterial]; @@ -54,24 +54,24 @@ public AppearanceViewModel(IUserSettingsService userSettingsService, IResourcesS // Background image fit options - ImageStretchTypes.Add(Stretch.None, "None".GetLocalizedResource()); - ImageStretchTypes.Add(Stretch.Fill, "Fill".GetLocalizedResource()); - ImageStretchTypes.Add(Stretch.Uniform, "Uniform".GetLocalizedResource()); - ImageStretchTypes.Add(Stretch.UniformToFill, "UniformToFill".GetLocalizedResource()); + ImageStretchTypes.Add(Stretch.None, Strings.None.GetLocalizedResource()); + ImageStretchTypes.Add(Stretch.Fill, Strings.Fill.GetLocalizedResource()); + ImageStretchTypes.Add(Stretch.Uniform, Strings.Uniform.GetLocalizedResource()); + ImageStretchTypes.Add(Stretch.UniformToFill, Strings.UniformToFill.GetLocalizedResource()); SelectedImageStretchType = ImageStretchTypes[UserSettingsService.AppearanceSettingsService.AppThemeBackgroundImageFit]; // Background image allignment options // VerticalAlignment - ImageVerticalAlignmentTypes.Add(VerticalAlignment.Top, "Top".GetLocalizedResource()); - ImageVerticalAlignmentTypes.Add(VerticalAlignment.Center, "Center".GetLocalizedResource()); - ImageVerticalAlignmentTypes.Add(VerticalAlignment.Bottom, "Bottom".GetLocalizedResource()); + ImageVerticalAlignmentTypes.Add(VerticalAlignment.Top, Strings.Top.GetLocalizedResource()); + ImageVerticalAlignmentTypes.Add(VerticalAlignment.Center, Strings.Center.GetLocalizedResource()); + ImageVerticalAlignmentTypes.Add(VerticalAlignment.Bottom, Strings.Bottom.GetLocalizedResource()); SelectedImageVerticalAlignmentType = ImageVerticalAlignmentTypes[UserSettingsService.AppearanceSettingsService.AppThemeBackgroundImageVerticalAlignment]; // HorizontalAlignment - ImageHorizontalAlignmentTypes.Add(HorizontalAlignment.Left, "Left".GetLocalizedResource()); - ImageHorizontalAlignmentTypes.Add(HorizontalAlignment.Center, "Center".GetLocalizedResource()); - ImageHorizontalAlignmentTypes.Add(HorizontalAlignment.Right, "Right".GetLocalizedResource()); + ImageHorizontalAlignmentTypes.Add(HorizontalAlignment.Left, Strings.Left.GetLocalizedResource()); + ImageHorizontalAlignmentTypes.Add(HorizontalAlignment.Center, Strings.Center.GetLocalizedResource()); + ImageHorizontalAlignmentTypes.Add(HorizontalAlignment.Right, Strings.Right.GetLocalizedResource()); SelectedImageHorizontalAlignmentType = ImageHorizontalAlignmentTypes[UserSettingsService.AppearanceSettingsService.AppThemeBackgroundImageHorizontalAlignment]; UpdateSelectedResource(); @@ -87,7 +87,7 @@ private void SelectBackgroundImage() { string[] extensions = [ - "BitmapFiles".GetLocalizedResource(), "*.bmp;*.dib", + Strings.BitmapFiles.GetLocalizedResource(), "*.bmp;*.dib", "JPEG", "*.jpg;*.jpeg;*.jpe;*.jfif", "GIF", "*.gif", "TIFF", "*.tif;*.tiff", @@ -120,13 +120,13 @@ private void UpdateSelectedResource() if (!AppThemeResources.Any(p => p.BackgroundColor == themeBackgroundColor)) { // Remove current value before adding a new one - if (AppThemeResources.Last().Name == "Custom".GetLocalizedResource()) + if (AppThemeResources.Last().Name == Strings.Custom.GetLocalizedResource()) AppThemeResources.Remove(AppThemeResources.Last()); var appThemeBackgroundColor = new AppThemeResourceItem { BackgroundColor = themeBackgroundColor, - Name = "Custom".GetLocalizedResource(), + Name = Strings.Custom.GetLocalizedResource(), }; AppThemeResources.Add(appThemeBackgroundColor); diff --git a/src/Files.App/ViewModels/Settings/DevToolsViewModel.cs b/src/Files.App/ViewModels/Settings/DevToolsViewModel.cs index b284fd9b1238..f6491e22bf25 100644 --- a/src/Files.App/ViewModels/Settings/DevToolsViewModel.cs +++ b/src/Files.App/ViewModels/Settings/DevToolsViewModel.cs @@ -89,8 +89,8 @@ public string IDEName public DevToolsViewModel() { // Open in IDE options - OpenInIDEOptions.Add(OpenInIDEOption.GitRepos, "GitRepos".GetLocalizedResource()); - OpenInIDEOptions.Add(OpenInIDEOption.AllLocations, "AllLocations".GetLocalizedResource()); + OpenInIDEOptions.Add(OpenInIDEOption.GitRepos, Strings.GitRepos.GetLocalizedResource()); + OpenInIDEOptions.Add(OpenInIDEOption.AllLocations, Strings.AllLocations.GetLocalizedResource()); SelectedOpenInIDEOption = OpenInIDEOptions[DevToolsSettingsService.OpenInIDEOption]; IDEPath = DevToolsSettingsService.IDEPath; diff --git a/src/Files.App/ViewModels/Settings/GeneralViewModel.cs b/src/Files.App/ViewModels/Settings/GeneralViewModel.cs index a5b6a4621f48..14f49ce7d186 100644 --- a/src/Files.App/ViewModels/Settings/GeneralViewModel.cs +++ b/src/Files.App/ViewModels/Settings/GeneralViewModel.cs @@ -107,8 +107,8 @@ public GeneralViewModel() PagesOnStartupList.CollectionChanged += PagesOnStartupList_CollectionChanged; // ShellPaneArrangement - ShellPaneArrangementTypes.Add(ShellPaneArrangement.Horizontal, "Horizontal".GetLocalizedResource()); - ShellPaneArrangementTypes.Add(ShellPaneArrangement.Vertical, "Vertical".GetLocalizedResource()); + ShellPaneArrangementTypes.Add(ShellPaneArrangement.Horizontal, Strings.Horizontal.GetLocalizedResource()); + ShellPaneArrangementTypes.Add(ShellPaneArrangement.Vertical, Strings.Vertical.GetLocalizedResource()); SelectedShellPaneArrangementType = ShellPaneArrangementTypes[UserSettingsService.GeneralSettingsService.ShellPaneArrangementOption]; InitStartupSettingsRecentFoldersFlyout(); @@ -146,14 +146,14 @@ private void AddDateTimeOptions() private void InitStartupSettingsRecentFoldersFlyout() { - var recentsItem = new MenuFlyoutSubItemViewModel("JumpListRecentGroupHeader".GetLocalizedResource()); - recentsItem.Items.Add(new MenuFlyoutItemViewModel("Home".GetLocalizedResource()) + var recentsItem = new MenuFlyoutSubItemViewModel(Strings.JumpListRecentGroupHeader.GetLocalizedResource()); + recentsItem.Items.Add(new MenuFlyoutItemViewModel(Strings.Home.GetLocalizedResource()) { Command = AddPageCommand, CommandParameter = "Home", - Tooltip = "Home".GetLocalizedResource() + Tooltip = Strings.Home.GetLocalizedResource() }); - recentsItem.Items.Add(new MenuFlyoutItemViewModel("Browse".GetLocalizedResource()) { Command = AddPageCommand }); + recentsItem.Items.Add(new MenuFlyoutItemViewModel(Strings.Browse.GetLocalizedResource()) { Command = AddPageCommand }); } private void PagesOnStartupList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) @@ -359,7 +359,7 @@ private async Task AddPageAsync(string path = null) } public string DateFormatSample - => string.Format("DateFormatSample".GetLocalizedResource(), DateFormats[SelectedDateTimeFormatIndex].Sample1, DateFormats[SelectedDateTimeFormatIndex].Sample2); + => string.Format(Strings.DateFormatSample.GetLocalizedResource(), DateFormats[SelectedDateTimeFormatIndex].Sample1, DateFormats[SelectedDateTimeFormatIndex].Sample2); private DispatcherQueue dispatcherQueue; diff --git a/src/Files.App/ViewModels/UserControls/Previews/ArchivePreviewViewModel.cs b/src/Files.App/ViewModels/UserControls/Previews/ArchivePreviewViewModel.cs index 11973a69e260..bd4268930d40 100644 --- a/src/Files.App/ViewModels/UserControls/Previews/ArchivePreviewViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Previews/ArchivePreviewViewModel.cs @@ -51,7 +51,7 @@ public override async Task> LoadPreviewAndDetailsAsync() folderCount = (int)zipFile.FilesCount - fileCount; - string propertyItemCount = "DetailsArchiveItems".GetLocalizedFormatResource(zipFile.FilesCount, fileCount, folderCount); + string propertyItemCount = Strings.DetailsArchiveItems.GetLocalizedFormatResource(zipFile.FilesCount, fileCount, folderCount); details.Add(GetFileProperty("PropertyItemCount", propertyItemCount)); details.Add(GetFileProperty("PropertyUncompressedSize", totalSize.ToLongSizeString())); diff --git a/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs b/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs index a8e19fce4998..1b05c93886fe 100644 --- a/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/SidebarViewModel.cs @@ -403,25 +403,25 @@ private void Section_PropertyChanged(object? sender, PropertyChangedEventArgs e) { switch (section.Text) { - case var text when text == "Pinned".GetLocalizedResource(): + case var text when text == Strings.Pinned.GetLocalizedResource(): UserSettingsService.GeneralSettingsService.IsPinnedSectionExpanded = section.IsExpanded; break; - case var text when text == "SidebarLibraries".GetLocalizedResource(): + case var text when text == Strings.SidebarLibraries.GetLocalizedResource(): UserSettingsService.GeneralSettingsService.IsLibrarySectionExpanded = section.IsExpanded; break; - case var text when text == "Drives".GetLocalizedResource(): + case var text when text == Strings.Drives.GetLocalizedResource(): UserSettingsService.GeneralSettingsService.IsDriveSectionExpanded = section.IsExpanded; break; - case var text when text == "SidebarCloudDrives".GetLocalizedResource(): + case var text when text == Strings.SidebarCloudDrives.GetLocalizedResource(): UserSettingsService.GeneralSettingsService.IsCloudDriveSectionExpanded = section.IsExpanded; break; - case var text when text == "Network".GetLocalizedResource(): + case var text when text == Strings.Network.GetLocalizedResource(): UserSettingsService.GeneralSettingsService.IsNetworkSectionExpanded = section.IsExpanded; break; - case var text when text == "WSL".GetLocalizedResource(): + case var text when text == Strings.WSL.GetLocalizedResource(): UserSettingsService.GeneralSettingsService.IsWslSectionExpanded = section.IsExpanded; break; - case var text when text == "FileTags".GetLocalizedResource(): + case var text when text == Strings.FileTags.GetLocalizedResource(): UserSettingsService.GeneralSettingsService.IsFileTagsSectionExpanded = section.IsExpanded; break; } @@ -449,7 +449,7 @@ private async Task CreateSectionAsync(SectionType sectionType) { case SectionType.Home: { - section = BuildSection("Home".GetLocalizedResource(), sectionType, new ContextMenuOptions { IsLocationItem = true }, true); + section = BuildSection(Strings.Home.GetLocalizedResource(), sectionType, new ContextMenuOptions { IsLocationItem = true }, true); section.Path = "Home"; section.Icon = new BitmapImage(new Uri(Constants.FluentIconsPaths.HomeIcon)); section.IsHeader = true; @@ -464,7 +464,7 @@ private async Task CreateSectionAsync(SectionType sectionType) break; } - section = BuildSection("Pinned".GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false); + section = BuildSection(Strings.Pinned.GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false); icon = new BitmapImage(new Uri(Constants.FluentIconsPaths.StarIcon)); section.IsHeader = true; section.IsExpanded = UserSettingsService.GeneralSettingsService.IsPinnedSectionExpanded; @@ -478,7 +478,7 @@ private async Task CreateSectionAsync(SectionType sectionType) { break; } - section = BuildSection("SidebarLibraries".GetLocalizedResource(), sectionType, new ContextMenuOptions { IsLibrariesHeader = true, ShowHideSection = true }, false); + section = BuildSection(Strings.SidebarLibraries.GetLocalizedResource(), sectionType, new ContextMenuOptions { IsLibrariesHeader = true, ShowHideSection = true }, false); iconIdex = Constants.ImageRes.Libraries; section.IsHeader = true; section.IsExpanded = UserSettingsService.GeneralSettingsService.IsLibrarySectionExpanded; @@ -492,7 +492,7 @@ private async Task CreateSectionAsync(SectionType sectionType) { break; } - section = BuildSection("Drives".GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false); + section = BuildSection(Strings.Drives.GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false); iconIdex = Constants.ImageRes.ThisPC; section.IsHeader = true; section.IsExpanded = UserSettingsService.GeneralSettingsService.IsDriveSectionExpanded; @@ -506,7 +506,7 @@ private async Task CreateSectionAsync(SectionType sectionType) { break; } - section = BuildSection("SidebarCloudDrives".GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false); + section = BuildSection(Strings.SidebarCloudDrives.GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false); icon = new BitmapImage(new Uri(Constants.FluentIconsPaths.CloudDriveIcon)); section.IsHeader = true; section.IsExpanded = UserSettingsService.GeneralSettingsService.IsCloudDriveSectionExpanded; @@ -520,7 +520,7 @@ private async Task CreateSectionAsync(SectionType sectionType) { break; } - section = BuildSection("Network".GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false); + section = BuildSection(Strings.Network.GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false); iconIdex = Constants.ImageRes.Network; section.IsHeader = true; section.IsExpanded = UserSettingsService.GeneralSettingsService.IsNetworkSectionExpanded; @@ -534,7 +534,7 @@ private async Task CreateSectionAsync(SectionType sectionType) { break; } - section = BuildSection("WSL".GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false); + section = BuildSection(Strings.WSL.GetLocalizedResource(), sectionType, new ContextMenuOptions { ShowHideSection = true }, false); icon = new BitmapImage(new Uri(Constants.WslIconsPaths.GenericIcon)); section.IsHeader = true; section.IsExpanded = UserSettingsService.GeneralSettingsService.IsWslSectionExpanded; @@ -548,7 +548,7 @@ private async Task CreateSectionAsync(SectionType sectionType) { break; } - section = BuildSection("FileTags".GetLocalizedResource(), sectionType, new ContextMenuOptions { IsTagsHeader = true, ShowHideSection = true }, false); + section = BuildSection(Strings.FileTags.GetLocalizedResource(), sectionType, new ContextMenuOptions { IsTagsHeader = true, ShowHideSection = true }, false); icon = new BitmapImage(new Uri(Constants.FluentIconsPaths.FileTagsIcon)); section.IsHeader = true; section.IsExpanded = UserSettingsService.GeneralSettingsService.IsFileTagsSectionExpanded; @@ -896,7 +896,7 @@ private void OpenProperties(CommandBarFlyout menu) ItemPath = locationItem.Path, ItemNameRaw = locationItem.Text, PrimaryItemAttribute = StorageItemTypes.Folder, - ItemType = "Folder".GetLocalizedResource(), + ItemType = Strings.Folder.GetLocalizedResource(), }; if (!string.Equals(locationItem.Path, Constants.UserEnvironmentPaths.RecycleBinPath, StringComparison.OrdinalIgnoreCase)) @@ -973,7 +973,7 @@ private List GetLocationItemMenuItems(INavigatio }.Build(), new ContextMenuFlyoutItemViewModel() { - Text = "PinFolderToSidebar".GetLocalizedResource(), + Text = Strings.PinFolderToSidebar.GetLocalizedResource(), ThemedIconModel = new ThemedIconModel() { ThemedIconStyle = "App.ThemedIcons.FavoritePin", @@ -983,7 +983,7 @@ private List GetLocationItemMenuItems(INavigatio }, new ContextMenuFlyoutItemViewModel() { - Text = "UnpinFolderFromSidebar".GetLocalizedResource(), + Text = Strings.UnpinFolderFromSidebar.GetLocalizedResource(), ThemedIconModel = new ThemedIconModel() { ThemedIconStyle = "App.ThemedIcons.FavoritePinRemove", @@ -993,27 +993,27 @@ private List GetLocationItemMenuItems(INavigatio }, new ContextMenuFlyoutItemViewModel() { - Text = "ReorderSidebarItemsDialogText".GetLocalizedResource(), + Text = Strings.ReorderSidebarItemsDialogText.GetLocalizedResource(), Glyph = "\uE8D8", Command = ReorderItemsCommand, ShowItem = isPinnedItem || item.Section is SectionType.Pinned }, new ContextMenuFlyoutItemViewModel() { - Text = string.Format("SideBarHideSectionFromSideBar/Text".GetLocalizedResource(), rightClickedItem.Text), + Text = string.Format(Strings.SideBarHideSectionFromSideBar_Text.GetLocalizedResource(), rightClickedItem.Text), Glyph = "\uE77A", Command = HideSectionCommand, ShowItem = options.ShowHideSection }, new ContextMenuFlyoutItemViewModel() { - Text = "Eject".GetLocalizedResource(), + Text = Strings.Eject.GetLocalizedResource(), Command = EjectDeviceCommand, ShowItem = options.ShowEjectDevice }, new ContextMenuFlyoutItemViewModel() { - Text = "Properties".GetLocalizedResource(), + Text = Strings.Properties.GetLocalizedResource(), ThemedIconModel = new ThemedIconModel() { ThemedIconStyle = "App.ThemedIcons.Properties", @@ -1040,7 +1040,7 @@ private List GetLocationItemMenuItems(INavigatio }, new ContextMenuFlyoutItemViewModel() { - Text = "Loading".GetLocalizedResource(), + Text = Strings.Loading.GetLocalizedResource(), Glyph = "\xE712", Items = [], ID = "ItemOverflow", @@ -1050,7 +1050,7 @@ private List GetLocationItemMenuItems(INavigatio }, new ContextMenuFlyoutItemViewModel() { - Text = "ManageTags".GetLocalizedResource(), + Text = Strings.ManageTags.GetLocalizedResource(), Glyph = "\uE8EC", Command = Commands.OpenSettings, CommandParameter = new SettingsNavigationParams() { PageKind = SettingsPageKind.TagsPage }, @@ -1091,7 +1091,7 @@ private async Task HandleLocationItemDragOverAsync(LocationItem locationItem, It } else { - var captionText = "PinFolderToSidebar".GetLocalizedResource(); + var captionText = Strings.PinFolderToSidebar.GetLocalizedResource(); CompleteDragEventArgs(rawEvent, captionText, DataPackageOperation.Move); } } @@ -1111,41 +1111,41 @@ private async Task HandleLocationItemDragOverAsync(LocationItem locationItem, It DataPackageOperation operationType; if (locationItem.Path.StartsWith(Constants.UserEnvironmentPaths.RecycleBinPath, StringComparison.Ordinal)) { - captionText = string.Format("MoveToFolderCaptionText".GetLocalizedResource(), locationItem.Text); + captionText = string.Format(Strings.MoveToFolderCaptionText.GetLocalizedResource(), locationItem.Text); // Some applications such as Edge can't raise the drop event by the Move flag (#14008), so we set the Copy flag as well. operationType = DataPackageOperation.Move | DataPackageOperation.Copy; } else if (rawEvent.Modifiers.HasFlag(DragDropModifiers.Alt) || rawEvent.Modifiers.HasFlag(DragDropModifiers.Control | DragDropModifiers.Shift)) { - captionText = string.Format("LinkToFolderCaptionText".GetLocalizedResource(), locationItem.Text); + captionText = string.Format(Strings.LinkToFolderCaptionText.GetLocalizedResource(), locationItem.Text); operationType = DataPackageOperation.Link; } else if (rawEvent.Modifiers.HasFlag(DragDropModifiers.Control)) { - captionText = string.Format("CopyToFolderCaptionText".GetLocalizedResource(), locationItem.Text); + captionText = string.Format(Strings.CopyToFolderCaptionText.GetLocalizedResource(), locationItem.Text); operationType = DataPackageOperation.Copy; } else if (rawEvent.Modifiers.HasFlag(DragDropModifiers.Shift)) { - captionText = string.Format("MoveToFolderCaptionText".GetLocalizedResource(), locationItem.Text); + captionText = string.Format(Strings.MoveToFolderCaptionText.GetLocalizedResource(), locationItem.Text); // Some applications such as Edge can't raise the drop event by the Move flag (#14008), so we set the Copy flag as well. operationType = DataPackageOperation.Move | DataPackageOperation.Copy; } else if (storageItems.Any(x => x.Item is ZipStorageFile || x.Item is ZipStorageFolder) || ZipStorageFolder.IsZipPath(locationItem.Path)) { - captionText = string.Format("CopyToFolderCaptionText".GetLocalizedResource(), locationItem.Text); + captionText = string.Format(Strings.CopyToFolderCaptionText.GetLocalizedResource(), locationItem.Text); operationType = DataPackageOperation.Copy; } else if (locationItem.IsDefaultLocation || storageItems.AreItemsInSameDrive(locationItem.Path)) { - captionText = string.Format("MoveToFolderCaptionText".GetLocalizedResource(), locationItem.Text); + captionText = string.Format(Strings.MoveToFolderCaptionText.GetLocalizedResource(), locationItem.Text); // Some applications such as Edge can't raise the drop event by the Move flag (#14008), so we set the Copy flag as well. operationType = DataPackageOperation.Move | DataPackageOperation.Copy; } else { - captionText = string.Format("CopyToFolderCaptionText".GetLocalizedResource(), locationItem.Text); + captionText = string.Format(Strings.CopyToFolderCaptionText.GetLocalizedResource(), locationItem.Text); operationType = DataPackageOperation.Copy; } CompleteDragEventArgs(rawEvent, captionText, operationType); @@ -1163,7 +1163,7 @@ private async Task HandleDriveItemDragOverAsync(DriveItem driveItem, ItemDragOve var storageItems = await Utils.Storage.FilesystemHelpers.GetDraggedStorageItems(args.DroppedItem); var hasStorageItems = storageItems.Any(); - if ("Unknown".GetLocalizedResource().Equals(driveItem.SpaceText, StringComparison.OrdinalIgnoreCase) || + if (Strings.Unknown.GetLocalizedResource().Equals(driveItem.SpaceText, StringComparison.OrdinalIgnoreCase) || (hasStorageItems && storageItems.AreItemsAlreadyInFolder(driveItem.Path))) { args.RawEvent.AcceptedOperation = DataPackageOperation.None; @@ -1178,29 +1178,29 @@ private async Task HandleDriveItemDragOverAsync(DriveItem driveItem, ItemDragOve DataPackageOperation operationType; if (args.RawEvent.Modifiers.HasFlag(DragDropModifiers.Alt) || args.RawEvent.Modifiers.HasFlag(DragDropModifiers.Control | DragDropModifiers.Shift)) { - captionText = string.Format("LinkToFolderCaptionText".GetLocalizedResource(), driveItem.Text); + captionText = string.Format(Strings.LinkToFolderCaptionText.GetLocalizedResource(), driveItem.Text); operationType = DataPackageOperation.Link; } else if (args.RawEvent.Modifiers.HasFlag(DragDropModifiers.Control)) { - captionText = string.Format("CopyToFolderCaptionText".GetLocalizedResource(), driveItem.Text); + captionText = string.Format(Strings.CopyToFolderCaptionText.GetLocalizedResource(), driveItem.Text); operationType = DataPackageOperation.Copy; } else if (args.RawEvent.Modifiers.HasFlag(DragDropModifiers.Shift)) { - captionText = string.Format("MoveToFolderCaptionText".GetLocalizedResource(), driveItem.Text); + captionText = string.Format(Strings.MoveToFolderCaptionText.GetLocalizedResource(), driveItem.Text); // Some applications such as Edge can't raise the drop event by the Move flag (#14008), so we set the Copy flag as well. operationType = DataPackageOperation.Move | DataPackageOperation.Copy; } else if (storageItems.AreItemsInSameDrive(driveItem.Path)) { - captionText = string.Format("MoveToFolderCaptionText".GetLocalizedResource(), driveItem.Text); + captionText = string.Format(Strings.MoveToFolderCaptionText.GetLocalizedResource(), driveItem.Text); // Some applications such as Edge can't raise the drop event by the Move flag (#14008), so we set the Copy flag as well. operationType = DataPackageOperation.Move | DataPackageOperation.Copy; } else { - captionText = string.Format("CopyToFolderCaptionText".GetLocalizedResource(), driveItem.Text); + captionText = string.Format(Strings.CopyToFolderCaptionText.GetLocalizedResource(), driveItem.Text); operationType = DataPackageOperation.Copy; } CompleteDragEventArgs(args.RawEvent, captionText, operationType); @@ -1223,7 +1223,7 @@ private async Task HandleTagItemDragOverAsync(FileTagItem tagItem, ItemDragOverE else { args.RawEvent.DragUIOverride.IsCaptionVisible = true; - args.RawEvent.DragUIOverride.Caption = string.Format("LinkToFolderCaptionText".GetLocalizedResource(), tagItem.Text); + args.RawEvent.DragUIOverride.Caption = string.Format(Strings.LinkToFolderCaptionText.GetLocalizedResource(), tagItem.Text); args.RawEvent.AcceptedOperation = DataPackageOperation.Link; } } diff --git a/src/Files.App/ViewModels/UserControls/Widgets/FileTagsWidgetViewModel.cs b/src/Files.App/ViewModels/UserControls/Widgets/FileTagsWidgetViewModel.cs index 68dcb636b978..2969012c52e4 100644 --- a/src/Files.App/ViewModels/UserControls/Widgets/FileTagsWidgetViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Widgets/FileTagsWidgetViewModel.cs @@ -19,8 +19,8 @@ public sealed partial class FileTagsWidgetViewModel : BaseWidgetViewModel, IWidg public ObservableCollection Containers { get; } = []; public string WidgetName => nameof(FileTagsWidget); - public string WidgetHeader => "FileTags".GetLocalizedResource(); - public string AutomationProperties => "FileTags".GetLocalizedResource(); + public string WidgetHeader => Strings.FileTags.GetLocalizedResource(); + public string AutomationProperties => Strings.FileTags.GetLocalizedResource(); public bool IsWidgetSettingEnabled => UserSettingsService.GeneralSettingsService.ShowFileTagsWidget; public bool ShowMenuFlyout => false; public MenuFlyoutItem? MenuFlyoutItem => null; @@ -108,14 +108,14 @@ public override List GetItemMenuItems(WidgetCard }.Build(), new() { - Text = "OpenWith".GetLocalizedResource(), + Text = Strings.OpenWith.GetLocalizedResource(), ThemedIconModel = new() { ThemedIconStyle = "App.ThemedIcons.OpenWith" }, Tag = "OpenWithPlaceholder", ShowItem = !isFolder }, new() { - Text = "OpenFileLocation".GetLocalizedResource(), + Text = Strings.OpenFileLocation.GetLocalizedResource(), Glyph = "\uED25", Command = OpenFileLocationCommand, CommandParameter = item, @@ -123,7 +123,7 @@ public override List GetItemMenuItems(WidgetCard }, new() { - Text = "PinFolderToSidebar".GetLocalizedResource(), + Text = Strings.PinFolderToSidebar.GetLocalizedResource(), ThemedIconModel = new() { ThemedIconStyle = "App.ThemedIcons.FavoritePin" }, Command = PinToSidebarCommand, CommandParameter = item, @@ -131,7 +131,7 @@ public override List GetItemMenuItems(WidgetCard }, new() { - Text = "UnpinFolderFromSidebar".GetLocalizedResource(), + Text = Strings.UnpinFolderFromSidebar.GetLocalizedResource(), ThemedIconModel = new() { ThemedIconStyle = "App.ThemedIcons.FavoritePinRemove" }, Command = UnpinFromSidebarCommand, CommandParameter = item, @@ -139,13 +139,13 @@ public override List GetItemMenuItems(WidgetCard }, new() { - Text = "SendTo".GetLocalizedResource(), + Text = Strings.SendTo.GetLocalizedResource(), Tag = "SendToPlaceholder", ShowItem = UserSettingsService.GeneralSettingsService.ShowSendToMenu }, new() { - Text = "Properties".GetLocalizedResource(), + Text = Strings.Properties.GetLocalizedResource(), ThemedIconModel = new() { ThemedIconStyle = "App.ThemedIcons.Properties" }, Command = OpenPropertiesCommand, CommandParameter = item, @@ -164,7 +164,7 @@ public override List GetItemMenuItems(WidgetCard }, new() { - Text = "Loading".GetLocalizedResource(), + Text = Strings.Loading.GetLocalizedResource(), Glyph = "\xE712", Items = [], ID = "ItemOverflow", @@ -193,7 +193,7 @@ private void ExecuteOpenPropertiesCommand(WidgetCardItem? item) ItemPath = (item.Item as WidgetFileTagCardItem)?.Path ?? string.Empty, ItemNameRaw = (item.Item as WidgetFileTagCardItem)?.Name ?? string.Empty, PrimaryItemAttribute = StorageItemTypes.Folder, - ItemType = "Folder".GetLocalizedResource(), + ItemType = Strings.Folder.GetLocalizedResource(), }; FilePropertiesHelpers.OpenPropertiesWindow(listedItem, ContentPageContext.ShellPage!); diff --git a/src/Files.App/ViewModels/UserControls/Widgets/NetworkLocationsWidgetViewModel.cs b/src/Files.App/ViewModels/UserControls/Widgets/NetworkLocationsWidgetViewModel.cs index 17fecdd081dc..f83055442384 100644 --- a/src/Files.App/ViewModels/UserControls/Widgets/NetworkLocationsWidgetViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Widgets/NetworkLocationsWidgetViewModel.cs @@ -20,14 +20,14 @@ public sealed partial class NetworkLocationsWidgetViewModel : BaseWidgetViewMode public ObservableCollection Items { get; } = []; public string WidgetName => nameof(NetworkLocationsWidget); - public string AutomationProperties => "NetworkLocations".GetLocalizedResource(); - public string WidgetHeader => "NetworkLocations".GetLocalizedResource(); + public string AutomationProperties => Strings.NetworkLocations.GetLocalizedResource(); + public string WidgetHeader => Strings.NetworkLocations.GetLocalizedResource(); public bool IsWidgetSettingEnabled => UserSettingsService.GeneralSettingsService.ShowNetworkLocationsWidget; public bool ShowMenuFlyout => true; public MenuFlyoutItem? MenuFlyoutItem => new() { Icon = new FontIcon() { Glyph = "\uE710" }, - Text = "DrivesWidgetOptionsFlyoutMapNetDriveMenuItem/Text".GetLocalizedResource(), + Text = Strings.DrivesWidgetOptionsFlyoutMapNetDriveMenuItem_Text.GetLocalizedResource(), Command = MapNetworkDriveCommand }; diff --git a/src/Files.App/ViewModels/UserControls/Widgets/QuickAccessWidgetViewModel.cs b/src/Files.App/ViewModels/UserControls/Widgets/QuickAccessWidgetViewModel.cs index 557743712287..a7c70b4a2936 100644 --- a/src/Files.App/ViewModels/UserControls/Widgets/QuickAccessWidgetViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Widgets/QuickAccessWidgetViewModel.cs @@ -22,8 +22,8 @@ public sealed partial class QuickAccessWidgetViewModel : BaseWidgetViewModel, IW public ObservableCollection Items { get; } = []; public string WidgetName => nameof(QuickAccessWidget); - public string AutomationProperties => "QuickAccess".GetLocalizedResource(); - public string WidgetHeader => "QuickAccess".GetLocalizedResource(); + public string AutomationProperties => Strings.QuickAccess.GetLocalizedResource(); + public string WidgetHeader => Strings.QuickAccess.GetLocalizedResource(); public bool IsWidgetSettingEnabled => UserSettingsService.GeneralSettingsService.ShowQuickAccessWidget; public bool ShowMenuFlyout => false; public MenuFlyoutItem? MenuFlyoutItem => null; @@ -74,7 +74,7 @@ public override List GetItemMenuItems(WidgetCard }.Build(), new() { - Text = "PinFolderToSidebar".GetLocalizedResource(), + Text = Strings.PinFolderToSidebar.GetLocalizedResource(), ThemedIconModel = new() { ThemedIconStyle = "App.ThemedIcons.FavoritePin" }, Command = PinToSidebarCommand, CommandParameter = item, @@ -82,7 +82,7 @@ public override List GetItemMenuItems(WidgetCard }, new() { - Text = "UnpinFolderFromSidebar".GetLocalizedResource(), + Text = Strings.UnpinFolderFromSidebar.GetLocalizedResource(), ThemedIconModel = new() { ThemedIconStyle = "App.ThemedIcons.FavoritePinRemove" }, Command = UnpinFromSidebarCommand, CommandParameter = item, @@ -90,13 +90,13 @@ public override List GetItemMenuItems(WidgetCard }, new() { - Text = "SendTo".GetLocalizedResource(), + Text = Strings.SendTo.GetLocalizedResource(), Tag = "SendToPlaceholder", ShowItem = UserSettingsService.GeneralSettingsService.ShowSendToMenu }, new() { - Text = "Properties".GetLocalizedResource(), + Text = Strings.Properties.GetLocalizedResource(), ThemedIconModel = new() { ThemedIconStyle = "App.ThemedIcons.Properties" }, Command = OpenPropertiesCommand, CommandParameter = item @@ -114,7 +114,7 @@ public override List GetItemMenuItems(WidgetCard }, new() { - Text = "Loading".GetLocalizedResource(), + Text = Strings.Loading.GetLocalizedResource(), Glyph = "\xE712", Items = [], ID = "ItemOverflow", @@ -277,7 +277,7 @@ private void ExecuteOpenPropertiesCommand(WidgetFolderCardItem? item) ItemPath = item.Item.Path, ItemNameRaw = item.Item.Text, PrimaryItemAttribute = StorageItemTypes.Folder, - ItemType = "Folder".GetLocalizedResource(), + ItemType = Strings.Folder.GetLocalizedResource(), }; if (!string.Equals(item.Item.Path, Constants.UserEnvironmentPaths.RecycleBinPath, StringComparison.OrdinalIgnoreCase)) diff --git a/src/Files.App/ViewModels/UserControls/Widgets/RecentFilesWidgetViewModel.cs b/src/Files.App/ViewModels/UserControls/Widgets/RecentFilesWidgetViewModel.cs index 8a8a398c9ca1..bec67ac1f66d 100644 --- a/src/Files.App/ViewModels/UserControls/Widgets/RecentFilesWidgetViewModel.cs +++ b/src/Files.App/ViewModels/UserControls/Widgets/RecentFilesWidgetViewModel.cs @@ -25,8 +25,8 @@ public sealed partial class RecentFilesWidgetViewModel : BaseWidgetViewModel, IW public ObservableCollection Items { get; } = []; public string WidgetName => nameof(RecentFilesWidget); - public string AutomationProperties => "RecentFiles".GetLocalizedResource(); - public string WidgetHeader => "RecentFiles".GetLocalizedResource(); + public string AutomationProperties => Strings.RecentFiles.GetLocalizedResource(); + public string WidgetHeader => Strings.RecentFiles.GetLocalizedResource(); public bool IsWidgetSettingEnabled => UserSettingsService.GeneralSettingsService.ShowRecentFilesWidget; public bool ShowMenuFlyout => false; public MenuFlyoutItem? MenuFlyoutItem => null; @@ -78,39 +78,39 @@ public override List GetItemMenuItems(WidgetCard { new() { - Text = "OpenWith".GetLocalizedResource(), + Text = Strings.OpenWith.GetLocalizedResource(), ThemedIconModel = new() { ThemedIconStyle = "App.ThemedIcons.OpenWith" }, Tag = "OpenWithPlaceholder", }, new() { - Text = "RecentItemRemove/Text".GetLocalizedResource(), + Text = Strings.RecentItemRemove_Text.GetLocalizedResource(), Glyph = "\uE738", Command = RemoveRecentItemCommand, CommandParameter = item }, new() { - Text = "RecentItemClearAll/Text".GetLocalizedResource(), + Text = Strings.RecentItemClearAll_Text.GetLocalizedResource(), Glyph = "\uE74D", Command = ClearAllItemsCommand }, new() { - Text = "OpenFileLocation".GetLocalizedResource(), + Text = Strings.OpenFileLocation.GetLocalizedResource(), Glyph = "\uED25", Command = OpenFileLocationCommand, CommandParameter = item }, new() { - Text = "SendTo".GetLocalizedResource(), + Text = Strings.SendTo.GetLocalizedResource(), Tag = "SendToPlaceholder", ShowItem = UserSettingsService.GeneralSettingsService.ShowSendToMenu }, new() { - Text = "Properties".GetLocalizedResource(), + Text = Strings.Properties.GetLocalizedResource(), ThemedIconModel = new() { ThemedIconStyle = "App.ThemedIcons.Properties" }, Command = OpenPropertiesCommand, CommandParameter = item @@ -122,7 +122,7 @@ public override List GetItemMenuItems(WidgetCard }, new() { - Text = "Loading".GetLocalizedResource(), + Text = Strings.Loading.GetLocalizedResource(), Glyph = "\xE712", Items = [], ID = "ItemOverflow", @@ -332,8 +332,8 @@ private void ExecuteOpenPropertiesCommand(RecentItem? item) { ContentDialog dialog = new() { - Title = "CannotAccessPropertiesTitle".GetLocalizedResource(), - Content = "CannotAccessPropertiesContent".GetLocalizedResource(), + Title = Strings.CannotAccessPropertiesTitle.GetLocalizedResource(), + Content = Strings.CannotAccessPropertiesContent.GetLocalizedResource(), PrimaryButtonText = "Ok".GetLocalizedResource() };