Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private boolean shouldCreateDrop(Repository repository) throws CommandException
RepositoryStatistic repoStat = repository.getRepositoryStatistic();
if (repoStat != null) {
for (RepositoryLocaleStatistic repoLocaleStat : repoStat.getRepositoryLocaleStatistics()) {
if (bcp47TagsForTranslation.contains(repoLocaleStat.getLocale().getBcp47Tag()) && repoLocaleStat.getForTranslationCount() > 0L) {
if (bcp47TagsForTranslation.contains(repoLocaleStat.getLocale().getBcp47Tag()) && repoLocaleStat.getForTranslationWordCount() > 0L) {
createDrop = true;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,27 @@ public void exportFullyTranslated() throws Exception {
assertEquals("A Drop should not have been added", findAllBefore.getTotalElements(), findAllAfter.getTotalElements());
}

@Test
public void exportZeroWords() throws Exception {

Repository repository = createTestRepoUsingRepoService();

getL10nJCommander().run("push", "-r", repository.getName(),
"-s", getInputResourcesTestDir("source").getAbsolutePath());

// there should be a single string for translation, but with 0 words in it
waitForRepositoryToHaveStringsForTranslations(repository.getId());

Page<Drop> findAllBefore = dropClient.getDrops(repository.getId(), null, null, null);

getL10nJCommander().run("drop-export", "-r", repository.getName());

Page<Drop> findAllAfter = dropClient.getDrops(repository.getId(), null, null, null);

// drop export command should not trigger an export when there are 0 words for translation
assertEquals("A Drop should not have been added", findAllBefore.getTotalElements(), findAllAfter.getTotalElements());
}

@Test
public void exportSelectFullyTranslatedLocales() throws Exception {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0">
<file original="" source-language="en" datatype="x-undefined">
<body>
<trans-unit id="" resname="100_character_description_" datatype="php">
<source/>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class RepositoryLocaleStatistic {
private Locale locale;
private Long forTranslationCount = 0L;

private Long forTranslationWordCount = 0L;

public Locale getLocale() {
return locale;
}
Expand All @@ -25,4 +27,12 @@ public void setForTranslationCount(Long forTranslationCount) {
this.forTranslationCount = forTranslationCount;
}

public Long getForTranslationWordCount() {
return forTranslationWordCount;
}

public void setForTranslationWordCount(Long forTranslationWordCount) {
this.forTranslationWordCount = forTranslationWordCount;
}

}