Skip to content

Commit d9afcf7

Browse files
authored
Merge pull request #53 from yumaoka/rfe-40-misc-fixes
Rfe 40 misc fixes
2 parents fe56c08 + 565dda7 commit d9afcf7

19 files changed

Lines changed: 587 additions & 374 deletions

File tree

gp-ant-task/.classpath

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
<attribute name="maven.pomderived" value="true"/>
77
</attributes>
88
</classpathentry>
9-
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10-
<attributes>
11-
<attribute name="optional" value="true"/>
12-
<attribute name="maven.pomderived" value="true"/>
13-
</attributes>
14-
</classpathentry>
159
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
1610
<attributes>
1711
<attribute name="maven.pomderived" value="true"/>

gp-ant-task/.settings/org.eclipse.jdt.core.prefs

Lines changed: 303 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
formatter_profile=_gaas
3+
formatter_settings_version=12
4+
org.eclipse.jdt.ui.javadoc=false
5+
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/* \r\n * Copyright IBM Corp. ${year}\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the "License");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>

gp-ant-task/example/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Globalization Pipeline Ant Task Example
2+
3+
This directory contains example Ant build.xml illustrating how
4+
Globalization Pipeline Ant Task works.
5+
6+
Please follow the steps below to set up the environment.
7+
8+
1. Configure Appache Ant 1.9 or later version.
9+
2. Download **gp-ant-task-X.X.X-with-dependencies.jar** from GitHub
10+
[gp-java-tools release page](https://github.com/IBM-Bluemix/gp-java-tools/releases).
11+
Copy the downloaded jar file to this (example) directory and rename jar file to
12+
**gp-ant-task.jar**.
13+
3. Edit **creds.json** in this directory and put actual Globalization Pipeline
14+
service credentials.
15+
16+
There are 4 example targets (and `clean`) defined in the example build.xml.
17+
You can try `> ant upload-props` to upload the contents of Java property files in the
18+
specified directory to your Globalization Pipeline instance.
19+
Then try `> ant download-props` to see how translated property files are downloaded.

gp-ant-task/example/build.xml

Lines changed: 74 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,94 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<project name="Example Project" default="upload-resources"
2+
<project name="Example Project"
33
xmlns:gp="antlib:com.ibm.g11n.pipeline.ant">
44

5-
<taskdef uri="antlib:com.ibm.g11n.pipeline.ant" resource="com/ibm/g11n/pipeline/ant/antlib.xml">
6-
<!-- If the gp-ant-task jar is not added to ANT_HOME/lib folder,
7-
then you may include the classpath for the jar like shown below-->
8-
<classpath path="gp-ant-task.jar"/>
5+
<taskdef uri="antlib:com.ibm.g11n.pipeline.ant"
6+
resource="com/ibm/g11n/pipeline/ant/antlib.xml">
7+
<!-- Specify the actual path to the Globalization Pipeline Ant Task jar -->
8+
<classpath path="gp-ant-task.jar"/>
99
</taskdef>
1010

11-
<!--Specify the location of the credentials json file-->
12-
<property name="gp.credentials" value="credentials.json"/>
11+
<!-- Specify the location of the credentials json file -->
12+
<property name="gp.credentials.json" value="creds.json"/>
1313

14-
<!-- basic usecase for uploading resources(this uploads java .properties files by default)-->
15-
<target name="upload-resources">
16-
<gp:upload credentialsJson= "${gp.credentials}" sourceDir="resources"/>
14+
<!--
15+
Basic use case - uploading translation source resources.
16+
This target uploads the contents of java property files without
17+
language suffix under 'src' directory.
18+
-->
19+
<target name="upload-props">
20+
<gp:upload credentialsJson= "${gp.credentials.json}" sourceDir="src"/>
1721
</target>
1822

19-
<target name="upload-resources-adv">
20-
<gp:upload credentialsJson= "${gp.credentials}" sourceDir="resources">
23+
<!--
24+
Basic use case for downloading translated resources.
25+
This target downloads translated java property files corresponding
26+
to translation source files available under 'src' directory.
27+
The output files are created under 'bin' directory with
28+
language suffix in property file names.
29+
-->
30+
<target name="download-props">
31+
<gp:download credentialsJson="${gp.credentials.json}" sourceDir="src" outputDir="bin"/>
32+
</target>
33+
34+
<!--
35+
Advanced upload use case example.
36+
This target uploads the contents of source JSON files in
37+
'en' directory under 'web' directory.
38+
If the corresponding bundle in Globalization Pipeline service instance
39+
is not available, this target creates a new one and set Spanish(es),
40+
French(fr), Brazilian Portuguese(pt-BR) and Simplified Chinese(zh-Hans)
41+
as translation target languages.
42+
-->
43+
<target name="upload-json">
44+
<gp:upload credentialsJson= "${gp.credentials.json}">
45+
<targetLanguage lang="es"/>
2146
<targetLanguage lang="fr"/>
22-
<targetLanguage lang="ko"/>
2347
<targetLanguage lang="pt-BR"/>
24-
<targetLanguage lang="es"/>
25-
<bundleSet type="JSON">
26-
<fileset dir="resources" includes="**/*.json"/>
48+
<targetLanguage lang="zh-Hans"/>
49+
<bundleSet type="JSON">
50+
<fileset dir="web" includes="**/en/*.json"/>
2751
</bundleSet>
2852
</gp:upload>
2953
</target>
3054

31-
<!-- basic use case for downloading resources (this downloads the java .properties files to the target/classes folder of the project) -->
32-
<target name="download-translations">
33-
<gp:download credentialsJson="${gp.credentials}" sourceDir="resources" outputDir="target"/>
34-
</target>
55+
<!--
56+
Advanced download use case example.
57+
This target downloads translated JSON files corresponding to
58+
translation source files available in 'en' directory under
59+
'web' directory.
3560
36-
<!-- advanced use case for downloading resources. This downloads java properties files and json properties files and organizes them differently -->
37-
<target name="download-translations-adv">
38-
<property name="gp.url" value="https://gp-rest.ng.bluemix.net/translate/rest"/>
39-
<property name="gp.userId" value="b9818b62e1db014dedb2bbb8eaf176b4"/>
40-
<property name="gp.password" value="Tl7edjvzdwd2Rqjpztdbitagfendv6i4"/>
41-
<property name="gp.instanceId" value="1b088966b5fed337baf9940496db40ac"/>
42-
<property name="gp.download.src" value="resources"/>
43-
<property name="gp.download.dest" value="target"/>
44-
<property name="gp.overwrite" value="true"/>
45-
<property name="gp.languageIdStyle" value="BCP47_UNDERSCORE"/>
46-
<property name="gp.outputDir" value="target"/>
47-
<property name="gp.type" value="JSON"/>
48-
<property name="gp.sourceLanguage" value="en"/>
49-
<property name="gp.outputContentOption" value="MERGE_TO_SOURCE"/>
50-
<property name="gp.bundleLayout" value="LANGUAGE_DIR"/>
51-
<property name="gp.includepattern" value="**/*.json"/>
52-
<property name="gp.excludepattern" value="**/*_*.json"/>
53-
<gp:download overwrite="${gp.overwrite}">
54-
<credentials url="${gp.url}" userId="${gp.userId}" password="${gp.password}" instanceId="${gp.instanceId}"/>
55-
<targetLanguage lang="es"/>
56-
<targetLanguage lang="pt-BR"/>
57-
<bundleSet
58-
type="${gp.type}"
59-
sourceLanguage="${gp.sourceLanguage}"
60-
languageIdStyle="${gp.languageIdStyle}"
61-
outputContentOption="${gp.outputContentOption}"
62-
bundleLayout="${gp.bundleLayout}"
63-
outputDir="${gp.download.dest}">
64-
<targetLanguage lang="ja"/>
65-
<targetLanguage lang="fr"/>
66-
<targetLanguage lang="ko"/>
67-
<targetLanguage lang="pt-BR"/>
61+
The output files are created under language directory (LANGUAGE_DIR)
62+
at the same level with 'en' under 'dist/web' directory.
63+
64+
The languge code for Brazilian Portugues(pt-BR) will be changed
65+
to 'pt', the language code for Simplified Chinese(zh-Hans) is
66+
changed to 'zh-CN'. Language code separator (<languageMap> elements).
67+
68+
The output language directory name will use '-' as the subtag
69+
separator (languageIdStyle="BPC47").
70+
71+
When the source file path is web/nls/en/colors.json, the output files are:
72+
- dist/web/nls/es/colors.json
73+
- dist/web/nls/fr/colors.json
74+
- dist/web/nls/pt/colors.json
75+
- dist/web/nls/zh-CN/colors.json
76+
-->
77+
<target name="download-json">
78+
<gp:download credentialsJson="${gp.credentials.json}">
79+
<bundleSet type="JSON"
80+
languageIdStyle="BCP47"
81+
bundleLayout="LANGUAGE_DIR"
82+
outputDir="dist/web">
83+
<fileset dir="web" includes="**/en/*.json"/>
6884
<languageMap from="pt-BR" to="pt"/>
69-
<fileset dir="${gp.download.src}" includes="${gp.includepattern}" excludes="${gp.excludepattern}"/>
70-
</bundleSet>
71-
<bundleSet
72-
type="JAVA"
73-
sourceLanguage="en"
74-
languageIdStyle="BCP47"
75-
outputDir="${gp.download.dest}">
76-
<fileset dir="${gp.download.src}" includes="**/*.properties"/>
85+
<languageMap from="zh-Hans" to="zh-CN"/>
7786
</bundleSet>
7887
</gp:download>
7988
</target>
89+
90+
<target name="clean">
91+
<delete dir="bin"/>
92+
<delete dir="dist"/>
93+
</target>
8094
</project>

gp-ant-task/example/credentials.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

gp-ant-task/example/creds.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"url": "<Globalization Pipeline service URL>",
3+
"userId": "<User ID>",
4+
"password": "<Password>",
5+
"instanceId": "<Globalization Pipeline service instance ID>"
6+
}
-5.61 MB
Binary file not shown.

gp-ant-task/example/resources/com/test.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

gp-ant-task/example/resources/com/test.properties

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)