Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Files.App/Utils/Cloud/CloudDriveSyncStatusUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class CloudDriveSyncStatusUI : ObservableObject

public bool LoadSyncStatus { get; }

public string SyncStatusString { get; } = "CloudDriveSyncStatus_Unknown".GetLocalizedResource();
public string SyncStatusString { get; } = Strings.CloudDriveSyncStatus_Unknown.GetLocalizedResource();

public CloudDriveSyncStatusUI()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Utils/FileTags/FileTagsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public static async void WriteFileTag(string filePath, string[] tag)
{
ContentDialog dialog = new()
{
Title = "ErrorApplyingTagTitle".GetLocalizedResource(),
Content = "ErrorApplyingTagContent".GetLocalizedResource(),
Title = Strings.ErrorApplyingTagTitle.GetLocalizedResource(),
Content = Strings.ErrorApplyingTagContent.GetLocalizedResource(),
PrimaryButtonText = "Ok".GetLocalizedResource()
};

Expand Down
18 changes: 9 additions & 9 deletions src/Files.App/Utils/Git/GitHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,9 @@ public static async Task PullOriginAsync(string? repositoryPath)
{
var viewModel = new DynamicDialogViewModel()
{
TitleText = "GitError".GetLocalizedResource(),
SubtitleText = "PullTimeoutError".GetLocalizedResource(),
CloseButtonText = "Close".GetLocalizedResource(),
TitleText = Strings.GitError.GetLocalizedResource(),
SubtitleText = Strings.PullTimeoutError.GetLocalizedResource(),
CloseButtonText = Strings.Close.GetLocalizedResource(),
DynamicButtons = DynamicDialogButtons.Cancel
};
var dialog = new DynamicDialog(viewModel);
Expand Down Expand Up @@ -570,7 +570,7 @@ public static async Task RequireGitAuthenticationAsync()
var expiresIn = codeJsonContent.RootElement.GetProperty("expires_in").GetInt32();

var loginCTS = new CancellationTokenSource();
var viewModel = new GitHubLoginDialogViewModel(userCode, "ConnectGitHubDescription".GetLocalizedResource(), loginCTS);
var viewModel = new GitHubLoginDialogViewModel(userCode, Strings.ConnectGitHubDescription.GetLocalizedResource(), loginCTS);

var dialog = _dialogService.GetDialog(viewModel);
var loginDialogTask = dialog.TryShowAsync();
Expand Down Expand Up @@ -621,7 +621,7 @@ public static async Task RequireGitAuthenticationAsync()
GIT_RESOURCE_USERNAME,
token);

viewModel.Subtitle = "AuthorizationSucceded".GetLocalizedResource();
viewModel.Subtitle = Strings.AuthorizationSucceded.GetLocalizedResource();
viewModel.LoginConfirmed = true;
}
catch (Exception ex)
Expand Down Expand Up @@ -687,10 +687,10 @@ public static GitItemModel GetGitInformationForItem(Repository repository, strin
{
changeKindHumanized = changeKind switch
{
ChangeKind.Added => "Added".GetLocalizedResource(),
ChangeKind.Deleted => "Deleted".GetLocalizedResource(),
ChangeKind.Modified => "Modified".GetLocalizedResource(),
ChangeKind.Untracked => "Untracked".GetLocalizedResource(),
ChangeKind.Added => Strings.Added.GetLocalizedResource(),
ChangeKind.Deleted => Strings.Deleted.GetLocalizedResource(),
ChangeKind.Modified => Strings.Modified.GetLocalizedResource(),
ChangeKind.Untracked => Strings.Untracked.GetLocalizedResource(),
_ => null,
};
}
Expand Down
26 changes: 13 additions & 13 deletions src/Files.App/Utils/Library/LibraryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,20 +255,20 @@ public async Task<LibraryLocationItem> UpdateLibrary(string libraryPath, string
{
if (string.IsNullOrWhiteSpace(name))
{
return (false, "ErrorInputEmpty".GetLocalizedResource());
return (false, Strings.ErrorInputEmpty.GetLocalizedResource());
}
if (FilesystemHelpers.ContainsRestrictedCharacters(name))
{
return (false, "ErrorNameInputRestrictedCharacters".GetLocalizedResource());
return (false, Strings.ErrorNameInputRestrictedCharacters.GetLocalizedResource());
}
if (FilesystemHelpers.ContainsRestrictedFileName(name))
{
return (false, "ErrorNameInputRestricted".GetLocalizedResource());
return (false, Strings.ErrorNameInputRestricted.GetLocalizedResource());
}
if (Libraries.Any((item) => string.Equals(name, item.Text, StringComparison.OrdinalIgnoreCase) ||
string.Equals(name, Path.GetFileNameWithoutExtension(item.Path), StringComparison.OrdinalIgnoreCase)))
{
return (false, "CreateLibraryErrorAlreadyExists".GetLocalizedResource());
return (false, Strings.CreateLibraryErrorAlreadyExists.GetLocalizedResource());
}
return (true, string.Empty);
}
Expand All @@ -277,10 +277,10 @@ public static async Task ShowRestoreDefaultLibrariesDialogAsync()
{
var dialog = new DynamicDialog(new DynamicDialogViewModel
{
TitleText = "DialogRestoreLibrariesTitleText".GetLocalizedResource(),
SubtitleText = "DialogRestoreLibrariesSubtitleText".GetLocalizedResource(),
PrimaryButtonText = "Restore".GetLocalizedResource(),
CloseButtonText = "Cancel".GetLocalizedResource(),
TitleText = Strings.DialogRestoreLibrariesTitleText.GetLocalizedResource(),
SubtitleText = Strings.DialogRestoreLibrariesSubtitleText.GetLocalizedResource(),
PrimaryButtonText = Strings.Restore.GetLocalizedResource(),
CloseButtonText = Strings.Cancel.GetLocalizedResource(),
PrimaryButtonAction = async (vm, e) =>
{
await ContextMenu.InvokeVerb("restorelibraries", ShellLibraryItem.LibrariesPath);
Expand All @@ -303,7 +303,7 @@ public static async Task ShowCreateNewLibraryDialogAsync()
{
var inputText = new TextBox
{
PlaceholderText = "FolderWidgetCreateNewLibraryInputPlaceholderText".GetLocalizedResource()
PlaceholderText = Strings.FolderWidgetCreateNewLibraryInputPlaceholderText.GetLocalizedResource()
};
var tipText = new TextBlock
{
Expand All @@ -328,10 +328,10 @@ public static async Task ShowCreateNewLibraryDialogAsync()
}
}
},
TitleText = "FolderWidgetCreateNewLibraryDialogTitleText".GetLocalizedResource(),
SubtitleText = "SideBarCreateNewLibrary/Text".GetLocalizedResource(),
PrimaryButtonText = "Create".GetLocalizedResource(),
CloseButtonText = "Cancel".GetLocalizedResource(),
TitleText = Strings.FolderWidgetCreateNewLibraryDialogTitleText.GetLocalizedResource(),
SubtitleText = Strings.SideBarCreateNewLibrary_Text.GetLocalizedResource(),
PrimaryButtonText = Strings.Create.GetLocalizedResource(),
CloseButtonText = Strings.Cancel.GetLocalizedResource(),
PrimaryButtonAction = async (vm, e) =>
{
var (result, reason) = App.LibraryManager.CanCreateLibrary(inputText.Text);
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Utils/Shell/ShellHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public static string GetShellNameFromPath(string shPath)
{
return shPath switch
{
"Home" => "Home".GetLocalizedResource(),
Constants.UserEnvironmentPaths.RecycleBinPath => "RecycleBin".GetLocalizedResource(),
Constants.UserEnvironmentPaths.NetworkFolderPath => "Network".GetLocalizedResource(),
Constants.UserEnvironmentPaths.MyComputerPath => "ThisPC".GetLocalizedResource(),
"Home" => Strings.Home.GetLocalizedResource(),
Constants.UserEnvironmentPaths.RecycleBinPath => Strings.RecycleBin.GetLocalizedResource(),
Constants.UserEnvironmentPaths.NetworkFolderPath => Strings.Network.GetLocalizedResource(),
Constants.UserEnvironmentPaths.MyComputerPath => Strings.ThisPC.GetLocalizedResource(),
_ => shPath
};
}
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Utils/StatusCenter/StatusCenterItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public StatusCenterItem(
AnimatedIconState = "NormalOff";
SpeedGraphValues = [];
CancelCommand = new RelayCommand(ExecuteCancelCommand);
Message = "ProcessingItems".GetLocalizedResource();
Message = Strings.ProcessingItems.GetLocalizedResource();
Source = source;
Destination = destination;

Expand Down Expand Up @@ -296,15 +296,15 @@ private void ReportProgress(StatusCenterItemProgressModel value)
{
Message =
$"{string.Format(
"StatusCenter_ProcessedItems_Header".GetLocalizedResource(),
Strings.StatusCenter_ProcessedItems_Header.GetLocalizedResource(),
value.ProcessedItemsCount,
value.ItemsCount)}";
}
else
{
Message =
$"{string.Format(
"StatusCenter_ProcessedSize_Header".GetLocalizedResource(),
Strings.StatusCenter_ProcessedSize_Header.GetLocalizedResource(),
value.ProcessedSize.ToSizeString(),
value.TotalSize.ToSizeString())}";
}
Expand Down Expand Up @@ -393,7 +393,7 @@ public void ExecuteCancelCommand()
IsCancelable = false;
IsExpanded = false;
IsSpeedAndProgressAvailable = false;
Header = $"{"Canceling".GetLocalizedResource()} - {Header}";
Header = $"{Strings.Canceling.GetLocalizedResource()} - {Header}";
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Utils/Storage/Collection/GroupedCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ private void GroupedCollection_PropertyChanged(object sender, PropertyChangedEve
{
Model.CountText = string.Format(
Count > 1
? "GroupItemsCount_Plural".GetLocalizedResource()
: "GroupItemsCount_Singular".GetLocalizedResource(),
? Strings.GroupItemsCount_Plural.GetLocalizedResource()
: Strings.GroupItemsCount_Singular.GetLocalizedResource(),
Count);
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/Files.App/Utils/Storage/Collection/GroupingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static (Action<GroupedCollection<ListedItem>>, Action<GroupedCollection<L
{
ListedItem first = x.FirstOrDefault();
x.Model.ShowCountTextBelow = true;
x.Model.Text = first.FileTagsUI?.FirstOrDefault()?.Name ?? "Untagged".GetLocalizedResource();
x.Model.Text = first.FileTagsUI?.FirstOrDefault()?.Name ?? Strings.Untagged.GetLocalizedResource();
//x.Model.Icon = first.FileTagsUI?.FirstOrDefault()?.Color;
}, null),

Expand Down Expand Up @@ -141,7 +141,7 @@ public static (string key, string text, string range, int index) GetGroupSizeInf
lastSizeStr = sizeGp.sizeText;
}

return ("0", "ItemSizeText_Tiny".GetLocalizedResource(), $"{"0 B".ConvertSizeAbbreviation()} - {lastSizeStr}", 0);
return ("0", Strings.ItemSizeText_Tiny.GetLocalizedResource(), $"{"0 B".ConvertSizeAbbreviation()} - {lastSizeStr}", 0);
}

public static string GetGroupSizeKey(long size)
Expand All @@ -159,11 +159,11 @@ public static string GetGroupSizeKey(long size)

private static readonly (long size, string text, string sizeText)[] sizeGroups =
[
(5000000000, "ItemSizeText_Huge".GetLocalizedResource(), "5 GiB".ConvertSizeAbbreviation()),
(1000000000, "ItemSizeText_VeryLarge".GetLocalizedResource(), "1 GiB".ConvertSizeAbbreviation()),
(128000000, "ItemSizeText_Large".GetLocalizedResource(), "128 MiB".ConvertSizeAbbreviation()),
(1000000, "ItemSizeText_Medium".GetLocalizedResource(), "1 MiB".ConvertSizeAbbreviation()),
(16000, "ItemSizeText_Small".GetLocalizedResource(), "16 KiB".ConvertSizeAbbreviation()),
(5000000000, Strings.ItemSizeText_Huge.GetLocalizedResource(), "5 GiB".ConvertSizeAbbreviation()),
(1000000000, Strings.ItemSizeText_VeryLarge.GetLocalizedResource(), "1 GiB".ConvertSizeAbbreviation()),
(128000000, Strings.ItemSizeText_Large.GetLocalizedResource(), "128 MiB".ConvertSizeAbbreviation()),
(1000000, Strings.ItemSizeText_Medium.GetLocalizedResource(), "1 MiB".ConvertSizeAbbreviation()),
(16000, Strings.ItemSizeText_Small.GetLocalizedResource(), "16 KiB".ConvertSizeAbbreviation()),
];

private static string GetFolderName(string path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class Win32StorageEnumerator
private static readonly ISizeProvider folderSizeProvider = Ioc.Default.GetService<ISizeProvider>();
private static readonly IStorageCacheService fileListCache = Ioc.Default.GetRequiredService<IStorageCacheService>();

private static readonly string folderTypeTextLocalized = "Folder".GetLocalizedResource();
private static readonly string folderTypeTextLocalized = Strings.Folder.GetLocalizedResource();

public static async Task<List<ListedItem>> ListEntries(
string path,
Expand Down Expand Up @@ -112,7 +112,7 @@ private static IEnumerable<ListedItem> EnumAdsForPath(string itemPath, ListedIte

public static ListedItem GetAlternateStream((string Name, long Size) ads, ListedItem main)
{
string itemType = "File".GetLocalizedResource();
string itemType = Strings.File.GetLocalizedResource();
string itemFileExtension = null;

if (ads.Name.Contains('.'))
Expand Down Expand Up @@ -250,7 +250,7 @@ CancellationToken cancellationToken

long itemSizeBytes = findData.GetSize();
var itemSize = itemSizeBytes.ToSizeString();
string itemType = "File".GetLocalizedResource();
string itemType = Strings.File.GetLocalizedResource();
string itemFileExtension = null;

if (findData.cFileName.Contains('.'))
Expand Down Expand Up @@ -289,7 +289,7 @@ CancellationToken cancellationToken
ItemDateModifiedReal = itemModifiedDate,
ItemDateAccessedReal = itemLastAccessDate,
ItemDateCreatedReal = itemCreatedDate,
ItemType = "Shortcut".GetLocalizedResource(),
ItemType = Strings.Shortcut.GetLocalizedResource(),
ItemPath = itemPath,
FileSize = itemSize,
FileSizeBytes = itemSizeBytes,
Expand All @@ -311,7 +311,7 @@ CancellationToken cancellationToken
ItemDateModifiedReal = itemModifiedDate,
ItemDateAccessedReal = itemLastAccessDate,
ItemDateCreatedReal = itemCreatedDate,
ItemType = "Shortcut".GetLocalizedResource(),
ItemType = Strings.Shortcut.GetLocalizedResource(),
ItemPath = itemPath,
FileSize = itemSize,
FileSizeBytes = itemSizeBytes,
Expand Down Expand Up @@ -342,7 +342,7 @@ CancellationToken cancellationToken
ItemDateModifiedReal = itemModifiedDate,
ItemDateAccessedReal = itemLastAccessDate,
ItemDateCreatedReal = itemCreatedDate,
ItemType = isUrl ? "ShortcutWebLinkFileType".GetLocalizedResource() : "Shortcut".GetLocalizedResource(),
ItemType = isUrl ? Strings.ShortcutWebLinkFileType.GetLocalizedResource() : Strings.Shortcut.GetLocalizedResource(),
ItemPath = itemPath,
FileSize = itemSize,
FileSizeBytes = itemSizeBytes,
Expand All @@ -368,7 +368,7 @@ CancellationToken cancellationToken
ItemDateModifiedReal = itemModifiedDate,
ItemDateAccessedReal = itemLastAccessDate,
ItemDateCreatedReal = itemCreatedDate,
ItemType = isUrl ? "ShortcutWebLinkFileType".GetLocalizedResource() : "Shortcut".GetLocalizedResource(),
ItemType = isUrl ? Strings.ShortcutWebLinkFileType.GetLocalizedResource() : Strings.Shortcut.GetLocalizedResource(),
ItemPath = itemPath,
FileSize = itemSize,
FileSizeBytes = itemSizeBytes,
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Utils/Storage/Helpers/DriveHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public static async Task<bool> CheckEmptyDrive(string? drivePath)
return false;

var ejectButton = await DialogDisplayHelper.ShowDialogAsync(
"InsertDiscDialog/Title".GetLocalizedResource(),
string.Format("InsertDiscDialog/Text".GetLocalizedResource(), matchingDrive.Path),
"InsertDiscDialog/OpenDriveButton".GetLocalizedResource(),
"Close".GetLocalizedResource());
Strings.InsertDiscDialog_Title.GetLocalizedResource(),
string.Format(Strings.InsertDiscDialog_Text.GetLocalizedResource(), matchingDrive.Path),
Strings.InsertDiscDialog_OpenDriveButton.GetLocalizedResource(),
Strings.Close.GetLocalizedResource());
if (ejectButton)
EjectDeviceAsync(matchingDrive.Path);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static void OpenPropertiesWindow(object item, IShellPage associatedInstan
propertiesWindow.SystemBackdrop = new AppSystemBackdrop(true);

var appWindow = propertiesWindow.AppWindow;
appWindow.Title = "Properties".GetLocalizedResource();
appWindow.Title = Strings.Properties.GetLocalizedResource();
appWindow.TitleBar.ExtendsContentIntoTitleBar = true;
appWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent;
appWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
Expand Down
10 changes: 5 additions & 5 deletions src/Files.App/Utils/Storage/Helpers/StorageFileExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public static async Task<List<PathBoxItem>> GetDirectoryPathComponentsWithDispla
foreach (var item in pathBoxItems)
{
if (item.Path == "Home")
item.Title = "Home".GetLocalizedResource();
item.Title = Strings.Home.GetLocalizedResource();
else
{
BaseStorageFolder folder = await FilesystemTasks.Wrap(() => DangerousGetFolderFromPathAsync(item.Path));
Expand Down Expand Up @@ -287,23 +287,23 @@ private static PathBoxItem GetPathItem(string component, string path)
if (component.StartsWith(Constants.UserEnvironmentPaths.RecycleBinPath, StringComparison.Ordinal))
{
// Handle the recycle bin: use the localized folder name
title = "RecycleBin".GetLocalizedResource();
title = Strings.RecycleBin.GetLocalizedResource();
}
else if (component.StartsWith(Constants.UserEnvironmentPaths.MyComputerPath, StringComparison.Ordinal))
{
title = "ThisPC".GetLocalizedResource();
title = Strings.ThisPC.GetLocalizedResource();
}
else if (component.StartsWith(Constants.UserEnvironmentPaths.NetworkFolderPath, StringComparison.Ordinal))
{
title = "Network".GetLocalizedResource();
title = Strings.Network.GetLocalizedResource();
}
else if (component.EndsWith(':'))
{
var drivesViewModel = Ioc.Default.GetRequiredService<DrivesViewModel>();

var drives = drivesViewModel.Drives.Cast<DriveItem>();
var drive = drives.FirstOrDefault(y => y.ItemType is NavigationControlItemType.Drive && y.Path.Contains(component, StringComparison.OrdinalIgnoreCase));
title = drive is not null ? drive.Text : string.Format("DriveWithLetter".GetLocalizedResource(), component);
title = drive is not null ? drive.Text : string.Format(Strings.DriveWithLetter.GetLocalizedResource(), component);
}
else
{
Expand Down
12 changes: 6 additions & 6 deletions src/Files.App/Utils/Storage/Operations/FilesystemHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public FilesystemHelpers(IShellPage associatedInstance, CancellationToken cancel
if (!IsValidForFilename(source.Name))
{
await DialogDisplayHelper.ShowDialogAsync(
"ErrorDialogThisActionCannotBeDone".GetLocalizedResource(),
"ErrorDialogNameNotAllowed".GetLocalizedResource());
Strings.ErrorDialogThisActionCannotBeDone.GetLocalizedResource(),
Strings.ErrorDialogNameNotAllowed.GetLocalizedResource());
return (ReturnResult.Failed, null);
}

Expand Down Expand Up @@ -547,8 +547,8 @@ public async Task<ReturnResult> RenameAsync(IStorageItemWithPath source, string
if (!IsValidForFilename(newName))
{
await DialogDisplayHelper.ShowDialogAsync(
"ErrorDialogThisActionCannotBeDone".GetLocalizedResource(),
"ErrorDialogNameNotAllowed".GetLocalizedResource());
Strings.ErrorDialogThisActionCannotBeDone.GetLocalizedResource(),
Strings.ErrorDialogNameNotAllowed.GetLocalizedResource());
return ReturnResult.Failed;
}

Expand All @@ -569,7 +569,7 @@ await DialogDisplayHelper.ShowDialogAsync(
UserSettingsService.FoldersSettingsService.ShowFileExtensionWarning
)
{
var yesSelected = await DialogDisplayHelper.ShowDialogAsync("Rename".GetLocalizedResource(), "RenameFileDialog/Text".GetLocalizedResource(), "Yes".GetLocalizedResource(), "No".GetLocalizedResource());
var yesSelected = await DialogDisplayHelper.ShowDialogAsync(Strings.Rename.GetLocalizedResource(), Strings.RenameFileDialog_Text.GetLocalizedResource(), Strings.Yes.GetLocalizedResource(), Strings.No.GetLocalizedResource());
if (yesSelected)
{
history = await filesystemOperations.RenameAsync(source, newName, collision, progress, cancellationToken);
Expand Down Expand Up @@ -877,7 +877,7 @@ public static string GetShortcutNamingPreference(string itemName)
var value = Registry.GetValue(keyName, "ShortcutNameTemplate", null);

if (value is null)
return string.Format("ShortcutCreateNewSuffix".GetLocalizedResource(), itemName) + ".lnk";
return string.Format(Strings.ShortcutCreateNewSuffix.GetLocalizedResource(), itemName) + ".lnk";
else
{
// Trim the quotes and the "%s" from the string
Expand Down
Loading
Loading