page.tmpl: use OTHERLANGUAGES and PERCENTTRANSLATED

Signed-off-by: intrigeri <intrigeri@boum.org>
master
intrigeri 2009-03-28 11:41:21 +01:00
parent a4d7ee2559
commit 055be361f5
2 changed files with 26 additions and 27 deletions

View File

@ -150,24 +150,9 @@ display things only on translatable or translation pages.
The `OTHERLANGUAGES` loop provides ways to display other languages' The `OTHERLANGUAGES` loop provides ways to display other languages'
versions of the same page, and the translations' status. versions of the same page, and the translations' status.
One typically adds the following code to `templates/page.tmpl`: An example of its use can be found in the default
`templates/page.tmpl`. In case you want to customize it, the following
<TMPL_IF NAME="OTHERLANGUAGES"> variables are available inside the loop (for every page in):
<div id="otherlanguages">
<ul>
<TMPL_LOOP NAME="OTHERLANGUAGES">
<li>
<a href="<TMPL_VAR NAME="URL">"><TMPL_VAR NAME="LANGUAGE"></a>
<TMPL_UNLESS NAME="MASTER">
(<TMPL_VAR NAME="PERCENT">&nbsp;%)
</TMPL_UNLESS>
</li>
</TMPL_LOOP>
</ul>
</div>
</TMPL_IF>
The following variables are available inside the loop (for every page in):
* `URL` - url to the page * `URL` - url to the page
* `CODE` - two-letters language code * `CODE` - two-letters language code
@ -178,15 +163,8 @@ The following variables are available inside the loop (for every page in):
### Display the current translation status ### Display the current translation status
The `PERCENTTRANSLATED` variable is set to the translation The `PERCENTTRANSLATED` variable is set to the translation
completeness, expressed in percent, on "slave" pages. completeness, expressed in percent, on "slave" pages. It is used by
the default `templates/page.tmpl`.
One can use it this way:
<TMPL_IF NAME="ISTRANSLATION">
<div id="percenttranslated">
<TMPL_VAR NAME="PERCENTTRANSLATED">
</div>
</TMPL_IF>
Additional PageSpec tests Additional PageSpec tests
------------------------- -------------------------

View File

@ -28,6 +28,9 @@
</span> </span>
<span class="title"> <span class="title">
<TMPL_VAR TITLE> <TMPL_VAR TITLE>
<TMPL_IF NAME="ISTRANSLATION">
(<TMPL_VAR NAME="PERCENTTRANSLATED">&nbsp;%)
</TMPL_IF>
</span> </span>
</span><!--.header--> </span><!--.header-->
<TMPL_IF NAME="SEARCHFORM"> <TMPL_IF NAME="SEARCHFORM">
@ -60,6 +63,24 @@
</ul> </ul>
</div> </div>
</TMPL_IF> </TMPL_IF>
<TMPL_IF NAME="OTHERLANGUAGES">
<div id="otherlanguages">
<ul>
<TMPL_LOOP NAME="OTHERLANGUAGES">
<li>
<a href="<TMPL_VAR NAME="URL">"><TMPL_VAR NAME="LANGUAGE"></a>
<TMPL_IF NAME="MASTER">
(master)
<TMPL_ELSE>
(<TMPL_VAR NAME="PERCENT">&nbsp;%)
</TMPL_IF>
</li>
</TMPL_LOOP>
</ul>
</div> <!-- #otherlanguages -->
</TMPL_IF>
</div> <!-- .pageheader --> </div> <!-- .pageheader -->
<TMPL_IF SIDEBAR> <TMPL_IF SIDEBAR>