cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [18/35] git commit: updated refs/heads/master to de09b5a
Date Tue, 04 Oct 2016 10:49:48 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/60edc8af/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index 5787717..3954795 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -391,32 +391,6 @@
   <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>
@@ -533,11 +507,6 @@
                     <include name="web.xml"/>
                   </fileset>
                 </copy>
-                <copy todir="${basedir}/target/generated-webapp/WEB-INF/classes">
-                  <fileset dir="${basedir}/WEB-INF/classes">
-                    <include name="resources/**/*"/>
-                  </fileset>
-                </copy>
                 <copy todir="${basedir}/target/generated-webapp">
                   <fileset dir="${basedir}/../ui"/>
                 </copy>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/60edc8af/tools/transifex/.tx/config
----------------------------------------------------------------------
diff --git a/tools/transifex/.tx/config b/tools/transifex/.tx/config
index 4579d97..45bd841 100644
--- a/tools/transifex/.tx/config
+++ b/tools/transifex/.tx/config
@@ -1,149 +1,22 @@
-
 [main]
 host = https://www.transifex.com
 
-[CloudStack_UI.2-2messagesproperties]
-file_filter = translations/CloudStack_UI.2-2messagesproperties/<lang>.properties
-source_lang = en
-type = PROPERTIES
-
-[CloudStack_UI.30xmessagesproperties]
-file_filter = translations/CloudStack_UI.30xmessagesproperties/<lang>.properties
-source_lang = en
-type = PROPERTIES
-
-[CloudStack_UI.41xmessageproperties]
-file_filter = translations/CloudStack_UI.41xmessageproperties/<lang>.properties
-source_lang = en
-type = UNICODEPROPERTIES
-
-[CloudStack_UI.42xmessagesproperties]
-file_filter = translations/CloudStack_UI.42xmessagesproperties/<lang>.properties
-source_lang = en
-type = UNICODEPROPERTIES
-
-[CloudStack_UI.43xmessagesproperties]
-file_filter = translations/CloudStack_UI.43xmessagesproperties/<lang>.properties
-source_lang = en
-type = UNICODEPROPERTIES
-
-[CloudStack_UI.44xmessagesproperties]
-file_filter = translations/CloudStack_UI.44xmessagesproperties/<lang>.properties
-source_lang = en
-type = UNICODEPROPERTIES
-
-[CloudStack_UI.45xmessagesproperties]
-file_filter = translations/CloudStack_UI.45xmessagesproperties/<lang>.properties
-source_file = work-dir/messages.properties
-source_lang = en
-trans.ar = work-dir/messages_ar.properties
-trans.ca = work-dir/messages_ca.properties
-trans.de_DE = work-dir/messages_de_DE.properties
-trans.es = work-dir/messages_es.properties
-trans.fr_FR = work-dir/messages_fr_FR.properties
-trans.it_IT = work-dir/messages_it_IT.properties
-trans.ja_JP = work-dir/messages_ja_JP.properties
-trans.ko_KR = work-dir/messages_ko_KR.properties
-trans.nb_NO = work-dir/messages_nb_NO.properties
-trans.nl_NL = work-dir/messages_nl_NL.properties
-trans.pl = work-dir/messages_pl.properties
-trans.pt_BR = work-dir/messages_pt_BR.properties
-trans.ru_RU = work-dir/messages_ru_RU.properties
-trans.zh_CN = work-dir/messages_zh_CN.properties
-type = UNICODEPROPERTIES
-
-[CloudStack_UI.46xmessagesproperties]
-source_file = work-dir/messages.properties
-source_lang = en
-trans.ar = work-dir/messages_ar.properties
-trans.ca = work-dir/messages_ca.properties
-trans.de_DE = work-dir/messages_de_DE.properties
-trans.es = work-dir/messages_es.properties
-trans.fr_FR = work-dir/messages_fr_FR.properties
-trans.hu = work-dir/messages_hu.properties
-trans.it_IT = work-dir/messages_it_IT.properties
-trans.ja_JP = work-dir/messages_ja_JP.properties
-trans.ko_KR = work-dir/messages_ko_KR.properties
-trans.nb_NO = work-dir/messages_nb_NO.properties
-trans.nl_NL = work-dir/messages_nl_NL.properties
-trans.pl = work-dir/messages_pl.properties
-trans.pt_BR = work-dir/messages_pt_BR.properties
-trans.ru_RU = work-dir/messages_ru_RU.properties
-trans.zh_CN = work-dir/messages_zh_CN.properties
-
-[CloudStack_UI.47xmessagesproperties]
-source_file = work-dir/messages.properties
-source_lang = en
-trans.ar = work-dir/messages_ar.properties
-trans.ca = work-dir/messages_ca.properties
-trans.de_DE = work-dir/messages_de_DE.properties
-trans.es = work-dir/messages_es.properties
-trans.fr_FR = work-dir/messages_fr_FR.properties
-trans.hu = work-dir/messages_hu.properties
-trans.it_IT = work-dir/messages_it_IT.properties
-trans.ja_JP = work-dir/messages_ja_JP.properties
-trans.ko_KR = work-dir/messages_ko_KR.properties
-trans.nb_NO = work-dir/messages_nb_NO.properties
-trans.nl_NL = work-dir/messages_nl_NL.properties
-trans.pl = work-dir/messages_pl.properties
-trans.pt_BR = work-dir/messages_pt_BR.properties
-trans.ru_RU = work-dir/messages_ru_RU.properties
-trans.zh_CN = work-dir/messages_zh_CN.properties
-
-[CloudStack_UI.48xmessagesproperties]
-source_file = work-dir/messages.properties
-source_lang = en
-trans.ar = work-dir/messages_ar.properties
-trans.ca = work-dir/messages_ca.properties
-trans.de_DE = work-dir/messages_de_DE.properties
-trans.es = work-dir/messages_es.properties
-trans.fr_FR = work-dir/messages_fr_FR.properties
-trans.hu = work-dir/messages_hu.properties
-trans.it_IT = work-dir/messages_it_IT.properties
-trans.ja_JP = work-dir/messages_ja_JP.properties
-trans.ko_KR = work-dir/messages_ko_KR.properties
-trans.nb_NO = work-dir/messages_nb_NO.properties
-trans.nl_NL = work-dir/messages_nl_NL.properties
-trans.pl = work-dir/messages_pl.properties
-trans.pt_BR = work-dir/messages_pt_BR.properties
-trans.ru_RU = work-dir/messages_ru_RU.properties
-trans.zh_CN = work-dir/messages_zh_CN.properties
-
-[CloudStack_UI.49xmessagesproperties]
-source_file = work-dir/messages.properties
-source_lang = en
-trans.ar = work-dir/messages_ar.properties
-trans.ca = work-dir/messages_ca.properties
-trans.de_DE = work-dir/messages_de_DE.properties
-trans.es = work-dir/messages_es.properties
-trans.fr_FR = work-dir/messages_fr_FR.properties
-trans.hu = work-dir/messages_hu.properties
-trans.it_IT = work-dir/messages_it_IT.properties
-trans.ja_JP = work-dir/messages_ja_JP.properties
-trans.ko_KR = work-dir/messages_ko_KR.properties
-trans.nb_NO = work-dir/messages_nb_NO.properties
-trans.nl_NL = work-dir/messages_nl_NL.properties
-trans.pl = work-dir/messages_pl.properties
-trans.pt_BR = work-dir/messages_pt_BR.properties
-trans.ru_RU = work-dir/messages_ru_RU.properties
-trans.zh_CN = work-dir/messages_zh_CN.properties
-
-[CloudStack_UI.410xmessagesproperties]
-source_file = work-dir/messages.properties
-source_lang = en
-trans.ar = work-dir/messages_ar.properties
-trans.ca = work-dir/messages_ca.properties
-trans.de_DE = work-dir/messages_de_DE.properties
-trans.es = work-dir/messages_es.properties
-trans.fr_FR = work-dir/messages_fr_FR.properties
-trans.hu = work-dir/messages_hu.properties
-trans.it_IT = work-dir/messages_it_IT.properties
-trans.ja_JP = work-dir/messages_ja_JP.properties
-trans.ko_KR = work-dir/messages_ko_KR.properties
-trans.nb_NO = work-dir/messages_nb_NO.properties
-trans.nl_NL = work-dir/messages_nl_NL.properties
-trans.pl = work-dir/messages_pl.properties
-trans.pt_BR = work-dir/messages_pt_BR.properties
-trans.ru_RU = work-dir/messages_ru_RU.properties
-trans.zh_CN = work-dir/messages_zh_CN.properties
+[CloudStack_UI.410_messagesjson]
+source_file = work-dir/en.json
+source_lang = en
+trans.ar = work-dir/ar.json
+trans.ca = work-dir/ca.json
+trans.de_DE = work-dir/de_DE.json
+trans.es = work-dir/es.json
+trans.fr_FR = work-dir/fr_FR.json
+trans.hu = work-dir/hu.json
+trans.it_IT = work-dir/it_IT.json
+trans.ja_JP = work-dir/ja_JP.json
+trans.ko_KR = work-dir/ko_KR.json
+trans.nb_NO = work-dir/nb_NO.json
+trans.nl_NL = work-dir/nl_NL.json
+trans.pl = work-dir/pl.json
+trans.pt_BR = work-dir/pt_BR.json
+trans.ru_RU = work-dir/ru_RU.json
+trans.zh_CN = work-dir/zh_CN.json
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/60edc8af/tools/transifex/README-transifex.txt
----------------------------------------------------------------------
diff --git a/tools/transifex/README-transifex.txt b/tools/transifex/README-transifex.txt
index 4b1cd8d..4695543 100644
--- a/tools/transifex/README-transifex.txt
+++ b/tools/transifex/README-transifex.txt
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-sync-transifex-ui is a script to automate the synchronisation between
+sync-transifex-ui.sh is a script to automate the synchronisation between
 Apache CloudStack L10N resource files and Transifex CloudStack project.
 
 Requirements to use this script:
@@ -24,7 +24,7 @@ Requirements to use this script:
 http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles
 On Debian/Ubuntu: apt-get install transifex-client
 
-Commun usage is:
+Common usage is:
 
 1/ Init and configure the transifex client CLI
 (Already made on git CloudStack repo)
@@ -34,38 +34,32 @@ Commun usage is:
 2/ Upload to Transifex the last version of the source language (en)
 which generally have the new keys/values to translate.
 
- ./sync-transifex-ui.sh upload-source-language CloudStack_UI.42xmessagesproperties
+ ./sync-transifex-ui.sh upload-source-language CloudStack_UI.410_messagesjson
 
-3/ Download the last L10N resource files from Transifex to resources
-files directory in CloudStack tree to upade the L10N resource files
+3/ Download the latest L10N resource files from Transifex to resource
+files directory in CloudStack tree to update the L10N resource files
 with the translatons from traductors.
 
- ./sync-transifex-ui.sh download-l10n-languages CloudStack_UI.42xmessagesproperties
+ ./sync-transifex-ui.sh download-l10n-languages CloudStack_UI.410_messagesjson
 
 =====
 The sync-transifex-ui provide too the ability to :
 
 * Download from Transifex the source language resource files. Be carrefully, 
-with this,you can remove some transation on Transifex if some keys has 
+with this, you can remove some transation on Transifex if some keys has 
 been removed inside the source language resource files.
 
- ./sync-transifex-ui.sh download-source-language CloudStack_UI.42xmessagesproperties
+ ./sync-transifex-ui.sh download-source-language CloudStack_UI.410_messagesjson
 
 * Upload the L10N resource files on Transifex. 
 
- ./sync-transifex-ui.sh upload-l10n-languages CloudStack_UI.42xmessagesproperties
+ ./sync-transifex-ui.sh upload-l10n-languages CloudStack_UI.410_messagesjson
 
 =====
-Note 1: 
-Choose the good branch on git matching with the good resource on Transifex:
-(no branch) <--> CloudStack_UI.2-2messagesproperties
-(no branch) <--> CloudStack_UI.30xmessagesproperties
-(4.1)       <--> CloudStack_UI.41xmessageproperties
-(master)    <--> CloudStack_UI.42xmessagesproperties
-
-Note 2:
+Note:
 If you want add a new L10N language, we need edit the sync-transifex-ui.sh script
 to add his language code in LIST_LANG variable, before run the download-l10n-languages
 command.
 
-
+======
+See: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Update+L10N+files+from+Transifex+to+git+repo

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/60edc8af/tools/transifex/gen-l10n.py
----------------------------------------------------------------------
diff --git a/tools/transifex/gen-l10n.py b/tools/transifex/gen-l10n.py
deleted file mode 100644
index 0f1616b..0000000
--- a/tools/transifex/gen-l10n.py
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/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()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/60edc8af/tools/transifex/sync-transifex-ui.sh
----------------------------------------------------------------------
diff --git a/tools/transifex/sync-transifex-ui.sh b/tools/transifex/sync-transifex-ui.sh
index a470840..a121fbd 100755
--- a/tools/transifex/sync-transifex-ui.sh
+++ b/tools/transifex/sync-transifex-ui.sh
@@ -19,10 +19,10 @@
 SRCLANG=en
 LIST_LANG="ar ca de_DE es fr_FR it_IT ja_JP ko_KR nb_NO nl_NL pl pt_BR ru_RU zh_CN hu"
 
-DIRECTORY_RESOURCES="../../client/WEB-INF/classes/resources"
+DIRECTORY_RESOURCES="../../ui/l10n"
 WORKDIR="./work-dir"
 
-AL2_STRING="# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor
license agreements.  See the NOTICE file\n# distributed with this work for additional information\n#
regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License,
Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the
License.  You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n#
Unless required by applicable law or agreed to in writing,\n# software distributed under the
License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n#
KIND, either express or implied.  See the License for the\n# specific language governing permissions
and limitations\n# under the License.\n"
+AL2_STRING="// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor
license agreements.  See the NOTICE file\n// distributed with this work for additional information\n//
regarding copyright ownership.  The ASF licenses this file\n// to you under the Apache License,
Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with
the License.  You may obtain a copy of the License at\n//\n//   http://www.apache.org/licenses/LICENSE-2.0\n//\n//
Unless required by applicable law or agreed to in writing,\n// software distributed under
the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY\n// KIND, either express or implied.  See the License for the\n// specific language governing
permissions and limitations\n// under the License.\n"
 
 doInit()
 {
@@ -47,10 +47,9 @@ doUploadL10NLangs()
 {
         # l10n languages
         for CODELANG in ${LIST_LANG} ; do
-                if [ -f "${DIRECTORY_RESOURCES}/messages_${CODELANG}.properties" ]; then
-                        native2ascii -reverse -encoding UTF-8 ${DIRECTORY_RESOURCES}/messages_${CODELANG}.properties
${WORKDIR}/messages_${CODELANG}.properties
-                        sed -i"" "s/\\\\\\\'/'/g" ${WORKDIR}/messages_${CODELANG}.properties
-                        tx set -r ${ARGUMENTS} -l ${CODELANG} ${WORKDIR}/messages_${CODELANG}.properties
+                if [ -f "${DIRECTORY_RESOURCES}/${CODELANG}.json" ]; then
+                        grep -v "^\s*//" ${DIRECTORY_RESOURCES}/${CODELANG}.js | sed -e 's/var
dictionary = //' -e "\$s/;$//" > ${WORKDIR}/${CODELANG}.json
+                        tx set -r ${ARGUMENTS} -l ${CODELANG} ${WORKDIR}/${CODELANG}.json
                         tx push -t -r ${ARGUMENTS} -l ${CODELANG}
                 else   
                         echo "Warning: the resource file for language ${CODELANG} doesn't
exist."
@@ -62,27 +61,23 @@ doDownloadL10NLangs()
 {
         # prepare l10n languages
         for CODELANG in ${LIST_LANG} ; do
-                if [ -f "${DIRECTORY_RESOURCES}/messages_${CODELANG}.properties" ]; then
-                        native2ascii -reverse -encoding UTF-8 ${DIRECTORY_RESOURCES}/messages_${CODELANG}.properties
${WORKDIR}/messages_${CODELANG}.properties
-                        sed -i"" "s/\\\\\\\'/'/g" ${WORKDIR}/messages_${CODELANG}.properties
-                        tx set -r ${ARGUMENTS} -l ${CODELANG} ${WORKDIR}/messages_${CODELANG}.properties
+                if [ -f "${DIRECTORY_RESOURCES}/${CODELANG}.js" ]; then
+                        grep -v "^\s*//" ${DIRECTORY_RESOURCES}/${CODELANG}.js | sed -e 's/var
dictionary = //' -e "\$s/;$//" > ${WORKDIR}/${CODELANG}.json
+                        tx set -r ${ARGUMENTS} -l ${CODELANG} ${WORKDIR}/${CODELANG}.json
                 else   
                         echo "\nWarning: the resource file for language ${CODELANG} doesn't
exist."
                         echo "Run this command to force get this language from transifex:"
-                        echo "\ntx set -r ${ARGUMENTS} -l ${CODELANG} ${WORKDIR}/messages_${CODELANG}.properties\n"
+                        echo "\ntx set -r ${ARGUMENTS} -l ${CODELANG} ${WORKDIR}/${CODELANG}.json\n"
                 fi
         done
 
         # get all resource files from transifex
-        tx pull -f --mode=translator -r ${ARGUMENTS} 
+        tx pull -f -r ${ARGUMENTS}
 
         # l10n languages
         for CODELANG in ${LIST_LANG} ; do
-                #tx pull -r ${ARGUMENTS} -l ${CODELANG}
-                if [ -f "${WORKDIR}/messages_${CODELANG}.properties" ]; then
-                        native2ascii -encoding UTF-8 ${WORKDIR}/messages_${CODELANG}.properties
${WORKDIR}/messages_${CODELANG}.properties.tmp1
-                        grep -v "^#" ${WORKDIR}/messages_${CODELANG}.properties.tmp1 | sort
-f | uniq | sed "s/'/\\\\\\\\\'/g" > ${WORKDIR}/messages_${CODELANG}.properties.tmp2
-                        echo "$AL2_STRING" | cat - ${WORKDIR}/messages_${CODELANG}.properties.tmp2
> ${DIRECTORY_RESOURCES}/messages_${CODELANG}.properties
+                if [ -f "${WORKDIR}/${CODELANG}.json" ]; then
+                        sed -e '1s/^/var dictionary = /' -e "\$s/\}$/\};/" -e "1s~^~${AL2_STRING}~"
${WORKDIR}/${CODELANG}.json > ${DIRECTORY_RESOURCES}/${CODELANG}.js
                 else   
                         echo "Warning: the resource file for language ${CODELANG} doesn't
exist on transifex"
                 fi
@@ -92,10 +87,9 @@ doDownloadL10NLangs()
 doUploadSourceLang()
 {
         # Source language
-        if [ -f ${DIRECTORY_RESOURCES}/messages.properties ]; then
-                native2ascii -reverse -encoding UTF-8 ${DIRECTORY_RESOURCES}/messages.properties
${WORKDIR}/messages.properties
-                sed -i"" "s/\\\\\\\'/'/g" ${WORKDIR}/messages.properties
-                tx set --source -r ${ARGUMENTS} -l ${SRCLANG} ${WORKDIR}/messages.properties
+        if [ -f ${DIRECTORY_RESOURCES}/${SRCLANG}.js ]; then
+                grep -v "^\s*//" ${DIRECTORY_RESOURCES}/${SRCLANG}.js | sed -e 's/var dictionary
= //' -e "\$s/;$//" > ${WORKDIR}/${SRCLANG}.json
+                tx set --source -r ${ARGUMENTS} -l ${SRCLANG} ${WORKDIR}/${SRCLANG}.json
                 tx push -s -r ${ARGUMENTS} 
         else
                 echo "Warning: the source language doesn't exist!"
@@ -107,10 +101,8 @@ doDownloadSourceLang()
         # get all resource files from transifex
         tx pull -s -r ${ARGUMENTS} 
         # Source language
-        if [ -f "${WORKDIR}/messages.properties" ]; then
-                native2ascii -encoding UTF-8 ${WORKDIR}/messages.properties ${WORKDIR}/messages.properties.tmp1
-                grep -v "^#" ${WORKDIR}/messages.properties.tmp1 | sort -f | uniq | sed "s/'/\\\\\\\\\'/g"
> ${WORKDIR}/messages.properties.tmp2
-                echo "$AL2_STRING" | cat - ${WORKDIR}/messages.properties.tmp2 > ${DIRECTORY_RESOURCES}/messages.properties
+        if [ -f "${WORKDIR}/${SRCLANG}.json" ]; then
+                sed -e '1s/^/var dictionary = /' -e "\$s/\}$/\};/" -e "1s~^~${AL2_STRING}~"
${WORKDIR}/${SRCLANG}.json > ${DIRECTORY_RESOURCES}/${SRCLANG}.js
         else
                 echo "Warning: the source language hasn't been retrieve!"
         fi
@@ -150,8 +142,8 @@ case "$COMMAND" in
                 ;;
 
         *|error)
-                echo "Usage: $0 [upload-source-language|download-source-language] [upload-l10n-languages|download-l10n-languages]
transifex-resource" >&2
-                echo "\n\tExemple: $0 download-l10n-languages CloudStack_UI-42xmessagesproperties\n"
>&2
+                echo "Usage: $0 [ upload-source-language | download-source-language | upload-l10n-languages
| download-l10n-languages ] transifex-resource" >&2
+                echo "\n\tExemple: $0 download-l10n-languages CloudStack_UI.410_messagesjson\n"
>&2
                 echo "Usage: $0 init-transifex URL-transifex-project" >&2
                 echo "\n\tExemple: $0 init-transifex https://www.transifex.com/projects/p/CloudStack_UI/\n"
>&2
                 exit 1


Mime
View raw message