mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-16 03:40:06 +02:00
Show current date alongside weather and force French translations for conditions
Move weather condition translation logic to the backend and display the current date in the weather 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/IljTqYl
This commit is contained in:
1 parent
6628f1e670
commit
7a083a0203
3 files changed
+49
-34
No files matched your search
@@ -21,35 +21,13 @@ 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 formatDate = (date: Date): string => {
|
||||
return date.toLocaleDateString('fr-FR', {
|
||||
weekday: 'long',
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric'
|
||||
});
|
||||
};
|
||||
|
||||
const WeatherIcon = ({ condition, size = 20 }: { condition: string; size?: number }) => {
|
||||
@@ -148,7 +126,10 @@ export default function WeatherWidget() {
|
||||
{location.split(',')[0]}
|
||||
</span>
|
||||
<span className="text-xs text-slate-500 dark:text-slate-400">
|
||||
{translateWeatherCondition(weather.currentYear?.condition || 'Inconnu')}
|
||||
{weather.currentYear?.condition || 'Inconnu'}
|
||||
</span>
|
||||
<span className="text-xs text-slate-400 dark:text-slate-500 mt-1">
|
||||
{formatDate(new Date())}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -179,7 +160,7 @@ export default function WeatherWidget() {
|
||||
Année dernière
|
||||
</div>
|
||||
<div className="text-xs text-slate-400 dark:text-slate-500 mt-1">
|
||||
{translateWeatherCondition(weather.previousYear?.condition || '')}
|
||||
{weather.previousYear?.condition || ''}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
Reference in new issue
Block a user