From 60bd99246714a0979f4bf2bf3f74ed92471f0cf5 Mon Sep 17 00:00:00 2001
From: Anand Chowdhary
Date: Mon, 10 Aug 2020 17:09:36 +0530
Subject: [PATCH] :globe_with_meridians: Add i18n for all strings
---
site/i18n.yml | 23 +++++++++++++++
site/src/components/ActiveIncidents.svelte | 14 +++++----
site/src/components/Incident.svelte | 33 +++++++++++++---------
site/src/components/Incidents.svelte | 16 ++++++++---
site/src/components/LiveStatus.svelte | 10 +++++--
site/src/components/Loading.svelte | 11 +++++++-
site/src/components/Nav.svelte | 8 ++++--
site/src/routes/_layout.svelte | 8 ++----
8 files changed, 87 insertions(+), 36 deletions(-)
diff --git a/site/i18n.yml b/site/i18n.yml
index d653aa4a..2561366a 100644
--- a/site/i18n.yml
+++ b/site/i18n.yml
@@ -1 +1,24 @@
activeIncidents: Active Incidents
+allSystemsOperational: All systems are operational
+incidentReport: Incident report →
+activeIncidentSummary: Opened at $DATE with $POSTS posts
+incidentTitle: Incident $NUMBER Details
+incidentDetails: Incident Details
+incidentFixed: Fixed
+incidentOngoing: Ongoing
+incidentOpenedAt: Opened at
+incidentClosedAt: Closed at
+incidentSubscribe: Subscribe to Updates
+incidentViewOnGitHub: View on GitHub
+incidentCommentSummary: Posted at $DATE by $AUTHOR
+incidentBack: ← Back to all incidents
+pastIncidents: Past Incidents
+pastIncidentsResolved: Resolved in $MINUTES minuted with $POSTS posts
+liveStatus: Live Status
+overallUptime: Overall uptime $UPTIME%
+averageResponseTime: Average response time $TIMEms
+loading: Loading
+navStatus: Status
+navAbout: About
+navGitHub: GitHub
+footer: This page is [open source]($REPO), powered by [Upptime](https://upptime.js.org)
diff --git a/site/src/components/ActiveIncidents.svelte b/site/src/components/ActiveIncidents.svelte
index a9904c16..8d7c0039 100644
--- a/site/src/components/ActiveIncidents.svelte
+++ b/site/src/components/ActiveIncidents.svelte
@@ -49,7 +49,7 @@
{#if !incidents.length && !loading}
- ✅ All systems are operational
+ ✅ {config.i18n.allSystemsOperational}
{/if}
@@ -57,18 +57,22 @@
{:else if incidents.length}
{#each incidents as incident}
- Active Incidents
+ {config.i18n.activeIncidents}
{incident.title.replace('🛑', '').replace('⚠️', '').trim()}
- Opened at {new Date(incident.created_at).toLocaleString()} with {incident.comments}
- posts
+ {config.i18n.activeIncidentSummary
+ .replace(
+ /\$DATE/g,
+ new Date(incident.created_at).toLocaleString()
+ )
+ .replace(/\$POSTS/g, incident.comments)}
diff --git a/site/src/components/Incident.svelte b/site/src/components/Incident.svelte
index 1a3fb58e..1b8d92b7 100644
--- a/site/src/components/Incident.svelte
+++ b/site/src/components/Incident.svelte
@@ -83,16 +83,16 @@
- Incident #{number} Details
+ {config.i18n.incidentTitle.replace('$NUMBER', number)}
{#if loadingIncident}
- Incident Details
+ {config.i18n.incidentDetails}
{:else}
{incident.title}
- {incident.state === 'closed' ? 'Fixed' : 'Ongoing'}
+ {incident.state === 'closed' ? config.i18n.incidentFixed : config.i18n.incidentOngoing}
{/if}
@@ -103,10 +103,10 @@
{:else}
@@ -131,12 +131,17 @@
{@html md(comment.body)}
{/each}
@@ -144,5 +149,5 @@
diff --git a/site/src/components/Incidents.svelte b/site/src/components/Incidents.svelte
index ba6d8e1a..d3926d1e 100644
--- a/site/src/components/Incidents.svelte
+++ b/site/src/components/Incidents.svelte
@@ -35,7 +35,7 @@
});
-Past Incidents
+{config.i18n.pastIncidents}
{#if loading}
@@ -50,12 +50,20 @@
{incident.title.replace('🛑', '').replace('⚠️', '').trim()}
- Resolved in {((new Date(incident.closed_at).getTime() - new Date(incident.created_at).getTime()) / 60000).toFixed(0)}
- minutes with {incident.comments} posts
+ {@html config.i18n.pastIncidentsResolved
+ .replace(
+ /\$MINUTES/g,
+ (
+ (new Date(incident.closed_at).getTime() -
+ new Date(incident.created_at).getTime()) /
+ 60000
+ ).toFixed(0)
+ )
+ .replace(/\$POSTS/g, incident.comments)}
diff --git a/site/src/components/LiveStatus.svelte b/site/src/components/LiveStatus.svelte
index f9748acb..a1732b75 100644
--- a/site/src/components/LiveStatus.svelte
+++ b/site/src/components/LiveStatus.svelte
@@ -36,7 +36,7 @@
}
-Live Status
+{config.i18n.liveStatus}
{#if loading}
@@ -46,8 +46,12 @@
class={site.status}
style={`background-image: url("https://raw.githubusercontent.com/koj-co/upptime/master/graphs/${site.slug}.png`}>
{site.name}
- Overall uptime: {site.uptime}%
- Average response time: {site.time}ms
+
+ {@html config.i18n.overallUptime.replace(/\$UPTIME/g, site.uptime)}
+
+
+ {@html config.i18n.averageResponseTime.replace(/\$TIME/g, site.time)}
+
{/each}
{/if}
diff --git a/site/src/components/Loading.svelte b/site/src/components/Loading.svelte
index d1774a4f..c6f22426 100644
--- a/site/src/components/Loading.svelte
+++ b/site/src/components/Loading.svelte
@@ -1,3 +1,7 @@
+
+
-
diff --git a/site/src/routes/_layout.svelte b/site/src/routes/_layout.svelte
index 0661473a..1c67720e 100644
--- a/site/src/routes/_layout.svelte
+++ b/site/src/routes/_layout.svelte
@@ -1,6 +1,7 @@
@@ -20,11 +21,6 @@