de.viaboxx.nlstools.tasks
Class MergeLocaleTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by de.viaboxx.nlstools.tasks.MergeLocaleTask
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
DiffMergeLocaleTask

public class MergeLocaleTask
extends org.apache.tools.ant.Task

This task takes two bundles and is able to merge new locales in one file into the existing bundle. This is useful if the translation is not a complete version of the locale bundle and you can't just replace the file. If there are translations missing, it inserts empty messages for that key. Example:

 <taskdef name="mergeLocale">
 classname="de.viaboxx.nlstools.tasks.MergeLocaleTask">
 <classpath refid="maven.test.classpath"/>
 </taskdef>
 

<mergeLocale from="src/main/bundles/Common.xml" with="src/main/bundles/Common_de_DE.xml" locales="de_DE" to="src/main/bundles/Common_de_DE.xml"/>


Field Summary
protected  MBBundles loadedBundles
           
protected  MBBundles translatedBundles
           
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
MergeLocaleTask()
           
 
Method Summary
 void execute()
           
protected  MBText findMBTextForLocale(String key, String locale, MBBundles bundles)
           
 String getFrom()
          The xml file with path name to read from
 String getLocales()
          semicolon separated locale names
 String getTo()
          The xml file with the path name to write into
 String getWith()
          The xml file with new translated locales
protected  void loadExecute()
           
protected  void outputExecute()
           
protected  void processExecute()
           
 void setFrom(String from)
           
 void setLocales(String locales)
           
 void setTo(String to)
           
 void setWith(String xmlWithNewLocale)
           
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loadedBundles

protected MBBundles loadedBundles

translatedBundles

protected MBBundles translatedBundles
Constructor Detail

MergeLocaleTask

public MergeLocaleTask()
Method Detail

getFrom

public String getFrom()
The xml file with path name to read from

Returns:

setFrom

public void setFrom(String from)

getTo

public String getTo()
The xml file with the path name to write into

Returns:

setTo

public void setTo(String to)

getWith

public String getWith()
The xml file with new translated locales

Returns:

setWith

public void setWith(String xmlWithNewLocale)

getLocales

public String getLocales()
semicolon separated locale names

Returns:

setLocales

public void setLocales(String locales)

execute

public void execute()
Overrides:
execute in class org.apache.tools.ant.Task

processExecute

protected void processExecute()

outputExecute

protected void outputExecute()
                      throws Exception
Throws:
Exception

loadExecute

protected void loadExecute()
                    throws Exception
Throws:
Exception

findMBTextForLocale

protected MBText findMBTextForLocale(String key,
                                     String locale,
                                     MBBundles bundles)


Copyright © 2014. All Rights Reserved.