Solved

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

Posted on 2012-04-02
1
681 Views
Last Modified: 2012-04-04
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
0
Comment
Question by:pdlarue
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
pdlarue earned 0 total points
ID: 37807583
OK.  The way to do this is a simple Java app. Implement this as an Ant task or a Maven plugin.

Or if you ever want to learn Groovy (or Python, or ...), this looks like the perfect opportunity...

This information came from Peter Johnson at www.coderanch.com.

Thanks, Peter.

Patricia
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Simple Linear Regression
Starting up a Project

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question