W3C home > Mailing lists > Public > www-validator-cvs@w3.org > March 2015

unicorn commit: deactivate translation form with a variable

From: Mercurial notifier <nobody@w3.org>
Date: Fri, 27 Mar 2015 11:06:03 +0000
To: Unicorn Updates <www-validator-cvs@w3.org>
Message-Id: <E1YbS5T-0001gZ-Ui@mcbain.w3.org>
changeset:   1745:46411b2b331c
tag:         tip
user:        Jean-Guilhem Rouel <jean-gui@w3.org>
date:        Fri Mar 27 12:05:54 2015 +0100
files:       src/org/w3c/unicorn/action/LanguageAction.java
description:
deactivate translation form with a variable


diff -r b75428b32d78 -r 46411b2b331c src/org/w3c/unicorn/action/LanguageAction.java
--- a/src/org/w3c/unicorn/action/LanguageAction.java	Fri Mar 27 12:01:12 2015 +0100
+++ b/src/org/w3c/unicorn/action/LanguageAction.java	Fri Mar 27 12:05:54 2015 +0100
@@ -66,6 +66,12 @@
 			messages = new MessageList();
 		
 		VelocityContext velocityContext = new VelocityContext(Language.getContext(Language.getDefaultLocale()));
+    if("false".equals(Property.get("ENABLE_TRANSLATION_CONTRIBS"))) {
+        velocityContext.put("enable_translation_contribs", false);
+    }
+    else {
+        velocityContext.put("enable_translation_contribs", true);
+    }
 		velocityContext.put("queryString", "./");
 		velocityContext.put("messages", messages);
 		velocityContext.put("baseUri", "./");
@@ -98,6 +104,10 @@
 		if (langParameter == null || req.getAttribute("submitted") != null)
 			Templates.write("language.vm", velocityContext, writer);
 		else {
+      if ("false".equals(Property.get("ENABLE_TRANSLATION_CONTRIBS"))) {
+        resp.sendError(404, "Translation contributions are disabled on this server");
+        return;
+      }
 			ULocale locale = Language.getAvailableLocale(langParameter);
 			ULocale requestedLocale = Language.getLocale(langParameter);			
 			if (requestedLocale != locale) {
Received on Friday, 27 March 2015 11:06:05 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 March 2015 11:06:05 UTC