mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Translate weather conditions and show historical data
Add French translations for weather conditions and display last year's weather in the widget. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/RAXplX4
This commit is contained in:
1 parent
b1ed7f8eb4
commit
ea3eeafea8
3 files changed
+37
-3
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -21,6 +21,37 @@ interface WeatherResponse {
|
||||
location: string;
|
||||
}
|
||||
|
||||
const translateWeatherCondition = (condition: string): string => {
|
||||
const conditionLower = condition.toLowerCase();
|
||||
|
||||
// Traductions des conditions météo
|
||||
if (conditionLower.includes('clear')) return 'Ensoleillé';
|
||||
if (conditionLower.includes('sunny')) return 'Ensoleillé';
|
||||
if (conditionLower.includes('fair')) return 'Beau temps';
|
||||
if (conditionLower.includes('partly cloudy')) return 'Partiellement nuageux';
|
||||
if (conditionLower.includes('cloudy')) return 'Nuageux';
|
||||
if (conditionLower.includes('overcast')) return 'Couvert';
|
||||
if (conditionLower.includes('rain')) {
|
||||
if (conditionLower.includes('heavy')) return 'Pluie forte';
|
||||
if (conditionLower.includes('light')) return 'Pluie légère';
|
||||
return 'Pluie';
|
||||
}
|
||||
if (conditionLower.includes('shower')) return 'Averses';
|
||||
if (conditionLower.includes('drizzle')) return 'Bruine';
|
||||
if (conditionLower.includes('thunderstorm') || conditionLower.includes('thunder')) return 'Orage';
|
||||
if (conditionLower.includes('snow')) {
|
||||
if (conditionLower.includes('heavy')) return 'Neige forte';
|
||||
if (conditionLower.includes('light')) return 'Neige légère';
|
||||
return 'Neige';
|
||||
}
|
||||
if (conditionLower.includes('fog')) return 'Brouillard';
|
||||
if (conditionLower.includes('mist')) return 'Brume';
|
||||
if (conditionLower.includes('wind')) return 'Venteux';
|
||||
|
||||
// Si pas de traduction trouvée, retourner tel quel
|
||||
return condition;
|
||||
};
|
||||
|
||||
const WeatherIcon = ({ condition, size = 20 }: { condition: string; size?: number }) => {
|
||||
const iconClass = `h-${Math.floor(size/4)} w-${Math.floor(size/4)}`;
|
||||
const conditionLower = condition.toLowerCase();
|
||||
@@ -116,8 +147,8 @@ export default function WeatherWidget() {
|
||||
<span className="text-slate-700 dark:text-slate-200 font-semibold text-sm">
|
||||
{location.split(',')[0]}
|
||||
</span>
|
||||
<span className="text-xs text-slate-500 dark:text-slate-400 capitalize">
|
||||
{weather.currentYear?.condition || 'Inconnu'}
|
||||
<span className="text-xs text-slate-500 dark:text-slate-400">
|
||||
{translateWeatherCondition(weather.currentYear?.condition || 'Inconnu')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -144,6 +175,9 @@ export default function WeatherWidget() {
|
||||
<div className="text-xs text-slate-500 dark:text-slate-400">
|
||||
Année dernière
|
||||
</div>
|
||||
<div className="text-xs text-slate-400 dark:text-slate-500 mt-1">
|
||||
{translateWeatherCondition(weather.previousYear?.condition || '')}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
# https://curl.se/docs/http-cookies.html
|
||||
# This file was generated by libcurl! Edit at your own risk.
|
||||
|
||||
#HttpOnly_localhost FALSE / FALSE 1755333079 connect.sid s%3AbjMXkzE6NhLQi9NDEZUo7pvMFS4DXv9P.VCGzsu6itHxj7mQrVuphPXAS0qYDmuEdVRtZFRFvM5s
|
||||
#HttpOnly_localhost FALSE / FALSE 1755333322 connect.sid s%3AnDBOupamugXykjI-oOGUQ0X4z6d8NyCZ.yLwyTRoVe2lAm%2BVNiXJrVADKQy11tnaaYkY6nFX%2BJSM
|
||||
Reference in new issue
Block a user