Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2012-04-02
1
Medium Priority
?
686 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

722 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