From ecd892f6a04d831c10e0df02376d5c7495c52565 Mon Sep 17 00:00:00 2001 From: Kyler Chin <7539174+kylerchin@users.noreply.github.com> Date: Sun, 17 Nov 2024 01:29:35 -0800 Subject: [PATCH] show cause and effect --- src/components/alert_id_to_str_key.ts | 59 +++++++++++++++++++++++++++ src/components/serviceAlerts.svelte | 9 ++++ src/locales/de.json | 25 +++++++++++- src/locales/en.json | 25 +++++++++++- src/locales/es.json | 25 +++++++++++- src/locales/fr.json | 25 +++++++++++- src/locales/ko.json | 25 +++++++++++- src/locales/nl.json | 25 +++++++++++- src/locales/zh-CN.json | 25 +++++++++++- 9 files changed, 236 insertions(+), 7 deletions(-) create mode 100644 src/components/alert_id_to_str_key.ts diff --git a/src/components/alert_id_to_str_key.ts b/src/components/alert_id_to_str_key.ts new file mode 100644 index 0000000..ef653cc --- /dev/null +++ b/src/components/alert_id_to_str_key.ts @@ -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"; + } +} \ No newline at end of file diff --git a/src/components/serviceAlerts.svelte b/src/components/serviceAlerts.svelte index a9e25ea..ace79fc 100644 --- a/src/components/serviceAlerts.svelte +++ b/src/components/serviceAlerts.svelte @@ -1,4 +1,7 @@ @@ -10,6 +13,12 @@ export let alerts = {}; > {#each Object.values(alerts) as alert}
+ {$_(cause_id_str(alert.cause))} + | + {$_(effect_id_str(alert.effect))} + +
{#each alert.header_text.translation as each_header_translation_obj}{each_header_translation_obj.text}
{#each alert.description_text.translation.filter((x) => x.language == each_header_translation_obj.language) as description_alert} diff --git a/src/locales/de.json b/src/locales/de.json index ddb4aed..3ba911d 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -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" } diff --git a/src/locales/en.json b/src/locales/en.json index bc0052b..0ad2423 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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" } diff --git a/src/locales/es.json b/src/locales/es.json index 4ed1023..21a2664 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -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" } diff --git a/src/locales/fr.json b/src/locales/fr.json index 18f2bca..d3ad606 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -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é" } diff --git a/src/locales/ko.json b/src/locales/ko.json index 9ef50e7..b92fc75 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -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": "접근성 문제" } diff --git a/src/locales/nl.json b/src/locales/nl.json index fc24b75..f098543 100644 --- a/src/locales/nl.json +++ b/src/locales/nl.json @@ -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" } diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index c5d3d23..b5829b1 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -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": "無障礙問題" }