Link to home
Start Free TrialLog in
Avatar of pdlarue
pdlarue

asked on

Ant Script ? to pad strings during build process? Other Script? Best way?

Experts:

I need to take .properties files with Key=value lists in them and pad the value (String) with characters to generate pseudo-localization (fake Languages) files during the build process.  I don't know anything about Ant.  Not sure if that is what I should be researching.  Looking for best solution.  Anybody out there know of a best solution?

To be more clear:

English version of .properties file:

BUTTON.Del=Delete
BUTTON.CONNECT=Connect To
BUTTON.CONNECT_TO=Connect to {0}
COL_HEAD.TYPE=Type
COL_HEAD.DIRECTION=Direction
SELECTONERADIO.WATTS=Watts
SELECTONERADIO.Amps=Amps
BUTTON.LOAD=Load
BUTTON.OK=OK
BUTTON.YES=Yes
BUTTON.NO=No

Italian pseudo-localization version of .properties file:

BUTTON.Del=à Deleteà
BUTTON.CONNECT=à éConnect Toà é
BUTTON.CONNECT_TO=à é Connect to {0}à é
COL_HEAD.TYPE=à Typeà
COL_HEAD.DIRECTION=à éDirectionà é
SELECTONERADIO.WATTS=à Wattsà
SELECTONERADIO.Amps=à Ampsà
BUTTON.LOAD=à Loadà
BUTTON.OK=àOKà
BUTTON.YES=àYesà
BUTTON.NO=àNoà

You will notice that the English version contains English string values. I need to read in each line, calculate the length of the string value, and pad non-English characters to the front and the back of the English string until the newly created string value is 50% longer than the original English string. This is how one creates pseudo-localization files for Internationalizing and testing an application. Therer are tools out there that will do this, however, they are manual intensive. I need to create a script to do this with the build. I know others have created these scripts, I just don't know what they used. Someone said that Ant PropertyFile can be used to concatinate strings to the values in a .properties file during the build process. But from the documentation I saw, the ability was a little primitive (like only adding the characters you specify). I need to resize the string to 50% longer. So, I'm looking for best way to do this.

Thank you in advance,
Patricia
ASKER CERTIFIED SOLUTION
Avatar of pdlarue
pdlarue

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial