Skip to content

Commit f77259a

Browse files
authored
Fix: Fixed issue where items in the Tags widget were not localized (#13149)
1 parent 9c34c31 commit f77259a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+132
-90
lines changed

src/Files.App.Storage/NativeStorage/NativeFile.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ namespace Files.App.Storage.NativeStorage
1515
/// <inheritdoc cref="IFile"/>
1616
public class NativeFile : NativeStorable<FileInfo>, ILocatableFile, IModifiableFile, IFileExtended, INestedFile
1717
{
18-
public NativeFile(FileInfo fileInfo)
19-
: base(fileInfo)
18+
public NativeFile(FileInfo fileInfo, string? name = null)
19+
: base(fileInfo, name)
2020
{
2121
}
2222

23-
public NativeFile(string path)
24-
: this(new FileInfo(path))
23+
public NativeFile(string path, string? name = null)
24+
: this(new FileInfo(path), name)
2525
{
2626
}
2727

src/Files.App.Storage/NativeStorage/NativeFolder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ namespace Files.App.Storage.NativeStorage
2222
/// <inheritdoc cref="IFolder"/>
2323
public class NativeFolder : NativeStorable<DirectoryInfo>, ILocatableFolder, IModifiableFolder, IMutableFolder, IFolderExtended, INestedFolder, IDirectCopy, IDirectMove
2424
{
25-
public NativeFolder(DirectoryInfo directoryInfo)
26-
: base(directoryInfo)
25+
public NativeFolder(DirectoryInfo directoryInfo, string? name = null)
26+
: base(directoryInfo, name)
2727
{
2828
}
2929

30-
public NativeFolder(string path)
31-
: this(new DirectoryInfo(path))
30+
public NativeFolder(string path, string? name = null)
31+
: this(new DirectoryInfo(path), name)
3232
{
3333
}
3434

src/Files.App.Storage/NativeStorage/NativeStorable.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ public abstract class NativeStorable<TStorage> : ILocatableStorable, INestedStor
1717
protected readonly TStorage storage;
1818

1919
/// <inheritdoc/>
20-
public virtual string Path { get; protected set; }
20+
public string Path { get; protected set; }
2121

2222
/// <inheritdoc/>
23-
public virtual string Name { get; protected set; }
23+
public string Name { get; protected set; }
2424

2525
/// <inheritdoc/>
2626
public virtual string Id { get; }
2727

28-
protected NativeStorable(TStorage storage)
28+
protected NativeStorable(TStorage storage, string? name = null)
2929
{
3030
this.storage = storage;
3131
Path = storage.FullName;
32-
Name = storage.Name;
32+
Name = name ?? storage.Name;
3333
Id = storage.FullName;
3434
}
3535

src/Files.App.Storage/NativeStorage/NativeStorageService.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
// Licensed under the MIT License. See the LICENSE.
33

44
using Files.Core.Storage;
5-
using Files.Core.Storage.LocatableStorage;
5+
using Files.Shared.Helpers;
6+
using System;
67
using System.IO;
78
using System.Threading;
89
using System.Threading.Tasks;
10+
using Windows.Storage;
911

1012
namespace Files.App.Storage.NativeStorage
1113
{
@@ -22,12 +24,31 @@ public Task<IFile> GetFileAsync(string id, CancellationToken cancellationToken =
2224
}
2325

2426
/// <inheritdoc/>
25-
public Task<IFolder> GetFolderAsync(string id, CancellationToken cancellationToken = default)
27+
public async Task<IFolder> GetFolderAsync(string id, CancellationToken cancellationToken = default)
2628
{
2729
if (!Directory.Exists(id))
2830
throw new DirectoryNotFoundException();
2931

30-
return Task.FromResult<IFolder>(new NativeFolder(id));
32+
// A special folder should use the localized name
33+
if (PathHelpers.IsSpecialFolder(id))
34+
{
35+
var storageFolder = await TryGetStorageFolderAsync(id);
36+
return new NativeFolder(id, storageFolder?.DisplayName);
37+
}
38+
39+
return new NativeFolder(id);
40+
41+
async Task<StorageFolder?> TryGetStorageFolderAsync(string path)
42+
{
43+
try
44+
{
45+
return await StorageFolder.GetFolderFromPathAsync(path);
46+
}
47+
catch (Exception)
48+
{
49+
return null;
50+
}
51+
}
3152
}
3253
}
3354
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using System.IO;
56

67
namespace Files.App.Actions

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using Files.App.Utils.Shell;
4+
using Files.Shared.Helpers;
55

66
namespace Files.App.Actions
77
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using Files.App.Utils.Shell;
4+
using Files.Shared.Helpers;
55

66
namespace Files.App.Actions
77
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using Files.App.Utils.Shell;
4+
using Files.Shared.Helpers;
55

66
namespace Files.App.Actions
77
{

src/Files.App/Actions/Content/PlayAllAction.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
5+
46
namespace Files.App.Actions
57
{
68
internal class PlayAllAction : ObservableObject, IAction

src/Files.App/Actions/Content/Run/RunAsAdminAction.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
5+
46
namespace Files.App.Actions
57
{
68
internal class RunAsAdminAction : ObservableObject, IAction

src/Files.App/Actions/Content/Run/RunAsAnotherUserAction.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
5+
46
namespace Files.App.Actions
57
{
68
internal class RunAsAnotherUserAction : ObservableObject, IAction

src/Files.App/Actions/Content/Run/RunWithPowershellAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using Files.App.Utils.Shell;
4+
using Files.Shared.Helpers;
55

66
namespace Files.App.Actions
77
{

src/Files.App/Data/Factories/PropertiesNavigationViewItemFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Files.Core.Helpers;
55
using Microsoft.UI.Xaml;
66
using Windows.Storage;
7+
using Files.Shared.Helpers;
78

89
namespace Files.App.Data.Factories
910
{

src/Files.App/Data/Items/ListedItem.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using Files.App.Utils.Cloud;
54
using Files.App.ViewModels.Properties;
6-
using Files.Core.Helpers;
7-
using Files.Core.ViewModels.FileTags;
5+
using Files.Shared.Helpers;
86
using FluentFTP;
9-
using Microsoft.UI;
107
using Microsoft.UI.Xaml;
11-
using Microsoft.UI.Xaml.Media;
128
using Microsoft.UI.Xaml.Media.Imaging;
139
using System.IO;
1410
using System.Text;

src/Files.App/Data/Models/ItemViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using Files.App.ViewModels.Previews;
55
using Files.Core.Services.SizeProvider;
6+
using Files.Shared.Helpers;
67
using LibGit2Sharp;
78
using Microsoft.Extensions.Logging;
89
using Microsoft.UI.Xaml.Data;

src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License. See the LICENSE.
33

44
using Files.App.ViewModels.Properties;
5+
using Files.Shared.Helpers;
56

67
namespace Files.App.Data.Models
78
{

src/Files.App/Data/Models/SidebarPinnedModel.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using CommunityToolkit.WinUI;
5-
using Files.App.Data.Items;
6-
using Files.App.Services;
74
using Files.App.UserControls.Widgets;
85
using System.Collections.Specialized;
96
using System.IO;

src/Files.App/Helpers/MenuFlyout/ContextFlyoutItemHelper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.App.ViewModels.LayoutModes;
5+
using Files.Shared.Helpers;
46
using Files.App.Helpers.ContextFlyouts;
57
using Files.App.ViewModels.LayoutModes;
68
using Microsoft.UI.Xaml.Controls;

src/Files.App/Helpers/MenuFlyout/ShellContextMenuHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using CommunityToolkit.WinUI.UI;
55
using Files.App.Helpers.ContextFlyouts;
6+
using Files.Shared.Helpers;
67
using Microsoft.UI.Input;
78
using Microsoft.UI.Xaml;
89
using Microsoft.UI.Xaml.Controls;

src/Files.App/Helpers/Navigation/NavigationHelpers.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using CommunityToolkit.Mvvm.DependencyInjection;
5-
using Files.App.Extensions;
6-
using Files.App.Utils;
7-
using Files.App.Utils.Shell;
8-
using Files.App.ViewModels;
9-
using Files.App.Views;
10-
using Files.Core.Helpers;
11-
using Files.Core.Services.Settings;
12-
using Files.Shared;
4+
using Files.Shared.Helpers;
135
using Microsoft.Extensions.Logging;
14-
using System;
15-
using System.Collections.Generic;
16-
using System.Linq;
17-
using System.Threading.Tasks;
186
using Windows.Storage;
197
using Windows.Storage.Search;
208
using Windows.System;

src/Files.App/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using Microsoft.UI.Dispatching;
56
using Microsoft.UI.Xaml;
67
using Microsoft.Windows.AppLifecycle;

src/Files.App/Utils/Archives/ArchiveHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Licensed under the MIT License. See the LICENSE.
33

44
using Files.App.Dialogs;
5-
using Files.App.Utils.Archives;
65
using Files.App.ViewModels.Dialogs;
6+
using Files.Shared.Helpers;
77
using Microsoft.UI.Xaml.Controls;
88
using System.IO;
99
using System.Text;

src/Files.App/Utils/Shell/LaunchHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using Microsoft.Extensions.Logging;
56
using System.IO;
67
using System.Text.RegularExpressions;

src/Files.App/Utils/Storage/Enumerators/UniversalStorageEnumerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using Microsoft.Extensions.Logging;
56
using Microsoft.UI.Xaml.Media.Imaging;
67
using System.IO;

src/Files.App/Utils/Storage/Enumerators/Win32StorageEnumerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License. See the LICENSE.
33

44
using Files.Core.Services.SizeProvider;
5+
using Files.Shared.Helpers;
56
using Microsoft.UI.Xaml.Media.Imaging;
67
using System.IO;
78
using Vanara.PInvoke;

src/Files.App/Utils/Storage/Helpers/FileOperationsHelpers.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using Microsoft.Extensions.Logging;
56
using Microsoft.Win32;
67
using System.Collections.Concurrent;

src/Files.App/Utils/Storage/Helpers/FileThumbnailHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using Windows.Storage;
56
using Windows.Storage.FileProperties;
67

src/Files.App/Utils/Storage/Helpers/StorageHelpers.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using System.Runtime.InteropServices;
56
using Windows.Storage;
67
using Windows.Storage.FileProperties;

src/Files.App/Utils/Storage/Operations/FilesystemOperations.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using Microsoft.UI.Xaml.Controls;
56
using System.IO;
67
using System.Text;

src/Files.App/Utils/Storage/StorageItems/NativeStorageFile.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using System.IO;
56
using System.Runtime.InteropServices;
67
using System.Runtime.InteropServices.WindowsRuntime;

src/Files.App/Utils/Storage/StorageItems/ZipStorageFile.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using SevenZip;
56
using System.IO;
67
using System.Runtime.InteropServices.WindowsRuntime;

src/Files.App/Utils/Storage/StorageItems/ZipStorageFolder.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using SevenZip;
5-
using SQLitePCL;
6-
using System;
76
using System.Collections.Concurrent;
87
using System.IO;
98
using System.Runtime.InteropServices.WindowsRuntime;

src/Files.App/ViewModels/Properties/Items/FileProperties.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright(c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Helpers;
45
using Microsoft.UI.Dispatching;
56
using System.IO;
67

src/Files.App/ViewModels/UserControls/PreviewPaneViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using Files.App.UserControls.FilePreviews;
55
using Files.App.ViewModels.Previews;
6+
using Files.Shared.Helpers;
67
using Microsoft.UI.Xaml;
78
using Microsoft.UI.Xaml.Controls;
89
using System.Windows.Input;

src/Files.App/ViewModels/UserControls/ToolbarViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License. See the LICENSE.
33

44
using CommunityToolkit.WinUI.UI;
5+
using Files.Shared.Helpers;
56
using Microsoft.UI.Dispatching;
67
using Microsoft.UI.Xaml;
78
using Microsoft.UI.Xaml.Controls;

0 commit comments

Comments
 (0)