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 <[EMAIL PROTECTED]>
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to