mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-16 11:46:21 +02:00
Translate weather conditions to French for better display
Translate English weather descriptions to French in the weather widget for both current and previous year data, and add weather icons for previous year. 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/nYabaNx
This commit is contained in:
1 parent
5f5da0bc77
commit
6628f1e670
3 files changed
+38
-6
No files matched your search
@@ -21,7 +21,36 @@ interface WeatherResponse {
|
||||
location: string;
|
||||
}
|
||||
|
||||
|
||||
const translateWeatherCondition = (condition: string): string => {
|
||||
const conditionLower = condition.toLowerCase();
|
||||
|
||||
// Traductions complètes anglais -> français
|
||||
if (conditionLower.includes('clear')) return 'Dégagé';
|
||||
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 déjà en français, 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)}`;
|
||||
@@ -119,7 +148,7 @@ export default function WeatherWidget() {
|
||||
{location.split(',')[0]}
|
||||
</span>
|
||||
<span className="text-xs text-slate-500 dark:text-slate-400">
|
||||
{weather.currentYear?.condition || 'Inconnu'}
|
||||
{translateWeatherCondition(weather.currentYear?.condition || 'Inconnu')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -140,14 +169,17 @@ export default function WeatherWidget() {
|
||||
<>
|
||||
<div className="h-8 w-px bg-slate-300 dark:bg-slate-600"></div>
|
||||
<div className="text-center">
|
||||
<div className="text-lg font-semibold text-slate-600 dark:text-slate-300">
|
||||
{Math.round(previousTemp)}°
|
||||
<div className="flex items-center justify-center gap-1 mb-1">
|
||||
<WeatherIcon condition={weather.previousYear?.condition || ''} size={16} />
|
||||
<div className="text-lg font-semibold text-slate-600 dark:text-slate-300">
|
||||
{Math.round(previousTemp)}°
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
{weather.previousYear?.condition || ''}
|
||||
{translateWeatherCondition(weather.previousYear?.condition || '')}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
Reference in new issue
Block a user