11 January 2013

Validating properties across i18n files - RscBundleCheck

For our project we have merged a number of custom labels in properties files. Other than manually validating locales there was no easy way to validate that labels have been copied to all locale properties files (en_US, enGB, es_MX, etc.). While trying to do via. scripts, I found RscBundleCheck. This library provides a ant task to check if labels which are missing from specific label properties.

Installation:
1. Download and install Apache Ant at a convenient location  (D:\apache-ant-1.8.4)
2. Download the rscbundlecheck jar from website and add it to ANT_INSTALL/lib folder
3. Make sure you add ANT_INSTALL/bin folder to your path
4. Create a  new build.xml like the one given below OR you can add the ant task to an existing build.xml 

<?xml version="1.0" standalone="yes"?>
<project name="project1" basedir="." default="default">
<target name="default">
    <taskdef classpath="D:/apache-ant-1.8.4/lib/rscbundlecheck-bin.jar" resource="task.properties"/>
    <resourceCheck failonerror="false">
        <fileset dir="D:/project1/java/res/com/homyarb/resources">
            <include name="page_labels_*.properties"/>
        </fileset>
        <checks>
            <include name="cross bundle check"/>
        </checks>
    </resourceCheck>
</target>
</project>


Execution:
1. open Command prompt and go to the folder where build.xml is saved
2. Type "ant" enter

The script should show you the labels which are missing across various label properties.


No comments:

Post a Comment