Skip to content

feat(weather): Add localization support to Weather plugin#670

Open
saulob wants to merge 8 commits intofatihak:mainfrom
saulob:feature/weather-add-language-selection
Open

feat(weather): Add localization support to Weather plugin#670
saulob wants to merge 8 commits intofatihak:mainfrom
saulob:feature/weather-add-language-selection

Conversation

@saulob
Copy link
Copy Markdown

@saulob saulob commented Apr 11, 2026

🌍 Localization Support for Weather Plugin

This PR adds multi-language support to the Weather plugin, improving usability for non-English users.

This improves the Weather plugin UX significantly for non-English users. I focused on keeping labels short to fit small e-paper displays while maintaining clarity.

✅ Features

  • Localized current date (day and month names)
  • Localized forecast day labels
  • Translated UI labels:
    • Feels like
    • Sunrise / Sunset
    • Wind, Humidity, Pressure
    • UV Index, Visibility
    • Air quality
    • Last refresh
  • Translated Air Quality Index (AQI) scales
  • Support for multiple languages:
    • English (default)
    • Portuguese
    • Spanish
    • French
    • German
    • Italian
    • Dutch
    • Indonesian

⚙️ Implementation

  • Introduced a centralized LOCALE_DATA structure
  • Added helper functions:
    • get_localized_date
    • get_localized_day_short
    • get_ui_label
  • Updated backend parsing to inject localized labels
  • Updated frontend template to use dynamic labels instead of hardcoded text

🎯 Notes

  • Focused on keeping labels short to fit small displays
  • Fallback to English when language is not supported
  • No breaking changes to existing configurations

📸 Screenshots

Weather plugin UI is now fully localized across supported languages

exemplo1 exemplo2 settings

Copilot AI review requested due to automatic review settings April 11, 2026 15:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds localization to the Weather plugin by introducing a centralized locale/translation mapping and wiring language selection through backend parsing and the frontend template.

Changes:

  • Added LOCALE_DATA plus helper functions to localize current date, forecast day labels, and UI strings in weather.py.
  • Added a language selector to the plugin settings UI and persisted it in plugin settings.
  • Updated the weather render template to use dynamic (localized) labels and a stable dp.key for wind-arrow rendering.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/plugins/weather/weather.py Introduces locale dictionary + helpers; passes language through parsing; localizes labels/date/day names.
src/plugins/weather/settings.html Adds language dropdown and loads default/saved language.
src/plugins/weather/render/weather.html Replaces hardcoded strings with backend-provided localized labels; uses dp.key for wind arrow conditional.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/plugins/weather/weather.py Outdated
Comment thread src/plugins/weather/weather.py
Comment thread src/plugins/weather/weather.py Outdated
Comment thread src/plugins/weather/settings.html Outdated
@saulob
Copy link
Copy Markdown
Author

saulob commented Apr 15, 2026

All Copilot review comments addressed

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