ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus M. May" <m...@gmx.net>
Subject Re: one more problem
Date Mon, 20 Feb 2006 14:04:46 GMT
Hi, to get the Locale from the file you can use the propertyregexp-Command:

      <propertyregex property="file.name"
              input="${base.in.file}"
              regexp="^(.*)[_]{1}(.*)\.class$$"
              select="\2"
              casesensitive="false" />

This will give you the locale of the file. This could also be used, with
some modifications for other transformations.

Greets

markus m. may

> --- Urspr√ľngliche Nachricht ---
> Von: Paul Pogonyshev <p.pogonyshev@finamatics.com>
> An: user@ant.apache.org
> Betreff: one more problem
> Datum: Mon, 20 Feb 2006 15:28:13 +0200
> 
> Hi,
> 
> I'm stuck again :(
> 
> I need to translate the following part of a shell script to Ant (with
> Ant-Contrib in place; using external `sed' is not an option, I want
> to minimize dependencies for Windows boxes):
> 
> 
> for PO_FILE in *.po; do
>   LOCALE=$(echo "$PO_FILE" | sed -e 's/\.po$//')
>   RESOURCE_FILE=$(echo "$RESOURCE_NAME" | sed -e "s/\./\//g")
>   CLASS_FILE="$RESOURCE_DIRECTORY/${RESOURCE_FILE}_$LOCALE.class"
> 
>   if test "$CLASS_FILE" -ot "$PO_FILE"; then
>     mkdir -p "$RESOURCE_DIRECTORY"/$(echo "$RESOURCE_NAME" | sed -e
> "s/^[^.]\+$//" -e "s/\.[^.]\+$//" -e "s/\./\//g")
>     msgfmt  --java2			\
> 	    --resource="$RESOURCE_NAME"	\
> 	    --locale="$LOCALE"		\
> 	    -d"$RESOURCE_DIRECTORY"	\
> 	    --check --statistics	\
> 	    "$PO_FILE"
>   fi
> done
> 
> 
> I'm having problems with variable calculation.  RESOURCE_NAME in
> the script has the form of `org.foo.bar.L10n', how do I compute
> `org/foo/bar/L10n' out of it in Ant?
> 
> Also, I'd like to compute the locale out of file name, though
> this is not important.
> 
> Thanks in advance,
>   Paul
> 
> ---------------------------------------------------------------------
> 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