Skip to content

Commit

Permalink
show cause and effect
Browse files Browse the repository at this point in the history
  • Loading branch information
kylerchin committed Nov 17, 2024
1 parent 40e9ca2 commit ecd892f
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 7 deletions.
59 changes: 59 additions & 0 deletions src/components/alert_id_to_str_key.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
export function cause_id_str(x: number) : string {
switch (x) {
case 1:
return "alert_cause_unknown_cause";
case 2:
return "alert_cause_other_cause";
case 3:
return "alert_cause_technical_problem";
case 4:
return "alert_cause_labour_strike";
case 5:
return "alert_cause_demonstration_street_blockage";
case 6:
return "alert_cause_accident";
case 7:
return "alert_cause_holiday";
case 8:
return "alert_cause_weather";
case 9:
return "alert_cause_maintenance";
case 10:
return "alert_cause_construction";
case 11:
return "alert_cause_police_activity";
case 12:
return "alert_cause_medical_emergency";
default:
return "alert_cause_unknown_cause";
}
}

export function effect_id_str(x: number) : string {
switch (x) {
case 1:
return "alert_effect_no_service";
case 2:
return "alert_effect_reduced_service";
case 3:
return "alert_effect_significant_delays";
case 4:
return "alert_effect_detour";
case 5:
return "alert_effect_additional_service";
case 6:
return "alert_effect_modified_service";
case 7:
return "alert_effect_other_effect";
case 8:
return "alert_effect_unknown_effect";
case 9:
return "alert_effect_stop_moved";
case 10:
return "alert_effect_no_effect";
case 11:
return "alert_effect_accessibility_issue";
default:
return "alert_effect_unknown_effect";
}
}
9 changes: 9 additions & 0 deletions src/components/serviceAlerts.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<script lang="ts">
import { _ } from 'svelte-i18n';
import { cause_id_str, effect_id_str } from './alert_id_to_str_key';
export let alerts = {};
</script>

Expand All @@ -10,6 +13,12 @@ export let alerts = {};
>
{#each Object.values(alerts) as alert}
<div class="pt-1">
<p>
<span>{$_(cause_id_str(alert.cause))}</span>
<span> | </span>
<span>{$_(effect_id_str(alert.effect))}</span>

</p>
{#each alert.header_text.translation as each_header_translation_obj}
<p class="text-sm font-bold">{each_header_translation_obj.text}</p>
{#each alert.description_text.translation.filter((x) => x.language == each_header_translation_obj.language) as description_alert}
Expand Down
25 changes: 24 additions & 1 deletion src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,28 @@
"ontime": "Pünktlich",
"defaultlang": "Standardsprache",
"platform": "Bahnsteig",
"show_gtfs_ids": "GTFS-IDs anzeigen"
"show_gtfs_ids": "GTFS-IDs anzeigen",
"alert_cause_unknown_cause": "Unbekannte Ursache",
"alert_cause_other_cause": "Andere Ursache",
"alert_cause_technical_problem": "Technisches Problem",
"alert_cause_labour_strike": "Streik",
"alert_cause_demonstration_street_blockage": "Demonstration",
"alert_cause_accident": "Unfall",
"alert_cause_holiday": "Feiertag",
"alert_cause_weather": "Wetter",
"alert_cause_maintenance": "Wartung",
"alert_cause_construction": "Bauarbeiten",
"alert_cause_police_activity": "Polizeieinsatz",
"alert_cause_medical_emergency": "Medizinischer Notfall",
"alert_effect_no_service": "Kein Service",
"alert_effect_reduced_service": "Eingeschränkter Service",
"alert_effect_significant_delays": "Erhebliche Verzögerungen",
"alert_effect_detour": "Umleitung",
"alert_effect_additional_service": "Zusätzlicher Service",
"alert_effect_modified_service": "Geänderter Service",
"alert_effect_other_effect": "Andere Auswirkung",
"alert_effect_unknown_effect": "Unbekannte Auswirkung",
"alert_effect_stop_moved": "Haltestelle verlegt",
"alert_effect_no_effect": "Keine Auswirkung",
"alert_effect_accessibility_issue": "Barrierefreiheitsproblem"
}
25 changes: 24 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,28 @@
"hidepreviousstops": "Hide previous stops",
"shownpreviousstops": "Show {n} previous {n, plural, =1 {stop} other{stops}}",
"Platform": "Platform",
"show_gtfs_ids": "Show GTFS IDs"
"show_gtfs_ids": "Show GTFS IDs",
"alert_cause_unknown_cause": "Unknown cause",
"alert_cause_other_cause": "Other cause",
"alert_cause_technical_problem": "Technical problem",
"alert_cause_labour_strike": "Strike",
"alert_cause_demonstration_street_blockage": "Demonstration",
"alert_cause_accident": "Accident",
"alert_cause_holiday": "Holiday",
"alert_cause_weather": "Weather",
"alert_cause_maintenance": "Maintenance",
"alert_cause_construction": "Construction",
"alert_cause_police_activity": "Police activity",
"alert_cause_medical_emergency": "Medical emergency",
"alert_effect_no_service": "No service",
"alert_effect_reduced_service": "Reduced service",
"alert_effect_significant_delays": "Significant delays",
"alert_effect_detour": "Detour",
"alert_effect_additional_service": "Additional service",
"alert_effect_modified_service": "Modified service",
"alert_effect_other_effect": "Other effect",
"alert_effect_unknown_effect": "Unknown effect",
"alert_effect_stop_moved": "Stop moved",
"alert_effect_no_effect": "No effect",
"alert_effect_accessibility_issue": "Accessibility issue"
}
25 changes: 24 additions & 1 deletion src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,28 @@
"hidepreviousstops": "Ocultar paradas anteriores",
"showxpreviousstops_pt1": "Mostrar",
"platform": "Plataforma",
"show_gtfs_ids": "Mostrar IDs GTFS"
"show_gtfs_ids": "Mostrar IDs GTFS",
"alert_cause_unknown_cause": "Causa desconocida",
"alert_cause_other_cause": "Otra causa",
"alert_cause_technical_problem": "Problema técnico",
"alert_cause_labour_strike": "Huelga",
"alert_cause_demonstration_street_blockage": "Manifestación",
"alert_cause_accident": "Accidente",
"alert_cause_holiday": "Vacaciones",
"alert_cause_weather": "Clima",
"alert_cause_maintenance": "Mantenimiento",
"alert_cause_construction": "Construcción",
"alert_cause_police_activity": "Actividad policial",
"alert_cause_medical_emergency": "Emergencia médica",
"alert_effect_no_service": "Sin servicio",
"alert_effect_reduced_service": "Servicio reducido",
"alert_effect_significant_delays": "Retrasos significativos",
"alert_effect_detour": "Desvío",
"alert_effect_additional_service": "Servicio adicional",
"alert_effect_modified_service": "Servicio modificado",
"alert_effect_other_effect": "Otro efecto",
"alert_effect_unknown_effect": "Efecto desconocido",
"alert_effect_stop_moved": "Parada movida",
"alert_effect_no_effect": "Sin efecto",
"alert_effect_accessibility_issue": "Problema de accesibilidad"
}
25 changes: 24 additions & 1 deletion src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,28 @@
"hidepreviousstops": "Masquer les arrêts précédents",
"shownpreviousstops": "Afficher les {n} {n, plural, =1 {arrêt précédent} other{arrêts précédents}}",
"platform": "quai",
"show_gtfs_ids": "Afficher les identifiants GTFS"
"show_gtfs_ids": "Afficher les identifiants GTFS",
"alert_cause_unknown_cause": "Cause inconnue",
"alert_cause_other_cause": "Autre cause",
"alert_cause_technical_problem": "Problème technique",
"alert_cause_labour_strike": "Grève",
"alert_cause_demonstration_street_blockage": "Manifestation",
"alert_cause_accident": "Accident",
"alert_cause_holiday": "Vacances",
"alert_cause_weather": "Météo",
"alert_cause_maintenance": "Maintenance",
"alert_cause_construction": "Construction",
"alert_cause_police_activity": "Activité policière",
"alert_cause_medical_emergency": "Urgence médicale",
"alert_effect_no_service": "Pas de service",
"alert_effect_reduced_service": "Service réduit",
"alert_effect_significant_delays": "Retards significatifs",
"alert_effect_detour": "Détour",
"alert_effect_additional_service": "Service supplémentaire",
"alert_effect_modified_service": "Service modifié",
"alert_effect_other_effect": "Autre effet",
"alert_effect_unknown_effect": "Effet inconnu",
"alert_effect_stop_moved": "Arrêt déplacé",
"alert_effect_no_effect": "Aucun effet",
"alert_effect_accessibility_issue": "Problème d'accessibilité"
}
25 changes: 24 additions & 1 deletion src/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,28 @@
"hidepreviousstops": "이전 정류장 숨기기",
"shownpreviousstops": "Show {n, number} previous stops",
"platform": "승강장",
"show_gtfs_ids": "GTFS ID 표시"
"show_gtfs_ids": "GTFS ID 표시",
"alert_cause_unknown_cause": "알 수 없는 원인",
"alert_cause_other_cause": "기타 원인",
"alert_cause_technical_problem": "기술적 문제",
"alert_cause_labour_strike": "파업",
"alert_cause_demonstration_street_blockage": "시위",
"alert_cause_accident": "사고",
"alert_cause_holiday": "휴일",
"alert_cause_weather": "날씨",
"alert_cause_maintenance": "유지 보수",
"alert_cause_construction": "공사",
"alert_cause_police_activity": "경찰 활동",
"alert_cause_medical_emergency": "의료 응급 상황",
"alert_effect_no_service": "서비스 없음",
"alert_effect_reduced_service": "서비스 축소",
"alert_effect_significant_delays": "심각한 지연",
"alert_effect_detour": "우회",
"alert_effect_additional_service": "추가 서비스",
"alert_effect_modified_service": "수정된 서비스",
"alert_effect_other_effect": "기타 효과",
"alert_effect_unknown_effect": "알 수 없는 효과",
"alert_effect_stop_moved": "정류장 이동",
"alert_effect_no_effect": "효과 없음",
"alert_effect_accessibility_issue": "접근성 문제"
}
25 changes: 24 additions & 1 deletion src/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,28 @@
"hidepreviousstops": "Verberg eerdere haltes",
"shownpreviousstops": "Toon {n} eerdere {n, plural, =1 {halte} other{haltes}}",
"Platform": "Platform",
"show_gtfs_ids": "Toon GTFS-IDs"
"show_gtfs_ids": "Toon GTFS-IDs",
"alert_cause_unknown_cause": "Onbekende oorzaak",
"alert_cause_other_cause": "Andere oorzaak",
"alert_cause_technical_problem": "Technisch probleem",
"alert_cause_labour_strike": "Staking",
"alert_cause_demonstration_street_blockage": "Demonstratie",
"alert_cause_accident": "Ongeval",
"alert_cause_holiday": "Feestdag",
"alert_cause_weather": "Weer",
"alert_cause_maintenance": "Onderhoud",
"alert_cause_construction": "Werkzaamheden",
"alert_cause_police_activity": "Politieactie",
"alert_cause_medical_emergency": "Medisch noodgeval",
"alert_effect_no_service": "Geen dienst",
"alert_effect_reduced_service": "Beperkte dienst",
"alert_effect_significant_delays": "Aanzienlijke vertragingen",
"alert_effect_detour": "Omleiding",
"alert_effect_additional_service": "Extra dienst",
"alert_effect_modified_service": "Gewijzigde dienst",
"alert_effect_other_effect": "Ander effect",
"alert_effect_unknown_effect": "Onbekend effect",
"alert_effect_stop_moved": "Halte verplaatst",
"alert_effect_no_effect": "Geen effect",
"alert_effect_accessibility_issue": "Toegankelijkheidsprobleem"
}
25 changes: 24 additions & 1 deletion src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,28 @@
"hidepreviousstops": "隐藏之前的站点",
"shownpreviousstops": "显示前 {n, number} 个之前的站点",
"platform": "站台",
"show_gtfs_ids": "显示 GTFS ID"
"show_gtfs_ids": "显示 GTFS ID",
"alert_cause_unknown_cause": "未知原因",
"alert_cause_other_cause": "其他原因",
"alert_cause_technical_problem": "技術問題",
"alert_cause_labour_strike": "罷工",
"alert_cause_demonstration_street_blockage": "示威遊行",
"alert_cause_accident": "事故",
"alert_cause_holiday": "假期",
"alert_cause_weather": "天氣",
"alert_cause_maintenance": "維修",
"alert_cause_construction": "施工",
"alert_cause_police_activity": "警方活動",
"alert_cause_medical_emergency": "醫療緊急情況",
"alert_effect_no_service": "無服務",
"alert_effect_reduced_service": "服務減少",
"alert_effect_significant_delays": "嚴重延誤",
"alert_effect_detour": "繞道",
"alert_effect_additional_service": "額外服務",
"alert_effect_modified_service": "服務變更",
"alert_effect_other_effect": "其他影響",
"alert_effect_unknown_effect": "未知影響",
"alert_effect_stop_moved": "站點遷移",
"alert_effect_no_effect": "無影響",
"alert_effect_accessibility_issue": "無障礙問題"
}

0 comments on commit ecd892f

Please sign in to comment.