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

[Feature] retrieve l18n Description from currentWeather by openweatherapi #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BokuNoMaxi
Copy link

Why did I need this

We used a custom openweatherapi integration that simply retrieved weather and description. But the implamantation was kindy sloppy so I checked out your extension. Everything was fine but you do not retrieve the description text and there was no documentation how I could simply translate by the icon => https://openweathermap.org/weather-conditions
But by analysing the data that we collected for a long time I retrieved following descriptions per icon (as file because it is a lot per code...) =>
openweaterapi-weathercodes.txt

Implementation

First of all I added a new field "languages" to the scheduler task "weather2". This is a comma separated list with IDs of the used languages of the page and per default it is -1 if empty. In the scheduler I added the lang param to the url (default: en), so I can switch the language as needed. In a loop I iterate over every ID that the user entered in the scheduler and via the site finder I retrieve the twoLetterIsoCode of the language, that will be sent to openweater.

Impact

Obviously as we added new language fields, we need to update the database structure. Furthermore the Scheduler task has to be executed one time to update those fields to be correctly displayed in the frontend.

Future

I have seen that the weather alert has hardcoded translations in it. Maybe the API retrieves the description the same way and you could implement it like I did, so you get the same translation as openweather, as seen in my .txt file with all of the codes, openweather uses different descriptions for the same code...

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