DEV: add danger warning if PR contains changes to non-English locales (#6625)

DEV: add danger warning if PR contains changes to non-English locales (#6625)

From ba63cca7472fe82f85594b7de433a7883aa60ac5 Mon Sep 17 00:00:00 2001
From: Maja Komel <maja.komel@gmail.com>
Date: Mon, 19 Nov 2018 10:00:17 +0100
Subject: [PATCH] DEV: add danger warning if PR contains changes to non-English
 locales (#6625)


diff --git a/Dangerfile b/Dangerfile
index a2cae25..f3d766e 100644
--- a/Dangerfile
+++ b/Dangerfile
@@ -10,3 +10,10 @@ This PR doesn't match our required code formatting standards, as enforced by pre
 #{prettier_offenses.map { |o| github.html_link(o) }.join("\n")}
   })
 end
+
+has_locales_changes = !git.modified_files.grep(/config\/locales/).empty?
+has_en_locales_changes = git.modified_files.include?("config/locales/client.en.yml") || git.modified_files.include?("config/locales/server.en.yml")
+
+if has_locales_changes && !has_en_locales_changes
+  fail("Please submit your non-English translation updates via [Transifex](https://www.transifex.com/discourse/discourse-org/). You can read more on how to contribute translations [here](https://meta.discourse.org/t/contribute-a-translation-to-discourse/14882).")
+end

GitHub

2 Likes

:heart:

3 Likes

@majakomel This failed for https://github.com/discourse/discourse/pull/6637
Could you take a look please.

1 Like

Yes this is because this commit doesnt check for plugins. Should be easy to fix, will do it tomorrow if maja doesnt fix it before.

Yes, forgot to add a check for plugin locales, will add tomorrow

4 Likes