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

Fix argument errors of LightService::LocalizationAdapter #263

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

wqsaali
Copy link
Contributor

@wqsaali wqsaali commented Jan 13, 2025

Summary

This PR refactors the LocalizationAdapter and I18n::LocalizationAdapter classes to standardize the method interfaces for success and failure. The changes aim to unify how these methods are called and processed, regardless of which adapter is used.

Changes Introduced

  1. Unified Method Signature:

    • Both success and failure methods now accept a third optional options argument in both LocalizationAdapter and I18n::LocalizationAdapter.
  2. Improved Extensibility:

    • The added options argument allows for future extensibility without requiring interface changes.

Why This Change Was Made

  • To create a unified interface for both adapters, simplifying their usage and improving maintainability.
  • To provide flexibility for passing additional options (like i18n_options) without breaking existing functionality.

How It Works

  • If a Symbol is passed to success or failure, it will be translated using either:
    • The LocalizationMap (for LocalizationAdapter)
    • The I18n translation system (for I18n::LocalizationAdapter)
  • If a string is passed, it is returned as-is.
  • The third options argument allows for additional customization during processing.

Testing

  • Verified that the refactored methods work seamlessly for both adapters.
  • Added test coverage for both adapters.

Impact

  • The method interfaces are now consistent across both adapters, reducing potential integration issues.
  • Backward-compatible with existing implementations.

This PR fixes following issues reported

@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.47%. Comparing base (aa27ba1) to head (6f164c7).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #263      +/-   ##
==========================================
- Coverage   99.47%   99.47%   -0.01%     
==========================================
  Files          29       29              
  Lines         766      765       -1     
==========================================
- Hits          762      761       -1     
  Misses          4        4              
Flag Coverage Δ
unittests 99.47% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@adomokos adomokos left a comment

Choose a reason for hiding this comment

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

Thank you! 💯

@adomokos adomokos merged commit 1be160b into adomokos:main Jan 14, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants