Skip to content
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

Code Quality: Update localization to use centralized Strings class 09 #16957

Conversation

mrashutoshnigam
Copy link
Contributor

Code Quality: Update Localization for Git and Sidebar Action Classes

This pull request enhances the maintainability and consistency of localization handling across the application by refactoring string management in Git, Sidebar, and Pin/Unpin actions to use a centralized Strings class.

Closes #16718

Changes Made

  • Refactored Git Action Classes: Updated the Label and Description properties in the following Git-related action classes to use the Strings resource:

    • GitFetchAction
    • GitInitAction
    • GitPullAction
    • GitPushAction
    • GitSyncAction
  • Refactored Sidebar Action Classes: Updated localization in the following sidebar-related action classes to retrieve localized strings from the Strings class:

    • PinFolderToSidebarAction
    • UnpinFolderToSidebarAction
  • Refactored Pin/Unpin Actions: Updated localization strings for pinning and unpinning actions to use the centralized Strings class:

    • PinToStartAction
    • UnpinFromStartAction

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. Test Git-related actions (e.g., Fetch, Pull, Push, Sync) and verify that all labels and descriptions are displayed correctly.
  3. Navigate to folders and test sidebar-related actions (Pin/Unpin folders to/from Sidebar).
  4. Test pinning/unpinning functionality for Start Menu actions (Pin to Start, Unpin from Start).
  5. Change the application language in settings and repeat steps 2-4 to ensure proper localization.
  6. Check for any visual inconsistencies or errors in the displayed strings.

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 no regressions were introduced in existing functionality related to Git, Sidebar, or Pin/Unpin actions.

mrashutoshnigam and others added 8 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.
Refactor `Label` and `Description` properties in
`PlayAllAction`, `RefreshItemsAction`, `ShareItemAction`,
and `OpenAllTaggedActions` to use a centralized `Strings`
class for improved maintainability and consistency in
localization across the application.
Refactor the `Label` and `Description` properties in
`GitFetchAction`, `GitInitAction`, `GitPullAction`,
`GitPushAction`, and `GitSyncAction` to utilize a new
`Strings` resource. This change improves the
maintainability and consistency of localization across
the application.
Updated `PinFolderToSidebarAction.cs` and `UnpinFolderToSidebarAction.cs` to retrieve localized strings using a `Strings` class instead of string literals. This change enhances maintainability and organization of localization resources.
Refactor localization strings in `PinToStartAction.cs` and `UnpinFromStartAction.cs` to use a centralized `Strings` class. This change replaces hardcoded string keys for the `Label` and `Description` properties, improving maintainability and consistency across the application.
@Lamparter
Copy link
Contributor

I've already done this in #16944

Copy link
Member

@yaira2 yaira2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yaira2 yaira2 added the ready to merge Pull requests that are approved and ready to merge label Mar 19, 2025
@yaira2 yaira2 merged commit e32d518 into files-community:main Mar 19, 2025
6 checks passed
@mrashutoshnigam mrashutoshnigam deleted the codeQuality/replaceStringsLiteralsWithContants_16718_09 branch March 20, 2025 08:09
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()
3 participants