Skip to content

Code Quality: Enforced centralized Strings class in Files.App.Data #16941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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/Data/Commands/HotKey/HotKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ private static string GetLocalizedKey(string key)

private static string GetLocalizedNumPadKey(string key)
{
return "NumPadTypeName".GetLocalizedResource() + " " + key;
return Strings.NumPadTypeName.GetLocalizedResource() + " " + key;
}

private static string GetKeyCharacter(Forms.Keys key)
Expand Down
40 changes: 20 additions & 20 deletions src/Files.App/Data/Factories/AppThemeResourcesFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,102 +10,102 @@ public static class AppThemeResourceFactory
new AppThemeResourceItem
{
BackgroundColor = "#00000000", /* Transparent */
Name = "Default".GetLocalizedResource()
Name = Strings.Default.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#32FFB900", /* #FFB900 */
Name = "YellowGold".GetLocalizedResource()
Name = Strings.YellowGold.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#32F7630C", /* #F7630C */
Name = "OrangeBright".GetLocalizedResource()
Name = Strings.OrangeBright.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#32D13438", /* #D13438 */
Name = "BrickRed".GetLocalizedResource()
Name = Strings.BrickRed.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#32FF4343", /* #FF4343 */
Name = "ModRed".GetLocalizedResource()
Name = Strings.ModRed.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#32EA005E", /* #EA005E */
Name = "Red".GetLocalizedResource()
Name = Strings.Red.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#32EA005E", /* #EA005E */
Name = "RoseBright".GetLocalizedResource()
Name = Strings.RoseBright.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#320078D7", /* #0078D7 */
Name = "Blue".GetLocalizedResource()
Name = Strings.Blue.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#328764B8", /* #8764B8 */
Name = "IrisPastel".GetLocalizedResource()
Name = Strings.IrisPastel.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#32B146C2", /* #B146C2 */
Name = "VioletRedLight".GetLocalizedResource()
Name = Strings.VioletRedLight.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#320099BC", /* #0099BC */
Name = "CoolBlueBright".GetLocalizedResource()
Name = Strings.CoolBlueBright.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#3200B7C3", /* #00B7C3 */
Name = "Seafoam".GetLocalizedResource()
Name = Strings.Seafoam.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#3200B294", /* #00B294 */
Name = "MintLight".GetLocalizedResource()
Name = Strings.MintLight.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#327A7574", /* #7A7574 */
Name = "Gray".GetLocalizedResource()
Name = Strings.Gray.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#32107C10", /* #107C10 */
Name = "Green".GetLocalizedResource()
Name = Strings.Green.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#32767676", /* #767676 */
Name = "Overcast".GetLocalizedResource()
Name = Strings.Overcast.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#324C4A48", /* #4C4A48 */
Name = "Storm".GetLocalizedResource()
Name = Strings.Storm.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#3269797E", /* #69797E */
Name = "BlueGray".GetLocalizedResource()
Name = Strings.BlueGray.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#324A5459", /* #4A5459 */
Name = "GrayDark".GetLocalizedResource()
Name = Strings.GrayDark.GetLocalizedResource()
},
new AppThemeResourceItem
{
BackgroundColor = "#327E735F", /* #7E735F */
Name = "Camouflage".GetLocalizedResource()
Name = Strings.Camouflage.GetLocalizedResource()
}
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,49 @@ public static ObservableCollection<NavigationViewItemButtonStyleItem> Initialize

var generalItem = new NavigationViewItemButtonStyleItem()
{
Name = "General".GetLocalizedResource(),
Name = Strings.General.GetLocalizedResource(),
ItemType = PropertiesNavigationViewItemType.General,
ThemedIconStyle = (Style)Application.Current.Resources["App.ThemedIcons.Properties.General"],
};
var securityItem = new NavigationViewItemButtonStyleItem()
{
Name = "Security".GetLocalizedResource(),
Name = Strings.Security.GetLocalizedResource(),
ItemType = PropertiesNavigationViewItemType.Security,
ThemedIconStyle = (Style)Application.Current.Resources["App.ThemedIcons.Properties.Security"],
};
var hashesItem = new NavigationViewItemButtonStyleItem()
{
Name = "Hashes".GetLocalizedResource(),
Name = Strings.Hashes.GetLocalizedResource(),
ItemType = PropertiesNavigationViewItemType.Hashes,
ThemedIconStyle = (Style)Application.Current.Resources["App.ThemedIcons.Properties.Hashes"],
};
var shortcutItem = new NavigationViewItemButtonStyleItem()
{
Name = "Shortcut".GetLocalizedResource(),
Name = Strings.Shortcut.GetLocalizedResource(),
ItemType = PropertiesNavigationViewItemType.Shortcut,
ThemedIconStyle = (Style)Application.Current.Resources["App.ThemedIcons.Properties.Shortcut"],
};
var libraryItem = new NavigationViewItemButtonStyleItem()
{
Name = "Library".GetLocalizedResource(),
Name = Strings.Library.GetLocalizedResource(),
ItemType = PropertiesNavigationViewItemType.Library,
ThemedIconStyle = (Style)Application.Current.Resources["App.ThemedIcons.Properties.Library"],
};
var detailsItem = new NavigationViewItemButtonStyleItem()
{
Name = "Details".GetLocalizedResource(),
Name = Strings.Details.GetLocalizedResource(),
ItemType = PropertiesNavigationViewItemType.Details,
ThemedIconStyle = (Style)Application.Current.Resources["App.ThemedIcons.Properties.Info"],
};
var customizationItem = new NavigationViewItemButtonStyleItem()
{
Name = "Customization".GetLocalizedResource(),
Name = Strings.Customization.GetLocalizedResource(),
ItemType = PropertiesNavigationViewItemType.Customization,
ThemedIconStyle = (Style)Application.Current.Resources["App.ThemedIcons.Properties.CustomizeFolder"],
};
var compatibilityItem = new NavigationViewItemButtonStyleItem()
{
Name = "Compatibility".GetLocalizedResource(),
Name = Strings.Compatibility.GetLocalizedResource(),
ItemType = PropertiesNavigationViewItemType.Compatibility,
ThemedIconStyle = (Style)Application.Current.Resources["App.ThemedIcons.Properties.Compatability"],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,109 +28,109 @@ public static ObservableCollection<AccessMaskItem> Initialize(AccessControlEntry
new(current)
{
AccessMask = AccessMaskFlags.FullControl,
AccessMaskName = "SecurityFullControlLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityFullControlLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.Traverse,
AccessMaskName = "SecurityTraverseLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityTraverseLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.ExecuteFile,
AccessMaskName = "SecurityExecuteFileLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityExecuteFileLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.ListDirectory,
AccessMaskName = "SecurityListDirectoryLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityListDirectoryLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.ReadData,
AccessMaskName = "SecurityReadDataLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityReadDataLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.ReadAttributes,
AccessMaskName = "SecurityReadAttributesLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityReadAttributesLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.ReadExtendedAttributes,
AccessMaskName = "SecurityReadExtendedAttributesLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityReadExtendedAttributesLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.CreateFiles,
AccessMaskName = "SecurityCreateFilesLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityCreateFilesLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.CreateDirectories,
AccessMaskName = "SecurityCreateDirectoriesLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityCreateDirectoriesLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.WriteData,
AccessMaskName = "SecurityWriteDataLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityWriteDataLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.AppendData,
AccessMaskName = "SecurityAppendDataLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityAppendDataLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.WriteAttributes,
AccessMaskName = "SecurityWriteAttributesLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityWriteAttributesLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.WriteExtendedAttributes,
AccessMaskName = "SecurityWriteExtendedAttributesLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityWriteExtendedAttributesLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.DeleteSubdirectoriesAndFiles,
AccessMaskName = "SecurityDeleteSubdirectoriesAndFilesLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityDeleteSubdirectoriesAndFilesLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.Delete,
AccessMaskName = "Delete".GetLocalizedResource(),
AccessMaskName = Strings.Delete.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.ReadPermissions,
AccessMaskName = "SecurityReadPermissionsLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityReadPermissionsLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.ChangePermissions,
AccessMaskName = "SecurityChangePermissionsLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityChangePermissionsLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.TakeOwnership,
AccessMaskName = "SecurityTakeOwnershipLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityTakeOwnershipLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
}
];
Expand Down Expand Up @@ -160,42 +160,42 @@ public static ObservableCollection<AccessMaskItem> Initialize(AccessControlEntry
new(current)
{
AccessMask = AccessMaskFlags.FullControl,
AccessMaskName = "SecurityFullControlLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityFullControlLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.Modify,
AccessMaskName = "Modify".GetLocalizedResource(),
AccessMaskName = Strings.Modify.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.ReadAndExecute,
AccessMaskName = "SecurityReadAndExecuteLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityReadAndExecuteLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.ListDirectory,
AccessMaskName = "SecurityListDirectoryLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityListDirectoryLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.Read,
AccessMaskName = "SecurityReadLabel/Text".GetLocalizedResource(),
AccessMaskName = Strings.SecurityReadLabel_Text.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current)
{
AccessMask = AccessMaskFlags.Write,
AccessMaskName = "Write".GetLocalizedResource(),
AccessMaskName = Strings.Write.GetLocalizedResource(),
IsEditable = !isInherited
},
new(current, false)
{
AccessMaskName = "SecuritySpecialLabel/Text".GetLocalizedResource()
AccessMaskName = Strings.SecuritySpecialLabel_Text.GetLocalizedResource()
}
];

Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static void LoadMenuFlyoutItem(
{
var menuLayoutSubItem = new ContextMenuFlyoutItemViewModel()
{
Text = "ShowMoreOptions".GetLocalizedResource(),
Text = Strings.ShowMoreOptions.GetLocalizedResource(),
Glyph = "\xE712",
};
LoadMenuFlyoutItem(menuLayoutSubItem.Items, contextMenu, overflowItems, cancellationToken, showIcons);
Expand Down Expand Up @@ -335,7 +335,7 @@ x.Tag is Win32ContextMenuItem menuItem &&
overflowItem.Visibility = overflowItems?.Any() ?? false ? Visibility.Visible : Visibility.Collapsed;
overflowSeparator.Visibility = overflowItems?.Any() ?? false ? Visibility.Visible : Visibility.Collapsed;

overflowItem.Label = "ShowMoreOptions".GetLocalizedResource();
overflowItem.Label = Strings.ShowMoreOptions.GetLocalizedResource();
overflowItem.IsEnabled = true;
}

Expand Down
Loading
Loading