Skip to content

Commit a505b4f

Browse files
author
Yoshito Umaoka
committed
Implemented gp-cli import as reviewed
Added a new boolean option -r in GP CLI import command. When the option is specified, all resource entries from the specified file will be marked as reviewed. Fixes #34.
1 parent 0f82383 commit a505b4f

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

gp-cli.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,18 @@ java -jar gp-cli.jar create -b com.ibm.example.MyBundle -l en -j mycreds.json
322322
```
323323

324324
2\. Import the English(en) resource bundle contents to *MyBundle*. The resource bundle
325-
file in this example is a Java properties fiel - MyBundle.properties
325+
file in this example is a Java properties file - MyBundle.properties
326326
```
327327
java -jar gp-cli.jar import -b com.ibm.example.MyBundle -l en -t JAVA -f MyBundle.properties -j mycreds.json
328328
```
329329
At this point, the bundle *com.ibm.example.MyBundle* in the Globalization
330330
Pipeline service instance contains only English resource strings.
331331

332332
3\. Import the corresponding translated version. In this example, the operation
333-
below imports French(fr) translation from MyBundle_fr.properties.
333+
below imports French(fr) translation from MyBundle_fr.properties and marks
334+
resource strings as already reviewed (-r).
334335
```
335-
java -jar gp-cli.jar import -b com.ibm.example.MyBundle -l fr -t JAVA -f MyBundle_fr.properties -j mycreds.json
336+
java -jar gp-cli.jar import -b com.ibm.example.MyBundle -l fr -t JAVA -f MyBundle_fr.properties -j mycreds.json -r
336337
```
337338
This operation automatically adds French to the bundle *com.ibm.example.MyBundle*.
338339

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ final class ImportCmd extends BundleCmd {
5757
required = true)
5858
private String fileName;
5959

60+
@Parameter(
61+
names = {"-r", "--reviewed"},
62+
description = "Mark imported resource strings as reviewed")
63+
private boolean asReviewed = false;
64+
6065
@Override
6166
protected void _execute() {
6267
Map<String, NewResourceEntryData> resEntries = null;
@@ -72,6 +77,9 @@ protected void _execute() {
7277
resEntryData.setSequenceNumber(Integer.valueOf(seqNum));
7378
}
7479
resEntryData.setNotes(resString.getNotes());
80+
if (asReviewed) {
81+
resEntryData.setReviewed(Boolean.TRUE);
82+
}
7583
resEntries.put(resString.getKey(), resEntryData);
7684
}
7785
} catch (IOException e) {

0 commit comments

Comments
 (0)