diff options
-rw-r--r-- | messages/de-ch.json | 50 | ||||
-rw-r--r-- | messages/en-gb.json | 50 | ||||
-rw-r--r-- | src/lib/Timetable.svelte | 29 |
3 files changed, 89 insertions, 40 deletions
diff --git a/messages/de-ch.json b/messages/de-ch.json index 595a445..afb8130 100644 --- a/messages/de-ch.json +++ b/messages/de-ch.json @@ -17,8 +17,8 @@ } } ], - "brief_north_otter_cherish": "Diese Verbindung wurde abgebrochen.", - "next_long_lark_bask": [ + "connection_cancelled": "Diese Verbindung wurde abgebrochen.", + "connection_delayed": [ { "declarations": ["input minutes"], "selectors": ["minutes"], @@ -28,7 +28,7 @@ } } ], - "vehicle_is_early": [ + "connection_early": [ { "declarations": ["input arrival", "input minutes"], "selectors": ["arrival", "minutes"], @@ -40,8 +40,8 @@ } } ], - "home_flaky_jurgen_ascend": "Abfahrt um", - "polite_lucky_angelfish_amaze": "Ankunft um", + "departure_at": "Abfahrt um", + "arrival_at": "Ankunft um", "antsy_weird_cowfish_wish": "Geplannte", "operator_sbb": "Schweizerische Bundesbahnen (SBB)", "operator_vbz": "Verkehrsbetriebe Zürich (VBZ)", @@ -59,14 +59,38 @@ } } ], - "hour_tidy_hawk_explore": "Ankunft in", - "free_knotty_ray_soar": "Abfahrt", - "hour": "stunde", - "hours": "stunden", - "minute": "minute", - "minutes": "minuten", - "second": "sekunde", - "seconds": "sekunden", + "arrival_in": "Ankunft in", + "departure_in": "Abfahrt", + "hours": [ + { + "declarations": ["input hours"], + "selectors": ["hours"], + "match": { + "hours=1": "einer stunde", + "hours=*": "{hours} stunden" + } + } + ], + "minutes": [ + { + "declarations": ["input minutes"], + "selectors": ["minutes"], + "match": { + "minutes=1": "einer minute", + "minutes=*": "{minutes} minuten" + } + } + ], + "seconds": [ + { + "declarations": ["input seconds"], + "selectors": ["seconds"], + "match": { + "seconds=1": "einer sekunde", + "seconds=*": "{seconds} sekunden" + } + } + ], "timeJoiner": "{l} und {r}", "timeJoiner2": "{l}, {r}", "timeImmediate": [ diff --git a/messages/en-gb.json b/messages/en-gb.json index 46fbb1a..0266281 100644 --- a/messages/en-gb.json +++ b/messages/en-gb.json @@ -4,9 +4,9 @@ "lang_short": "en", "to": "to", "from": "from", - "brief_north_otter_cherish": "This connection has been cancelled.", + "connection_cancelled": "This connection has been cancelled.", "line_number_accuracy": "Line information may be inaccurate", - "next_long_lark_bask": [ + "connection_delayed": [ { "declarations": ["input minutes"], "selectors": ["minutes"], @@ -16,7 +16,7 @@ } } ], - "vehicle_is_early": [ + "connection_early": [ { "declarations": ["input arrival", "input minutes"], "selectors": ["arrival", "minutes"], @@ -40,8 +40,8 @@ } } ], - "home_flaky_jurgen_ascend": "Departure at", - "polite_lucky_angelfish_amaze": "Arrival at", + "departure_at": "Departure at", + "arrival_at": "Arrival at", "antsy_weird_cowfish_wish": "Planned", "operator_sbb": "Swiss Federal Railways (SBB)", "operator_vbz": "Verkehrsbetriebe Zürich (VBZ)", @@ -59,14 +59,38 @@ } } ], - "free_knotty_ray_soar": "Departure", - "hour_tidy_hawk_explore": "Arrival in", - "hour": "hour", - "hours": "hours", - "minute": "minute", - "minutes": "minutes", - "seconds": "seconds", - "second": "second", + "departure_in": "Departure", + "arrival_in": "Arrival in", + "hours": [ + { + "declarations": ["input hours"], + "selectors": ["hours"], + "match": { + "hours=1": "1 hour", + "hours=*": "{hours} hours" + } + } + ], + "minutes": [ + { + "declarations": ["input minutes"], + "selectors": ["minutes"], + "match": { + "minutes=1": "1 minute", + "minutes=*": "{minutes} minutes" + } + } + ], + "seconds": [ + { + "declarations": ["input seconds"], + "selectors": ["seconds"], + "match": { + "seconds=1": "1 second", + "seconds=*": "{seconds} seconds" + } + } + ], "timeJoiner": "{l} and {r}", "timeJoiner2": "{l}, {r}", "timeImmediate": [ diff --git a/src/lib/Timetable.svelte b/src/lib/Timetable.svelte index d246579..5fa6e95 100644 --- a/src/lib/Timetable.svelte +++ b/src/lib/Timetable.svelte @@ -52,11 +52,15 @@ const minutes = Math.floor(totalMinutes) - hours * 60; const seconds = Math.floor(totalSeconds) - hours * 60 * 60 - minutes * 60; const results = [] as string[]; - if (hours) results.push(`${hours} ${hours !== 1 ? m.hours() : m.hour()}`); - if (hours || minutes) - results.push(`${minutes} ${minutes !== 1 ? m.minutes() : m.minute()}`); + if (hours) + results.push( + `${m.hours({ + hours, + })}` + ); + if (hours || minutes) results.push(`${m.minutes({ minutes })}`); if (seconds && relativeSecondPrecision) - results.push(`${seconds} ${seconds !== 1 ? m.seconds() : m.second()}`); + results.push(`${m.seconds({ seconds })}`); if (results.length > 1) { const [r, l] = [results.pop()!, results.pop()!]; results.push( @@ -226,14 +230,11 @@ {@const notices = (() => { let notices = [] as [pictogram: string[], content: string][]; if (departure.cancelled) - notices.push([ - ['Cancellation', 'Attention'], - m.brief_north_otter_cherish(), - ]); + notices.push([['Cancellation', 'Attention'], m.connection_cancelled()]); if (delayMinutes < -0.5) { notices.push([ ['Hint'], - m.vehicle_is_early({ + m.connection_early({ minutes: -delayMinutes, arrival: isArrivals.toString(), }), @@ -245,7 +246,7 @@ : delayMinutes >= 2 ? ['Delay', 'Hint'] : ['Hint'], - m.next_long_lark_bask({ + m.connection_delayed({ minutes: delayMinutes.toFixed(0), }), ]); @@ -317,11 +318,11 @@ ? m.antsy_weird_cowfish_wish() + ' ' : ''}{isRelativeTime && Math.abs(expectedTime - receivedTime) < 1 ? isArrivals - ? m.hour_tidy_hawk_explore() - : m.free_knotty_ray_soar() + ? m.arrival_in() + : m.departure_in() : isArrivals - ? m.polite_lucky_angelfish_amaze() - : m.home_flaky_jurgen_ascend()} + ? m.arrival_at() + : m.departure_at()} {#if Math.abs(expectedTime - receivedTime) < 1} <span class="font-bold"> {@render renderLocalTime(new Date(receivedTime * 60 * 1000))} |