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

LANGUAGE: Integration FR Weather #120

Open
mbl-35 opened this issue May 24, 2024 · 1 comment
Open

LANGUAGE: Integration FR Weather #120

mbl-35 opened this issue May 24, 2024 · 1 comment

Comments

@mbl-35
Copy link

mbl-35 commented May 24, 2024

Hello,
With LANGUAGE=fr env integrated (issue #107 ), the weather widget still display english informations...

In fact, lang is already in the openweathermap request parameter (API/Weather.php line 44).
https://api.openweathermap.org/data/2.5/weather?units=metric&lat=47.860879&lon=-1.801214&lang=fr&appid=my_key

Response is :

{"coord":{"lon":-1.8012,"lat":47.8609},"weather":[{"id":804,"main":"Clouds","description":"couvert","icon":"04d"}],"base":"stations","main":{"temp":12.77,"feels_like":12.43,"temp_min":12.77,"temp_max":14.03,"pressure":1020,"humidity":89,"sea_level":1020,"grnd_level":1014},"visibility":10000,"wind":{"speed":1.63,"deg":31,"gust":1.83},"clouds":{"all":100},"dt":1716536717,"sys":{"type":2,"id":2007485,"country":"FR","sunrise":1716524328,"sunset":1716580181},"timezone":7200,"id":2984191,"name":"Redon","cod":200}

You use the xpath /weather/0/main to display the weather widget. this is not a translated part.. but the xpath /weather/0/description is : "couvert" is the french word...

Same for lang=de: "main":"Clouds","description":"Bedeckt"
Could you select the appropriate xpath to display for the next tag ?

jumpapp/assets/js/src/classes/Weather.js line 58:
description: data.weather[0].main,
replaced by
description: data.weather[0].description.charAt(0).toUpperCase() + data.weather[0].description.slice(1),

Thanks :)

@mbl-35
Copy link
Author

mbl-35 commented May 24, 2024

For information, list of openweathermap main and description can be found here: Weather condition codes.
Seems that you use 'main' vs 'description' because of string length..
One way is to translate the 'main' but requiere to integrate parts in translate files..

Here are the 'main' openweathermap' response with first google translate from english to french, the corrected word specific to the weather:

openweathermap.main google trans. real word
Thunderstorm Orage
Drizzle Bruine
Rain Pluie
Snow Neige
Mist Brume
Smoke Fumée
Haze Brume Brouillard
Dust Poussière
Sand Sable
Ash Cendre
Squall Bourrasque
Tornado Tornade
Clear Clair
Clouds des nuages Nuageux

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

No branches or pull requests

1 participant