Skip to content

Conversation

@mrashutoshnigam
Copy link
Contributor

Code Quality: Update Localization in Action Classes

This pull request refactors the localization in several action classes within the Files App to utilize a new Strings resource. The changes improve maintainability and consistency in localization by replacing hardcoded string literals with references to a centralized resource.

Closes #16718

Changes Made

  • Created a centralized Strings class for managing localization strings.
  • Refactored the Label and Description properties in the following action classes to use the new Strings resource:
    • InstallCertificateAction
    • InstallFontAction
    • InstallInfDriverAction
    • LaunchPreviewPopupAction
  • Replaced hardcoded string literals with references to the centralized Strings class.

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 files that trigger the affected actions (e.g., certificates, fonts, INF drivers).
  3. Perform the following actions:
    • Install Certificate
    • Install Font
    • Install INF Driver
    • Launch Preview Popup
  4. Verify that all labels and descriptions are displayed correctly.
  5. Change the application language in settings and repeat steps 3-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 string literals in the mentioned classes 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 3 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
InstallCertificateAction, InstallFontAction,
InstallInfDriverAction, and LaunchPreviewPopupAction
to utilize a new `Strings` resource for improved
maintainability and consistency in localization.
@yaira2
Copy link
Member

yaira2 commented Mar 11, 2025

LGTM

@yaira2 yaira2 merged commit 9843df6 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_06 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