Skip to content

Conversation

@rsmithlal
Copy link
Member

This pull request introduces significant improvements to translation management and locale handling in the Better Together codebase. The main changes include robust locale normalization to prevent errors, new helper methods for translation coverage and display, the addition of a translation manager Stimulus controller for tab management, and a new view partial for browsing translations by attribute.

Locale Handling Improvements

  • Added a normalize_locale method to ApplicationController to sanitize and validate locale values, preventing I18n::InvalidLocale errors and supporting partial locale matches (e.g., 'en-US' → 'en'). This method is now used in the locale-setting logic. [1] [2]

Translation Coverage and Display Helpers

  • Introduced TranslationsHelper with methods to calculate per-locale translation coverage for models, including detailed attribute-level statistics and support for STI descendants and various backend types.
  • Added helper methods to ApplicationHelper for determining badge colors based on data type and formatting locale codes for display.

Translation Manager UI Enhancements

  • Added a new Stimulus controller (translation_manager_controller.js) to handle tab activation and lazy loading for translation management views, improving user experience.
  • Created a new view partial (_by_attribute.html.erb) for browsing translation records by attribute, featuring attribute filtering, results count, a detailed table, and pagination.

- Simplified the translations index view by removing unnecessary locale filter tabs and replacing them with a more structured tab navigation system.
- Introduced lazy loading for translation data by locale, model type, data type, and attribute.
- Enhanced the locale switcher to display formatted locale names.
- Updated locale files (English, Spanish, French) with new keys and translations for the revamped translation management features.
- Added new routes for fetching translations by locale, model type, data type, and attribute.
- Implemented request specs for translation management to ensure proper rendering and filtering functionality.
- Updated the translations overview to include a toggle for standard and locale-focused views.
- Introduced new partials for locale-specific coverage and overall coverage analysis.
- Enhanced the UI with progress bars and detailed statistics for translation coverage by locale.
- Modified existing translation messages to accommodate new features and improved clarity.
- Added JavaScript for dynamic view toggling and locale detail display.
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.

2 participants