Skip to content

Commit eb52dcf

Browse files
authored
Added string for "New tab" that appears in path (#1239)
1 parent eaf3041 commit eb52dcf

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

Files/Interacts/Interaction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public async void SetAsLockscreenBackgroundItem_Click(object sender, RoutedEvent
9999

100100
public void OpenNewTab()
101101
{
102-
instanceTabsView.AddNewTab(typeof(ModernShellPage), "New tab");
102+
instanceTabsView.AddNewTab(typeof(ModernShellPage), ResourceController.GetTranslation("NewTab"));
103103
}
104104

105105
public async void OpenInNewWindowItem_Click(object sender, RoutedEventArgs e)

Files/Navigation/NavigationActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private static void SelectSidebarItemFromPath(Type incomingSourcePageType = null
7676
if (incomingSourcePageType == typeof(YourHome) && incomingSourcePageType != null)
7777
{
7878
App.CurrentInstance.SidebarSelectedItem = App.sideBarItems.First(x => x.Path.Equals("Home"));
79-
App.CurrentInstance.NavigationToolbar.PathControlDisplayText = "New tab";
79+
App.CurrentInstance.NavigationToolbar.PathControlDisplayText = ResourceController.GetTranslation("NewTab");
8080
}
8181
}
8282
}

Files/UserControls/ModernNavigationToolbar.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@ public async void CheckPathInput(ItemViewModel instance, string CurrentInput)
209209
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.HomeItems.isEnabled = false;
210210
//(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.ShareItems.isEnabled = false;
211211

212-
if (CurrentInput.Equals("Home", StringComparison.OrdinalIgnoreCase) || CurrentInput.Equals("New tab", StringComparison.OrdinalIgnoreCase))
212+
if (CurrentInput.Equals("Home", StringComparison.OrdinalIgnoreCase) || CurrentInput.Equals(ResourceController.GetTranslation("NewTab"), StringComparison.OrdinalIgnoreCase))
213213
{
214-
App.CurrentInstance.FilesystemViewModel.WorkingDirectory = "New tab";
215-
App.CurrentInstance.ContentFrame.Navigate(typeof(YourHome), "New tab", new SuppressNavigationTransitionInfo());
214+
App.CurrentInstance.FilesystemViewModel.WorkingDirectory = ResourceController.GetTranslation("NewTab");
215+
App.CurrentInstance.ContentFrame.Navigate(typeof(YourHome), ResourceController.GetTranslation("NewTab"), new SuppressNavigationTransitionInfo());
216216
}
217217
else
218218
{
@@ -305,7 +305,7 @@ private void VisiblePath_LostFocus(object sender, RoutedEventArgs e)
305305
private void PathViewInteract_ItemClick(object sender, ItemClickEventArgs e)
306306
{
307307
var itemTappedPath = (e.ClickedItem as PathBoxItem).Path.ToString();
308-
if (itemTappedPath == "Home" || itemTappedPath == "New tab")
308+
if (itemTappedPath == "Home" || itemTappedPath == ResourceController.GetTranslation("NewTab"))
309309
return;
310310

311311
App.CurrentInstance.ContentFrame.Navigate(AppSettings.GetLayoutType(), itemTappedPath); // navigate to folder

Files/UserControls/SidebarControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private void Sidebar_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sende
9696

9797
if (ItemPath.Equals("Home", StringComparison.OrdinalIgnoreCase)) // Home item
9898
{
99-
App.CurrentInstance.ContentFrame.Navigate(typeof(YourHome), "New tab", new SuppressNavigationTransitionInfo());
99+
App.CurrentInstance.ContentFrame.Navigate(typeof(YourHome), ResourceController.GetTranslation("NewTab"), new SuppressNavigationTransitionInfo());
100100

101101
return; // cancel so it doesn't try to Navigate to a path
102102
}

Files/Views/InstanceTabsView.xaml.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
9292
}
9393
catch (Exception)
9494
{
95-
AddNewTab(typeof(ModernShellPage), "New tab");
95+
AddNewTab(typeof(ModernShellPage), ResourceController.GetTranslation("NewTab"));
9696
}
9797
}
9898
else if (string.IsNullOrEmpty(navArgs))
9999
{
100-
AddNewTab(typeof(ModernShellPage), "New tab");
100+
AddNewTab(typeof(ModernShellPage), ResourceController.GetTranslation("NewTab"));
101101
}
102102
else
103103
{
@@ -168,7 +168,7 @@ public async void AddNewTab(Type t, string path)
168168
tabLocationHeader = "OneDrive";
169169
fontIconSource.Glyph = "\xE753";
170170
}
171-
else if (path == "New tab")
171+
else if (path == ResourceController.GetTranslation("NewTab"))
172172
{
173173
tabLocationHeader = ResourceController.GetTranslation("NewTab");
174174
fontIconSource.Glyph = "\xE737";
@@ -213,7 +213,7 @@ public async void AddNewTab(Type t, string path)
213213
// Invalid path, open new tab instead (explorer opens Documents when it fails)
214214
Debug.WriteLine($"Invalid path \"{path}\" in InstanceTabsView.xaml.cs\\AddNewTab");
215215

216-
path = "New tab";
216+
path = ResourceController.GetTranslation("NewTab");
217217
tabLocationHeader = ResourceController.GetTranslation("NewTab");
218218
fontIconSource.Glyph = "\xE737";
219219
}
@@ -259,7 +259,7 @@ public async void SetSelectedTabInfo(string text, string currentPathForTabIcon =
259259
tabLocationHeader = ResourceController.GetTranslation("SidebarSettings/Text");
260260
fontIconSource.Glyph = "\xE713";
261261
}
262-
else if (currentPathForTabIcon == null && text == "New tab")
262+
else if (currentPathForTabIcon == null && text == ResourceController.GetTranslation("NewTab"))
263263
{
264264
tabLocationHeader = ResourceController.GetTranslation("NewTab");
265265
fontIconSource.Glyph = "\xE737";
@@ -516,7 +516,7 @@ private async void TabStrip_TabCloseRequested(Microsoft.UI.Xaml.Controls.TabView
516516

517517
private void AddTabButton_Click(object sender, RoutedEventArgs e)
518518
{
519-
AddNewTab(typeof(ModernShellPage), "New tab");
519+
AddNewTab(typeof(ModernShellPage), ResourceController.GetTranslation("NewTab"));
520520
}
521521

522522
public static T GetCurrentSelectedTabInstance<T>()

Files/Views/ModernShellPage.xaml.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public ModernShellPage()
3434
}
3535

3636
App.CurrentInstance = this as IShellPage;
37-
App.CurrentInstance.NavigationToolbar.PathControlDisplayText = "New tab";
37+
App.CurrentInstance.NavigationToolbar.PathControlDisplayText = ResourceController.GetTranslation("NewTab");
3838
App.CurrentInstance.NavigationToolbar.CanGoBack = false;
3939
App.CurrentInstance.NavigationToolbar.CanGoForward = false;
4040
}
@@ -100,12 +100,6 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
100100
ItemDisplayFrame.Navigate(typeof(YourHome), NavParams, new SuppressNavigationTransitionInfo());
101101
SidebarControl.SelectedSidebarItem = App.sideBarItems[0];
102102
break;
103-
104-
case "New tab":
105-
ItemDisplayFrame.Navigate(typeof(YourHome), NavParams, new SuppressNavigationTransitionInfo());
106-
SidebarControl.SelectedSidebarItem = App.sideBarItems[0];
107-
break;
108-
109103
case "Desktop":
110104
NavigationPath = AppSettings.DesktopPath;
111105
SidebarControl.SelectedSidebarItem = App.sideBarItems.First(x => x.Path.Equals(AppSettings.DesktopPath, StringComparison.OrdinalIgnoreCase));
@@ -147,7 +141,12 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
147141
break;
148142

149143
default:
150-
if (NavParams[0] >= 'A' && NavParams[0] <= 'Z' && NavParams[1] == ':')
144+
if (NavParams == ResourceController.GetTranslation("NewTab"))
145+
{
146+
ItemDisplayFrame.Navigate(typeof(YourHome), NavParams, new SuppressNavigationTransitionInfo());
147+
SidebarControl.SelectedSidebarItem = App.sideBarItems[0];
148+
}
149+
else if (NavParams[0] >= 'A' && NavParams[0] <= 'Z' && NavParams[1] == ':')
151150
{
152151
NavigationPath = NavParams;
153152
SidebarControl.SelectedSidebarItem = AppSettings.DrivesManager.Drives.First(x => x.Path.ToString().Equals($"{NavParams[0]}:\\", StringComparison.OrdinalIgnoreCase));

0 commit comments

Comments
 (0)