Skip to content

Commit 0f82383

Browse files
authored
Merge pull request #33 from yumaoka/rel-v113-updates
Misc. changes for gp-java-tools 1.1.3 release, fixes #33
2 parents 13032c0 + 7d8506a commit 0f82383

8 files changed

Lines changed: 29 additions & 15 deletions

File tree

gp-cli/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<dependency>
9393
<groupId>com.ibm.g11n.pipeline</groupId>
9494
<artifactId>gp-java-client</artifactId>
95-
<version>1.1.0</version>
95+
<version>1.1.3</version>
9696
</dependency>
9797

9898
<dependency>

gp-cli/src/main/java/com/ibm/g11n/pipeline/tools/cli/ExportCmd.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.ibm.g11n.pipeline.resfilter.Bundle;
3030
import com.ibm.g11n.pipeline.resfilter.ResourceFilter;
3131
import com.ibm.g11n.pipeline.resfilter.ResourceFilterFactory;
32+
import com.ibm.g11n.pipeline.resfilter.ResourceString;
3233
import com.ibm.g11n.pipeline.resfilter.ResourceType;
3334

3435
/**
@@ -89,7 +90,9 @@ protected void _execute() {
8990
if (seqNum != null) {
9091
sequenceNumber = seqNum.intValue();
9192
}
92-
bundle.addResourceString(key, resVal, sequenceNumber);
93+
ResourceString resString = new ResourceString(key, resVal,
94+
sequenceNumber, data.getNotes());
95+
bundle.addResourceString(resString);
9396
}
9497
}
9598
} catch (ServiceException e) {

gp-cli/src/main/java/com/ibm/g11n/pipeline/tools/cli/ImportCmd.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ protected void _execute() {
7171
if (seqNum >= 0) {
7272
resEntryData.setSequenceNumber(Integer.valueOf(seqNum));
7373
}
74+
resEntryData.setNotes(resString.getNotes());
7475
resEntries.put(resString.getKey(), resEntryData);
7576
}
7677
} catch (IOException e) {

gp-cli/src/main/java/com/ibm/g11n/pipeline/tools/cli/ResourceTypeConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright IBM Corp. 2015
2+
* Copyright IBM Corp. 2015, 2016
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
2626
*
2727
* @author Yoshito Umaoka
2828
*/
29-
class ResourceTypeConverter implements IStringConverter<ResourceType>{
29+
public class ResourceTypeConverter implements IStringConverter<ResourceType>{
3030

3131
@Override
3232
public ResourceType convert(String type) {

gp-maven-plugin.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ If you have properties file `src/resources/com/ibm/example/MyStrings.properties`
274274
instead of `target/classes/com/ibm/example/MyStrings_pt_BR.properties`
275275

276276
Note: The language ID separator used in the mapping should be '-' (Hyphen) for both,
277-
even you want expect translated file name (or path) to use '_'. So, in above example,
278-
do not specify `<zh-Hant>zh_TW</zh-Hant>` even you want `MyStrings_zh_TW.properties`
279-
as the output file name. The language suffix style is configured by `<languageIdStyle>`.
277+
even you want translated file name (or path) to use '_' for the language part. In the example
278+
above, do not specify `<zh-Hant>zh_TW</zh-Hant>` even you want `MyStrings_zh_TW.properties`
279+
as the output file name. The language ID style is configured by `<languageIdStyle>`.
280280

281281

282282
### Translated JSON Files in Language Directories

gp-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
<dependency>
189189
<groupId>com.ibm.g11n.pipeline</groupId>
190190
<artifactId>gp-java-client</artifactId>
191-
<version>1.1.1</version>
191+
<version>1.1.3</version>
192192
</dependency>
193193
<dependency>
194194
<groupId>com.ibm.g11n.pipeline</groupId>

gp-maven-plugin/src/main/java/com/ibm/g11n/pipeline/maven/GPUploadMojo.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
7070

7171
// Checks if the bundle already exists
7272
String bundleId = bf.getBundleId();
73+
boolean createNew = false;
7374
if (bundleIds.contains(bundleId)) {
7475
getLog().info("Found bundle:" + bundleId);
7576
// Checks if the source language matches.
@@ -82,12 +83,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
8283
}
8384
} else {
8485
getLog().info("bundle:" + bundleId + " does not exist, creating a new bundle.");
85-
NewBundleData newBundleData = new NewBundleData(srcLang);
86-
if (!tgtLangs.isEmpty()) {
87-
newBundleData.setTargetLanguages(new TreeSet<String>(tgtLangs));
88-
}
89-
client.createBundle(bundleId, newBundleData);
90-
getLog().info("Created bundle: " + bundleId);
86+
createNew = true;
9187
}
9288

9389
// Parse the resource bundle file
@@ -96,13 +92,27 @@ public void execute() throws MojoExecutionException, MojoFailureException {
9692

9793
try (FileInputStream fis = new FileInputStream(bf.getFile())) {
9894
Bundle resBundle = filter.parse(fis);
95+
96+
if (createNew) {
97+
NewBundleData newBundleData = new NewBundleData(srcLang);
98+
// set target languages
99+
if (!tgtLangs.isEmpty()) {
100+
newBundleData.setTargetLanguages(new TreeSet<String>(tgtLangs));
101+
}
102+
// set bundle notes
103+
newBundleData.setNotes(resBundle.getNotes());
104+
client.createBundle(bundleId, newBundleData);
105+
getLog().info("Created bundle: " + bundleId);
106+
}
99107
Collection<ResourceString> resStrings = resBundle.getResourceStrings();
100108
for (ResourceString resString : resStrings) {
101109
NewResourceEntryData resEntryData = new NewResourceEntryData(resString.getValue());
102110
int seqNum = resString.getSequenceNumber();
103111
if (seqNum >= 0) {
104112
resEntryData.setSequenceNumber(Integer.valueOf(seqNum));
105113
}
114+
// set resource string notes
115+
resEntryData.setNotes(resString.getNotes());
106116
resEntries.put(resString.getKey(), resEntryData);
107117
}
108118
} catch (IOException e) {

gp-res-filter/src/main/java/com/ibm/g11n/pipeline/resfilter/Bundle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void addNote(String note) {
5959

6060
public void addNotes(List<String> inputNotes) {
6161
for (String note : inputNotes) {
62-
notes.add(note);
62+
addNote(note);
6363
}
6464
}
6565

0 commit comments

Comments
 (0)