Skip to content

Conversation

@mrashutoshnigam
Copy link
Contributor

Code Quality: Update Localization Strings in Action Classes

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 to use the Strings class:
    • GroupAction
    • SortFilesAndFoldersTogetherAction
    • SortFilesFirstAction
    • SortFoldersFirstAction
  • Refactored Sorting Actions: Updated localization for sorting actions to use the centralized Strings class, covering various sorting options such as:
    • Name
    • Date Modified
    • Date Created
    • Size
    • File Type
    • Sync Status
    • File Tag
    • Path
    • Original Folder
    • Date Deleted
    • Sorting Direction (Ascending and Descending)
  • Refactored Additional Actions: Updated the Label and Description properties in the following action classes to use the Strings class:
    • PlayAllAction
    • RefreshItemsAction
    • ShareItemAction
    • OpenAllTaggedActions

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., Group, Sort Files and Folders Together, Play All, Refresh Items).
  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 6 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 the
`GroupAction`, `SortFilesAndFoldersTogetherAction`,
`SortFilesFirstAction`, and `SortFoldersFirstAction`
classes to utilize a new `Strings` resource class. This
improves maintainability and consistency of localization
across the application.
Refactor localization for sorting actions to use a centralized
Strings class instead of hardcoded keys. This change enhances
maintainability and consistency across various sorting options,
including name, date modified, date created, size, file type,
sync status, file tag, path, original folder, date deleted,
and sorting direction (ascending and descending).
@yaira2 yaira2 changed the title Code Quality: Update localization to use centralized Strings class 08 16718 Code Quality: Update localization to use centralized Strings class Mar 16, 2025
@yaira2
Copy link
Member

yaira2 commented Mar 16, 2025

Thank you! We appreciate how this has been divided into multiple PRs over time. It makes the review process so much smoother and more manageable. 🙂

@yaira2 yaira2 added the ready to merge Pull requests that are approved and ready to merge label Mar 16, 2025
@yaira2 yaira2 merged commit edcac0f into files-community:main Mar 16, 2025
6 checks passed
@mrashutoshnigam
Copy link
Contributor Author

Thanks @yaira2

@mrashutoshnigam mrashutoshnigam deleted the codeQuality/replaceStringsLiteralsWithContants_16718_08 branch March 16, 2025 17:14
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()

4 participants