forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyriaque Dupoirieux <Cyriaque.Dupoiri...@pcotech.fr>
Subject Re: [sitemap.xmap] How to access a new ant property ?
Date Tue, 12 Jul 2005 07:58:01 GMT
Thorsten Scherler a écrit :

>On Mon, 2005-07-11 at 15:43 +0200, Cyriaque Dupoirieux wrote:
>  
>
>>Hi,
>>
>>    I added a new property : project.locale set in init-props in 
>>forrest.build.xml - just as forrest.home is.
>>    I init - in forrest-core.xconf - the component-instance 
>>name="project" class="org.apache.forrest.conf.ForrestConfModule" with 
>>the new property :
>>        <locale>@project.locale@</locale>
>>    I try to use it in sitemap.xmp :
>>        <map:transform type="i18n">
>>              <map:parameter name="locale" value="{project:locale}"/>
>>            </map:transform>
>>    And the value of my locale - known with a System.out added in 
>>org.apache.forrest.conf.ForrestConfModule class - is always @project.locale@
>>
>>    Any Idea ? (will be welcome because I am close to find a pretty 
>>solution to use $LANG variable to generate the static site.)
>>
>>    
>>
>
>You did everything right!!!
>  
>
I know :-) !

>I just tried it with adding the following to forrest.build.xml in the
>"init-props" target.
><property name="project.view-skin" value="target-x"/>
><echo>test: ${project.view-skin}</echo>
>
>and then in forrest-core.xconf into the same instance
><view-skin>@project.view-skin@</view-skin>
>
>Then I used in the internal.xmap in views
><map:transform src="resources/stylesheets/viewLocationmap.xsl">
> <map:parameter value="{project:view-skin}" name="project.view-skin"/>
></map:transform>
>
>and in this stylesheet
><xsl:param name="project.view-skin">not found</xsl:param>
><!--...-->
><xsl:comment>
>  project.view-skin: <xsl:value-of select="$project.view-skin"/>
></xsl:comment>
>
>I did then a *build* of forrest and my plugin (not shown).
>cd $FORREST_HOME/main
>./build.sh clean; ./build.sh
>
>Changed to my project and added the new property to forrest.properties
>project.view-skin=just a test :)
>  
>
Ok, I had made the same test, but I didn't wanted to init the property 
in a properties file, I want to get your LANG environment variable.
If this step is skipped and if you just initialize the property in ant, 
the property is not taken into account...

>Last step was running forrest in dyn mode (forrest run).
>
>Then I got:
>1) starting up (from the shell):
>test: just a test :)
>2)requesting the test page:
><!--project.view-skin: just a test :)-->
>
>So the only thing that you may forgot is ¿building forrest?
>
>...but all the above is only true if you called your variable
>project.someName because "project" get filtered. In the
>forrest.build.xml you can find:
><echoproperties prefix="project" destfile="${projfilters}"/>
><filter filtersfile="${projfilters}"/>
>
>Which will take care to replace @tokens@. You can control that searching
>for project.someName in $PROJECT_HOME/tmp/projfilters.properties.
>
>Some useful links:
>http://ant.apache.org/manual/CoreTasks/filter.html
>http://ant.apache.org/manual/CoreTasks/replace.html
>
>
>-->i18n<--
>...if your plan is to replace all i18n definitions in the sitemaps, that
>is an awesome idea but what is wrong with using the 'project.i18n'
>parameter we already have?
>
>Would save you the time doing the above and do we really need 'local'
>and 'i18n'?
>  
>
i18n is to enable translation, locale is to define the language when 
generating the static site.
I want to be able to do this :

    export LANG=fr; forrest
    export LANG=de; forrest


if i18n is true then I set the language (locale) using the env.LANG 
variable.

>Another question is how do you override it later in the dyn mode for the
>requests of a client? Would that not permanently determine the outputted
>language? 
>  
>
If the site is not static - forrest run - I keep the request:language in 
sitemap.xml so that your browser will decide the locale.

>salu2
>
>P.S. diff attached for clarifications:
>Index: forrest.build.xml
>===================================================================
>--- forrest.build.xml   (revision 210207)
>+++ forrest.build.xml   (working copy)
>@@ -44,9 +44,6 @@
>   <property name="forrest.core"
>location="${forrest.home}/main"/>
>   <property name="forrest.core.webapp"
>location="${forrest.core}/webapp"/>
>
>-
>-
>-
>   <import file="targets/validate.xml"/>
>   <import file="targets/webapp.xml"/>
>   <import file="targets/site.xml"/>
>@@ -98,7 +95,9 @@
>     <property file="${project.home}/forrest.properties" />
>     <property file="${user.home}/forrest.properties" />
>     <property
>file="${forrest.core.webapp}/default-forrest.properties" />
>-
>+    <property name="project.view-skin" value="default"/>
>+    <echo>test: ${project.view-skin}
>+      </echo>
>     <!-- people should use forrest.properties to override following
>defaults  -->
>     <property name="build.plugins-dir"     value="build/plugins"/>
>     <property name="forrest.skins-dir"
>location="${forrest.core.webapp}/skins"/>
>Index: webapp/WEB-INF/xconf/forrest-core.xconf
>===================================================================
>--- webapp/WEB-INF/xconf/forrest-core.xconf     (revision 210207)
>+++ webapp/WEB-INF/xconf/forrest-core.xconf     (working copy)
>@@ -135,6 +135,7 @@
>
>     <component-instance name="project"
>class="org.apache.forrest.conf.ForrestConfModule">
>       <values>
>+        <view-skin>@project.view-skin@</view-skin>
>         <skin>@project.skin@</skin>
>         <sitemap>@project.home@/@project.sitemap@</sitemap>
>         <status>@project.home@/@project.status@</status>
>
>  
>

Mime
View raw message