Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
add argument to include fuzzy strings in raw translation documents
  • Loading branch information
davidmason committed Nov 22, 2012
1 parent ca4e59c commit c5d58ca
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Expand Up @@ -32,4 +32,5 @@ public interface PullOptions extends PushPullOptions
{
PushPullType getPullType();
boolean getCreateSkeletons();
boolean getIncludeFuzzy();
}
Expand Up @@ -125,12 +125,22 @@ public void run() throws Exception

if(pullTarget)
{
String fileExtension;
if (getOpts().getIncludeFuzzy())
{
fileExtension = FileResource.FILETYPE_TRANSLATED_APPROVED_AND_FUZZY;
}
else
{
fileExtension = FileResource.FILETYPE_TRANSLATED_APPROVED;
}

for (LocaleMapping locMapping : locales)
{
LocaleId locale = new LocaleId(locMapping.getLocale());
ClientResponse response = fileResource.downloadTranslationFile(getOpts().getProj(),
getOpts().getProjectVersion(), locale.getId(),
FileResource.FILETYPE_TRANSLATED_APPROVED, qualifiedDocName);
fileExtension, qualifiedDocName);
if (response.getResponseStatus() == Response.Status.NOT_FOUND)
{
log.info("No raw translation document found in locale {} for document [{}]", locale, qualifiedDocName);
Expand Down
17 changes: 16 additions & 1 deletion zanata-maven-plugin/src/main/java/org/zanata/maven/PullMojo.java
Expand Up @@ -54,6 +54,15 @@ public class PullMojo extends PushPullMojo<PullOptions> implements PullOptions
*/
private boolean createSkeletons;

/**
* Whether to include fuzzy translations in translation files when using project type 'raw'.
* If this option is false, source text will be used for any string that does not have an
* approved translation.
*
* @parameter expression="${zanata.includeFuzzy}" default-value="false"
*/
private boolean includeFuzzy = false;

/**
* Type of pull to perform from the server: "source" pulls source documents only.
* "trans" pulls translation documents only.
Expand Down Expand Up @@ -99,6 +108,12 @@ public boolean getCreateSkeletons()
return createSkeletons;
}

@Override
public boolean getIncludeFuzzy()
{
return includeFuzzy;
}

@Override
public PushPullType getPullType()
{
Expand Down Expand Up @@ -164,5 +179,5 @@ public String getCommandName()
{
return "pull";
}

}

0 comments on commit c5d58ca

Please sign in to comment.