From: Michael Tremer Date: Fri, 4 Jul 2025 12:27:39 +0000 (+0000) Subject: frontend: Show the geo location of the mirrors X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a69078f45180f56b3d143ede34d3893f0a8bce1d;p=pbs.git frontend: Show the geo location of the mirrors Signed-off-by: Michael Tremer --- diff --git a/frontend/src/utils/i18n.ts b/frontend/src/utils/i18n.ts new file mode 100644 index 00000000..f814eb4d --- /dev/null +++ b/frontend/src/utils/i18n.ts @@ -0,0 +1,7 @@ +// Load the names of regions in the current browser locale +const regions = new Intl.DisplayNames(undefined, { type: "region" }) + +// Returns the country name by its code in the browser's locale +export function getCountryName(cc: string) { + return regions.of(cc) +} diff --git a/frontend/src/views/MirrorsView.vue b/frontend/src/views/MirrorsView.vue index 3b74c422..1323ccfb 100644 --- a/frontend/src/views/MirrorsView.vue +++ b/frontend/src/views/MirrorsView.vue @@ -2,6 +2,7 @@ import { ref, onMounted } from "vue" import type { Mirror } from "@/types/Mirror" import { fetchMirrors } from "@/api/mirrors" + import { getCountryName } from "@/utils/i18n" // Import UI components import Box from "@/components/Box.vue" @@ -27,6 +28,11 @@
+ +
+ {{ getCountryName(mirror.country_code) }} +
+