Skip to content

Conversation

@mrashutoshnigam
Copy link
Contributor

Code Quality: Update Localization Strings in Action Classes: 7

This pull request enhances the maintainability and consistency of localization handling across the application by replacing hardcoded string keys with references to a centralized Strings class.

Closes #16718

Changes Made

  • Refactored Label and Description Properties: Updated the Label and Description properties in the following action classes under Run to use the Strings class:
    • RunAsAdminAction
    • RunAsAnotherUserAction
    • RunWithPowershellAction
  • Refactored Label and Description Properties: Updated the Label and Description properties in the following action classes under Selection to use the Strings class:
    • ClearSelectionAction
    • InvertSelectionAction
    • SelectAllAction
    • ToggleSelectAction

Benefits

  • Improved maintainability: All localization strings are now managed in one place.
  • Enhanced consistency across the application.
  • Simplified future updates and localization efforts.
  • Reduced risk of typos and errors in localized strings.

Testing Steps

  1. Open the Files App.
  2. Locate actions that trigger the affected classes (e.g., Run as Admin, Run with PowerShell, Clear Selection).
  3. Perform these actions and verify that all labels and descriptions are displayed correctly.
  4. Change the application language in settings and repeat steps 2-3 to ensure proper localization.
  5. Check for any visual inconsistencies or errors in the displayed strings.
  6. Verify that no functionality is altered by these changes.

Additional Notes

  • This change does not alter any functionality but improves code maintainability for the affected action classes.
  • Code reviewers should ensure all hardcoded string keys have been replaced with references to the new Strings class.
  • Verify that the changes do not introduce any regression in existing functionality related to these actions.

mrashutoshnigam and others added 4 commits March 2, 2025 15:49
Refactor localization strings in archive compression and
decompression actions to utilize a new `Strings` class.
This change replaces direct string literals with references
to the centralized resource management, enhancing
maintainability and consistency across the application.
Affected classes include `CompressIntoArchiveAction`,
`CompressIntoSevenZipAction`, `CompressIntoZipAction`,
`DecompressArchive`, `DecompressArchiveHere`,
`DecompressArchiveHereSmart`, and
`DecompressArchiveToChildFolderAction`. The
`ComputeLabel` method in `DecompressArchiveToChildFolderAction`
has also been updated for consistent localization.
Replaced hardcoded string keys in `RunAsAdminAction`,
`RunAsAnotherUserAction`, and `RunWithPowershellAction`
with new keys from the `Strings` class for better
organization and management of localization resources.
Refactor `Label` and `Description` properties in
`ClearSelectionAction`, `InvertSelectionAction`,
`SelectAllAction`, and `ToggleSelectAction` to use
the `Strings` class for localization instead of
hardcoded string keys. This change enhances
maintainability and consistency in localization
handling across the application.
@yaira2 yaira2 merged commit e8d44eb into files-community:main Mar 11, 2025
6 checks passed
@yaira2 yaira2 added the ready to merge Pull requests that are approved and ready to merge label Mar 11, 2025
@mrashutoshnigam mrashutoshnigam deleted the codeQuality/replaceStringsLiteralsWithContants_16718_07 branch April 22, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Pull requests that are approved and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code Quality: Replace string.GetLocalizedResource() with Strings.object.GetLocalizedResource()

2 participants