Skip to content

Commit

Permalink
Fix JSONFilter remove prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
aurambaj committed Jun 18, 2024
1 parent 51bc9b2 commit 4344a3f
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,58 @@ public void importJsonDefaultFormatJs() throws Exception {
checkExpectedGeneratedResources();
}

@Test
public void importJsonDefaultFormatJsCompiled() throws Exception {

Repository repository = createTestRepoUsingRepoService();

getL10nJCommander()
.run(
"push",
"-r",
repository.getName(),
"-s",
getInputResourcesTestDir("source").getAbsolutePath(),
"-ft",
"JSON_NOBASENAME",
"-fo",
"noteKeyPattern=description",
"extractAllPairs=false",
"exceptions=defaultMessage",
"removeKeySuffix=/defaultMessage");

getL10nJCommander()
.run(
"import",
"-r",
repository.getName(),
"-s",
getInputResourcesTestDir("source").getAbsolutePath(),
"-t",
getInputResourcesTestDir("translations").getAbsolutePath(),
"-ft",
"JSON_NOBASENAME");

getL10nJCommander()
.run(
"pull",
"-r",
repository.getName(),
"-s",
getInputResourcesTestDir("source").getAbsolutePath(),
"-t",
getTargetTestDir().getAbsolutePath(),
"-ft",
"JSON_NOBASENAME",
"-fo",
"noteKeyPattern=description",
"extractAllPairs=false",
"exceptions=defaultMessage",
"removeKeySuffix=/defaultMessage");

checkExpectedGeneratedResources();
}

@Test
public void importJsonI18NextParser() throws Exception {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"100_character_description_": {
"defaultMessage": "Description de 100 caractères :"
},
"15_min_duration": {
"defaultMessage": "15 min",
"description": "File lock dialog duration"
},
"1_day_duration": {
"defaultMessage": "1 jour",
"description": "File lock dialog duration"
},
"1_hour_duration": {
"defaultMessage": "1 heure",
"description": "File lock dialog duration"
},
"1_month_duration": {
"defaultMessage": "1 mois",
"description": "File lock dialog duration"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"100_character_description_": {
"defaultMessage": "Description de 100 caractères :"
},
"15_min_duration": {
"defaultMessage": "15 min",
"description": "File lock dialog duration"
},
"1_day_duration": {
"defaultMessage": "1 jour",
"description": "File lock dialog duration"
},
"1_hour_duration": {
"defaultMessage": "1 heure",
"description": "File lock dialog duration"
},
"1_month_duration": {
"defaultMessage": "1 mois",
"description": "File lock dialog duration"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"100_character_description_": {
"defaultMessage": "100文字の説明:"
},
"15_min_duration": {
"defaultMessage": "15分",
"description": "File lock dialog duration"
},
"1_day_duration": {
"defaultMessage": "1日",
"description": "File lock dialog duration"
},
"1_hour_duration": {
"defaultMessage": "1時間",
"description": "File lock dialog duration"
},
"1_month_duration": {
"defaultMessage": "1か月",
"description": "File lock dialog duration"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"100_character_description_": {
"defaultMessage": "100 character description:"
},
"15_min_duration": {
"defaultMessage": "15 min",
"description": "File lock dialog duration"
},
"1_day_duration": {
"defaultMessage": "1 day",
"description": "File lock dialog duration"
},
"1_hour_duration": {
"defaultMessage": "1 hour",
"description": "File lock dialog duration"
},
"1_month_duration": {
"defaultMessage": "1 month",
"description": "File lock dialog duration"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"100_character_description_": "Description de 100 caractères :",
"15_min_duration": "15 min",
"1_day_duration": "1 jour",
"1_hour_duration": "1 heure",
"1_month_duration": "1 mois"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"100_character_description_": "Description de 100 caractères :",
"15_min_duration": "15 min",
"1_day_duration": "1 jour",
"1_hour_duration": "1 heure",
"1_month_duration": "1 mois"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"100_character_description_": "100文字の説明:",
"15_min_duration": "15分",
"1_day_duration": "1日",
"1_hour_duration": "1時間",
"1_month_duration": "1か月"
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ String removeKeySuffixIfMatch(String key) {
if (removeKeySuffix != null) {
if (key.endsWith(removeKeySuffix)) {
key = key.substring(0, key.length() - removeKeySuffix.length());
logger.debug("Remove suffix from key: {}", key);
getEventTextUnit().setName(key);
}
}
return key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected TMTextUnitVariant importTextUnit(
tmTextUnitVariantCommentAnnotation.setMessage(integrityCheckException.getMessage());

tmTextUnitVariantCommentAnnotation.setSeverity(
TMTextUnitVariantComment.Severity.ERROR); //TODO(ja) dial it down for plural strings?
TMTextUnitVariantComment.Severity.ERROR); // TODO(ja) dial it down for plural strings?

new TMTextUnitVariantCommentAnnotations(target)
.addAnnotation(tmTextUnitVariantCommentAnnotation);
Expand Down

0 comments on commit 4344a3f

Please sign in to comment.