cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [6/7] git commit: updated refs/heads/master to 244e9e1
Date Thu, 29 Sep 2016 11:04:55 GMT
CLOUDSTACK-9842: Make UI JSP Free

We use some JSP file just for translation of strings in the UI. This is
achievable purely in JavaScript. This removes those JSPs, simplifies
translation usage and workflow (purely JS based). The l10n js (dictionary)
files are generated from existing messages.properties files during client-ui
code generation phase.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/16913a98
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/16913a98
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/16913a98

Branch: refs/heads/master
Commit: 16913a982253a5b658ca8ee7a0c8939f13505d45
Parents: 3a82636
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Tue Aug 30 15:55:00 2016 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Wed Sep 28 12:26:43 2016 +0530

----------------------------------------------------------------------
 client/WEB-INF/web.xml               |    2 +-
 client/pom.xml                       |   26 +
 client/tomcatconf/web.xml.in         |    1 -
 packaging/centos7/tomcat7/web.xml    |    1 -
 pom.xml                              |    7 +-
 scripts/installer/windows/client.wxs |    6 -
 server/pom.xml                       |   10 -
 tools/transifex/gen-l10n.py          |  106 ++
 ui/dictionary.jsp                    | 1158 ------------------
 ui/dictionary2.jsp                   | 1131 -----------------
 ui/error.html                        |   30 +
 ui/error.jsp                         |   30 -
 ui/index.html                        | 1892 +++++++++++++++++++++++++++++
 ui/index.jsp                         | 1849 ----------------------------
 14 files changed, 2056 insertions(+), 4193 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16913a98/client/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/client/WEB-INF/web.xml b/client/WEB-INF/web.xml
index a384f06..73a755b 100644
--- a/client/WEB-INF/web.xml
+++ b/client/WEB-INF/web.xml
@@ -80,7 +80,7 @@
 
     <error-page>
       <exception-type>java.lang.Exception</exception-type>
-      <location>/error.jsp</location>
+      <location>/error.html</location>
     </error-page>
 
 </web-app>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16913a98/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index f6d6fdc..5787717 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -391,6 +391,32 @@
   <build>
     <plugins>
       <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.2.1</version>
+        <executions>
+          <execution>
+            <id>generate-sources</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <workingDirectory>${basedir}/marvin</workingDirectory>
+              <executable>python</executable>
+              <arguments>
+                <argument>${basedir}/../tools/transifex/gen-l10n.py</argument>
+                <argument>-i</argument>
+                <argument>${basedir}/WEB-INF/classes/resources/</argument>
+                <argument>-o</argument>
+                <argument>${basedir}/../ui/l10n/</argument>
+                <echo>Generating JS localization</echo>
+              </arguments>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <groupId>ru.concerteza.buildnumber</groupId>
         <artifactId>maven-jgit-buildnumber-plugin</artifactId>
         <version>1.2.6</version>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16913a98/client/tomcatconf/web.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/web.xml.in b/client/tomcatconf/web.xml.in
index 44b6eab..8645a64 100644
--- a/client/tomcatconf/web.xml.in
+++ b/client/tomcatconf/web.xml.in
@@ -1182,7 +1182,6 @@
     <welcome-file-list>
         <welcome-file>index.html</welcome-file>
         <welcome-file>index.htm</welcome-file>
-        <welcome-file>index.jsp</welcome-file>
     </welcome-file-list>
 
 </web-app>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16913a98/packaging/centos7/tomcat7/web.xml
----------------------------------------------------------------------
diff --git a/packaging/centos7/tomcat7/web.xml b/packaging/centos7/tomcat7/web.xml
index 44b6eab..8645a64 100644
--- a/packaging/centos7/tomcat7/web.xml
+++ b/packaging/centos7/tomcat7/web.xml
@@ -1182,7 +1182,6 @@
     <welcome-file-list>
         <welcome-file>index.html</welcome-file>
         <welcome-file>index.htm</welcome-file>
-        <welcome-file>index.jsp</welcome-file>
     </welcome-file-list>
 
 </web-app>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16913a98/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e681911..d0fbbd5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,7 +129,6 @@
     <cs.jetty.version>9.2.15.v20160210</cs.jetty.version>
     <cs.cxf.version>3.1.4</cs.cxf.version>
     <cs.groovy.version>2.4.6</cs.groovy.version>
-    <cs.apache-jsp.version>9.2.15.v20160210</cs.apache-jsp.version>
     <cs.nitro.version>10.1</cs.nitro.version>
   </properties>
 
@@ -223,11 +222,6 @@
   <dependencyManagement>
     <dependencies>
       <dependency>
-        <groupId>org.eclipse.jetty</groupId>
-        <artifactId>apache-jsp</artifactId>
-        <version>${cs.apache-jsp.version}</version>
-      </dependency>
-      <dependency>
         <groupId>org.codehaus.groovy</groupId>
         <artifactId>groovy-all</artifactId>
         <version>${cs.groovy.version}</version>
@@ -876,6 +870,7 @@
               <exclude>tools/devcloud/src/deps/boxes/basebox-build/preseed.cfg</exclude>
               <exclude>tools/marvin/Marvin.egg-info/*</exclude>
               <exclude>ui/css/token-input-facebook.css</exclude>
+              <exclude>ui/l10n/*</exclude>
               <exclude>ui/lib/flot/jquery.colorhelpers.js</exclude>
               <exclude>ui/lib/flot/jquery.flot.crosshair.js</exclude>
               <exclude>ui/lib/flot/jquery.flot.fillbetween.js</exclude>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16913a98/scripts/installer/windows/client.wxs
----------------------------------------------------------------------
diff --git a/scripts/installer/windows/client.wxs b/scripts/installer/windows/client.wxs
index f5aec48..91b15fb 100644
--- a/scripts/installer/windows/client.wxs
+++ b/scripts/installer/windows/client.wxs
@@ -12,12 +12,6 @@
     <Fragment>
         <DirectoryRef Id="WEBAPPS">
             <Directory Id="dir96B1059B78BC5220348BC64D2C915517" Name="client">
-                <Component Id="cmp6F4C0541A24255F55077C2F2B9EA1716" Guid="{580A1DC7-692A-4C5E-BEFF-859FAEF9A4DD}">
-                    <File Id="filE25D632D05B768505A4E7DD377130748" KeyPath="yes" Source="!(wix.SourceClient)\dictionary.jsp"
/>
-                </Component>
-                <Component Id="cmpA3EAE442A4EFCD423DEDE8C08275003B" Guid="{02C33DD0-F4B0-496B-AA37-EF8D398B3B04}">
-                    <File Id="fil3725B99C98A189665F86E4F12796F408" KeyPath="yes" Source="!(wix.SourceClient)\index.jsp"
/>
-                </Component>
                 <Directory Id="dir1ACEF08E1E39353E790054E32AAB395B" Name="css">
                     <Component Id="cmp37A6D01A784CC885922881D8CC3D5BB8" Guid="{C7CDB7FC-BBC3-4D16-8841-0ADAAED648DA}">
                         <File Id="fil057A7F1A7D66E761998D3D3A2F236950" KeyPath="yes" Source="!(wix.SourceClient)\css\cloudstack3-ie7.css"
/>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16913a98/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index ae3b738..e379fc6 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -70,16 +70,6 @@
       <artifactId>mail</artifactId>
     </dependency>
     <dependency>
-      <groupId>jstl</groupId>
-      <artifactId>jstl</artifactId>
-      <version>${cs.jstl.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>javax.servlet.jsp.jstl</groupId>
-      <artifactId>javax.servlet.jsp.jstl-api</artifactId>
-      <version>${cs.jstl-api.version}</version>
-    </dependency>
-    <dependency>
       <groupId>commons-codec</groupId>
       <artifactId>commons-codec</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16913a98/tools/transifex/gen-l10n.py
----------------------------------------------------------------------
diff --git a/tools/transifex/gen-l10n.py b/tools/transifex/gen-l10n.py
new file mode 100644
index 0000000..0f1616b
--- /dev/null
+++ b/tools/transifex/gen-l10n.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Usage: python gen-l10n.py <path to message properties file> <output directory>
+
+import codecs
+import json
+import os
+import sys
+from optparse import OptionParser
+
+
+def generateL10nFile(propFile, outputFile):
+    ts = {}
+    with open(propFile, 'r') as f:
+        for line in f.read().split('\n'):
+            if line.startswith('#') or line.startswith('\n') or line.startswith('\r') or
line.strip() == "":
+                continue
+            key, _, value = line.partition('=')
+            if key in ts:
+                print("[Warning] Found a duplicate translation for key " + key)
+            value = value.replace('\#', '#') \
+                         .replace('\=', '=') \
+                         .replace('\!', '!') \
+                         .replace('\:', ':') \
+                         .replace('\+', '+') \
+                         .replace('\,', ',') \
+                         .replace('\>', '>') \
+                         .replace('\<', '<') \
+                         .replace('\\>', '>') \
+                         .replace('\\<', '<') \
+                         .replace('\\,', ',') \
+                         .replace('\\ ', ' ') \
+                         .replace('\\+', '+') \
+                         .replace('\\\\', '') \
+                         .decode('unicode-escape')
+            ts[key] = value
+
+    print("Exporting compiled dictionary: %s" % outputFile)
+    with codecs.open(outputFile, "w", "utf-8") as f:
+        f.write("// Licensed to the Apache Software Foundation (ASF) under one\n")
+        f.write("// or more contributor license agreements.  See the NOTICE file\n")
+        f.write("// distributed with this work for additional information\n")
+        f.write("// regarding copyright ownership.  The ASF licenses this file\n")
+        f.write("// to you under the Apache License, Version 2.0 (the\n")
+        f.write("// \"License\"); you may not use this file except in compliance\n")
+        f.write("// with the License.  You may obtain a copy of the License at\n")
+        f.write("//\n")
+        f.write("//   http://www.apache.org/licenses/LICENSE-2.0\n")
+        f.write("//\n")
+        f.write("// Unless required by applicable law or agreed to in writing,\n")
+        f.write("// software distributed under the License is distributed on an\n")
+        f.write("// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n")
+        f.write("// KIND, either express or implied.  See the License for the\n")
+        f.write("// specific language governing permissions and limitations\n")
+        f.write("// under the License.\n")
+        f.write("var dictionary = ")
+        f.write(json.dumps(ts, ensure_ascii=False, separators=(',\n', ':',), sort_keys=True))
+        f.write(";")
+
+
+def parseFileName(propFileName):
+    return propFileName.split('messages_')[-1] \
+                       .replace('properties', 'js') \
+                       .replace('messages.js', 'en.js')
+
+
+def main():
+    parser = OptionParser()
+    parser.add_option("-o", "--output", dest="outputDir",
+                      help="The path to the generated l10n js file")
+
+    parser.add_option("-i", "--input", dest="inputDir",
+                      help="The path to source messages properties files")
+
+    (options, args) = parser.parse_args()
+    if options.inputDir is None or options.outputDir is None:
+        print("Please provide messages and l10n output directory paths")
+        sys.exit(1)
+
+    if not os.path.exists(options.outputDir):
+        os.makedirs(options.outputDir)
+
+    for propFile in os.listdir(options.inputDir):
+        inputFile = "%s/%s" % (options.inputDir, propFile)
+        outputFile = "%s/%s" % (options.outputDir, parseFileName(propFile))
+        generateL10nFile(inputFile, outputFile)
+
+
+if __name__ == "__main__":
+    main()


Mime
View raw message