Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8052433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:32:42+00:00 2026-06-05T07:32:42+00:00

I want to use ANT build to translate .properties file into text file (code).

  • 0

I want to use ANT build to translate .properties file into text file (code).

Input file my.properties:

FOO=foo bar
BAR=bar bar foo

Desired output file Constants.as:

package foo.bar {
    public final class Constants {
        public static const FOO:String = "FOO";
        public static const BAR:String = "BAR";
    }
}

Note: ActionScript can’t use properties files like Java, so I need to use this translation as a pre-build task. My properties file is localization and I want the keys as constants.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:32:43+00:00Added an answer on June 5, 2026 at 7:32 am

    I’ve managed to hack it through scriptdef in JavaScript.

    Any ideas how to do it better?

    <scriptdef name="localization-regen" language="javascript">
        <attribute name="input.file.path"/>
        <attribute name="output.file.category"/>
        <attribute name="output.file.package"/>
        <attribute name="output.file.dir"/>
        <attribute name="output.property"/>
        <![CDATA[
    
            importPackage(java.io);
    
            inputFilePath = attributes.get("input.file.path");
            outputFileCategory = attributes.get("output.file.category");
            outputFilePackage = attributes.get("output.file.package");
            outputFileDir = attributes.get("output.file.dir");
    
            outputFileClass = "LocalizationKeys" + outputFileCategory.substring(0, 1).toUpperCase() + outputFileCategory.substring(1, outputFileCategory.length());
    
    
            inputFile = new File(inputFilePath);
    
            inputStream = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile)));
    
            outputLines = "";
    
            for(line = inputStream.readLine(); line != null; line = inputStream.readLine())
            {
                vars = line.split("=");
                c = vars[0];
                if(c.substring(0, 1) == "#") continue;
                outputLines += "\t\tpublic static const " + c + ":String = \"" + c + "\";\n";
            }
    
            output = "";
            output  = "package " + outputFilePackage + "\n"
                    + "{\n"
                    + "\tpublic final class " + outputFileClass + "\n"
                    + "\t{\n"
                    + outputLines
                    + "\t}\n"
                    + "}";
    
    
            outputFilePath = outputFileDir + "/" + outputFileClass+ ".as";
    
            out = new BufferedWriter(new FileWriter(outputFilePath));
            out.write(output, 0, output.length);
            out.flush();
            out.close();
        ]]>
    </scriptdef>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build my ear file once and then use ant to change
I want to execute an ant build through java code. I use the following
I want to use the same ant script to do a build in either
I use an ANT build file to build my project and also generate the
I want to include a jar file ( ant-contrib.jar ) in my ant build.xml
I use Ant to build my Android application. I want to be able to
I use Ant to build Delphi applications (called from CruiseControl). I want ant to
How do I use Ant ( bb-ant-tools ) to compile a JAR file into
I want use page that has this form: <form method=post action=modules.php?name=search> <input onkeypress=FKeyPress(this); onkeydown=FKeyDown(this);
I have a transaction log file in CSV format that I want use to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.