From 85f830db7147a8e4f5e6b64483a2af3e10354716 Mon Sep 17 00:00:00 2001
From: Matthew Hodgson <matthew@matrix.org>
Date: Sun, 28 May 2017 21:28:11 +0100
Subject: [PATCH] warn for duplicate translation keys

---
 scripts/check-i18n.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/check-i18n.pl b/scripts/check-i18n.pl
index 55499b0570..0ace98d0fc 100755
--- a/scripts/check-i18n.pl
+++ b/scripts/check-i18n.pl
@@ -141,6 +141,8 @@ foreach my $lang (grep { -f "$i18ndir/$_" && !/(basefile|en_EN)\.json/ } @files)
 sub read_i18n {
     my $path = shift;
     my $map = {};
+    $path =~ /.*\/(.*)$/;
+    my $lang = $1;
 
     open(FILE, "<", $path) || die $!;
     while(<FILE>) {
@@ -148,6 +150,10 @@ sub read_i18n {
             my ($indent, $src, $colon, $dst, $comma) = ($1, $2, $3, $4, $5);
             $src =~ s/\\"/"/g;
             $dst =~ s/\\"/"/g;
+
+            if ($map->{$src}) {
+                printf ("%10s %24s\t%s\n", $lang, "Duplicate translation!", $src);
+            }
             $map->{$src} = $dst;
         }
     }