Skip to content

Commit 97a7623

Browse files
committed
adding test and limiting changes to LANGUAGE_SUFFIX
1 parent aa70aea commit 97a7623

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"upload.desc":"description",
3+
"upload.comment":"comment",
4+
"upload.submit":"upload"
5+
}

gp-maven-plugin/src/it/t4-basic-download-success/verify.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ try {
2525
println "verifying that download happened successfully"
2626
String location = bldDir + "/it/t4-basic-download-success"
2727
String targetLocation = location + "/target/classes/com/bundle1"
28+
String targetLocation2 = location + "/target/classes/com/bundle2"
2829
def dir = new File(targetLocation)
2930
int filecount = 0
3031
int keycount = 5 // including opening and closing braces which take 1 line each
@@ -40,6 +41,14 @@ try {
4041
}
4142
}
4243
assert filecount == 10
44+
45+
46+
def dir2 = new File(targetLocation2)
47+
dir2.traverse { file ->
48+
if (!file.directory) {
49+
assert !file.name.contains("_en_")
50+
}
51+
}
4352
} catch( Throwable t ) {
4453
t.printStackTrace()
4554
return false

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,19 @@ private void exportLanguageResource(ServiceClient client, SourceBundleFile bf, S
158158
throws MojoFailureException {
159159
String srcFileName = bf.getFile().getName();
160160
String relPath = bf.getRelativePath();
161-
162-
// truncate source suffix from target resource files
163-
int extensionIndex = srcFileName.lastIndexOf('.');
164-
String extension = (extensionIndex > 0) ? srcFileName.substring(extensionIndex) : "";
165-
int srcSuffixIndex = (langMap.containsKey(srcLang)) ? srcFileName.lastIndexOf("_" + langMap.get(srcLang)) : srcFileName.lastIndexOf("_" + srcLang);
166-
srcFileName = (srcSuffixIndex > 0) ? srcFileName.substring(0,srcSuffixIndex) + extension : srcFileName;
167-
168161
File outputFile = null;
169162

170163
switch (bundleLayout) {
171164
case LANGUAGE_SUFFIX: {
172165
File dir = (new File(outBaseDir, relPath)).getParentFile();
166+
167+
// truncate source suffix from sourceFile name - BEGIN
168+
int extensionIndex = srcFileName.lastIndexOf('.');
169+
String extension = (extensionIndex > 0) ? srcFileName.substring(extensionIndex) : "";
170+
int srcSuffixIndex = srcFileName.lastIndexOf("_" + getLanguageId(srcLang, langIdStyle, langMap));
171+
srcFileName = (srcSuffixIndex > 0) ? srcFileName.substring(0,srcSuffixIndex) + extension : srcFileName;
172+
// truncate source suffix from sourceFile name - END
173+
173174
int idx = srcFileName.lastIndexOf('.');
174175
String tgtName = null;
175176
if (idx < 0) {

0 commit comments

Comments
 (0)