ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Load tokens from a file into list
Date Tue, 13 Feb 2007 15:47:08 GMT
Mmmh .... just a quick shot ....

Have you tried a combination of copy, filterchain and linetokenizers?
Maybe you have luck there ...


Jan

>-----Ursprüngliche Nachricht-----
>Von: Marcel Stör [mailto:marcel@frightanic.com] 
>Gesendet: Dienstag, 13. Februar 2007 16:11
>An: user@ant.apache.org
>Betreff: Load tokens from a file into list
>
>I'd like to do some text substitution/translation in an XML file.
>
>Source:
>[...]
><!-- locale-token1 -->
>[...]
><!-- locale-token2 -->
>
>Target:
>[...]
><foo locale="en">
>	<title>My title</title>
>	<description>My description</description>
></foo>
><foo locale="de">
>	<title>Mein Titel</title>
>	<description>Meine Beschreibung</description>
></foo>
>[...]
>
>On the file system I'd have resource files such as 
>resources_en.properties, resources_de.properties, etc. containing 
>key/value pairs for the tokens such as:
>locale-token1.title = My title
>locale-token1.description = My description
>
>
>I thought I could implement this as a two-phase process:
>
>1. replace each token with the basic XML structure. So, <!-- 
>locale-token1 --> would then be replaced with
><foo locale="en">
>	<title>en.locale-token1.title</title>
>	<description>en.locale-token1.description</description>
></foo>
><foo locale="de">
>	<title>de.locale-token1.title</title>
>	<description>de.locale-token1.description</description>
></foo>
>-> antcontrib foreach task
>2. Replace all remaining tokens with the content of defined in the 
>corresponding resource files.
>-> Ant replace task with properties files
>
>
>Are there easier ways to achieve this? How would I parse my 
>source file 
>in the first place to obtain a list of all tokens (to feed to the 
>foreach task)?
>
>-- 
>Marcel Stör, http://www.frightanic.com
>Blog: http://frightanic.wordpress.com
>Skype: marcelstoer
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message