The first step would be to create the resource files
(NAnt.Core.en-US.resx,
NAnt.DotNet.Task.en-US.resx, etc.),

we can just start with NAnt.Core.resx for the default ( US english ) language.

then replace hardcoded strings with
RM.GetString("Message_Id") - or whatever name you want, and finally add
the following target into the different NAnt build files:

 <target
   name="build-resources"
   depends="init"
   description="Builds resource binaries">
   <foreach
     item="String"
     in="de-DE,en-US,es-ES,fr-FR,it-IT"
     delim=","
     property="culture">
     <mkdir
       dir="${build.dir}/${package.name}/lib/${culture}"
       failonerror="false" />
     <resgen
       input="${assembly}.${culture}.resx"

output="${build.dir}/${package.name}/lib/${culture}/${assembly}.${cultur
e}.resources" />
   </foreach>
 </target>

You should also modify the <build> target in order to let the C#
compiler
embed the default resource (en-US) in the NAnt assemblies (for other
languages
we generate satelite assemblies):

 <target
   name="build"
   depends="init build-resources"
   description="Builds the binaries for the current configuration">
   ...
   <property
     name="default.resources"
     value="en-US/${assembly}.en-US.resources,${assembly}.resources" />
   <foreach
     item="String"
     in="de-DE,es-ES,fr-FR,it-IT"
     delim=","
     property="culture">
     <al
       target="library"

output="${build.dir}/${package.name}/lib/${culture}/${assembly}.resource
s.dll"
culture="${culture}">
<sources basedir="${build.dir}/${package.name}/lib/${culture}">
<include name="*.resources" />
</sources>
</al>
</foreach>
<csc ...>
...
<arg
value="-res:${build.dir}/${package.name}/lib/${default.resources}" />
</csc>


we can use the <resources> child element for this - thats what its for :). You can even add the resx files ( even the international ones ) to that and the <csc> task will do the right thing - ie create child directories for each culture and run the <al> task.

 </target>

If you want I can help you... just let's coordinate. Have you already
run sed to extract all the hardcoded string from the code?



Sure - thanks. I haven't got the NAnt source with me right now ( at work ) so no I haven't run sed. If you'd like to start on that - by all means go ahead.

Ian



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to