Re: Patch to make some strings available to translations - Mailing list pgsql-www
| From | Guillaume Lelarge |
|---|---|
| Subject | Re: Patch to make some strings available to translations |
| Date | |
| Msg-id | 47E52489.7030608@lelarge.info Whole thread Raw |
| In response to | Re: Patch to make some strings available to translations (Guillaume Lelarge <guillaume@lelarge.info>) |
| Responses |
Re: Patch to make some strings available to
translations
|
| List | pgsql-www |
Guillaume Lelarge a écrit :
> Guillaume Lelarge a écrit :
>> Magnus Hagander a écrit :
>> [...]
>>> I think we need something like func_image('hdr_featureduser.png'),
>>> and then have the framework take care of that one.
>>>
>>
>> Which means we need to modify the framework ? that'll be a much bigger
>> work than what I intended to do. Anyways, I'll get a look at it.
>>
>
> I guess I was wrong. You'll find a patch attached that implements a
> func_image function via a call to setCallbackFunction.
>
> I can also send a complete patch (the previous one which adds
> translation to some texts, and this patch).
>
And now with the patch... sorry about this...
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
Index: system/global/pgpage.php
===================================================================
--- system/global/pgpage.php (révision 2004)
+++ system/global/pgpage.php (copie de travail)
@@ -2,6 +2,12 @@
// $Id: pgpage.php,v 1.6 2007-10-21 17:20:07 mastermind Exp $
// Base-class for all pages
//
+
+function getimage($arg) {
+ global $pgpage;
+ return '"/layout/images/'.$pgpage->getLanguage().'/'.$arg.'"';
+}
+
abstract class PgPage {
protected $language;
protected $language_direction;
@@ -87,6 +93,7 @@
$locale = $this->language;
if (isset($_LANGUAGE_ALIASES[$this->language]))
$locale = $_LANGUAGE_ALIASES[$this->language];
+ $locale .= '.UTF-8';
putenv('LANG=' . $locale);
putenv('LANGUAGE=' . $locale);
@@ -104,6 +111,10 @@
header('Content-Language: ' . $this->language);
}
+ public function getLanguage() {
+ return $this->language;
+ }
+
private function getLanguageFromHeaders() {
global $_LANGUAGES;
@@ -122,6 +133,7 @@
// Prepare the template
$this->tpl =& new HTML_Template_Sigma('../template');
$this->tpl->setCallbackFunction('lang', 'gettext', true);
+ $this->tpl->setCallbackFunction('image', 'getimage', true);
$this->tpl->loadTemplateFile($this->base_template, true, true);
$this->tpl->setGlobalVariable(array(
'site_title' => $_SETTINGS['site_title'],
Index: template/index.html
===================================================================
--- template/index.html (révision 2004)
+++ template/index.html (copie de travail)
@@ -24,7 +24,7 @@
<div id="pgFrontUser">
<div id="pgFrontUserInner">
<div id="pgFrontUserWrap">
- <h2><img src="/layout/images/en/hdr_featureduser.png" width="104" height="10" alt="Featured User"
/></h2>
+ <h2><img src=func_image('hdr_featureduser.png') width="104" height="10" alt="Featured User"
/></h2>
<div id="pgFrontUserContent">
<!-- INCLUDE about/quotes-index.html -->
<div id="txtFrontUserLink">
@@ -39,7 +39,7 @@
</div>
<div id="pgFrontRightContainer">
<div id="pgFrontLatestReleases">
- <h2><img src="/layout/images/en/hdr_latestreleases.png" width="120" height="10" alt="Latest Releases"
/></h2>
+ <h2><img src=func_image('hdr_latestreleases.png') width="120" height="10" alt="Latest Releases" /></h2>
<div id="pgFrontLatestReleasesWrap">
<!-- BEGIN front_release_loop -->
<b>{version}:</b> <a href="/ftp/source/v{version}">Source</a> · <a
href="/ftp/binary/v{version}">Binary</a>· <a href="/docs/{majorver}/static/{relnotes}">Notes</a>
@@ -49,7 +49,7 @@
<div id="pgFrontLatestReleasesNote"><a href="/versions.rss" title="func_lang('Versions RSS Feed')"><img
class="pgRSSImage"src="/layout/images/ico_rss.png" width="28" height="13" alt="func_lang('Versions RSS Feed')" /></a> |
<ahref="/support/versioning">Why should I upgrade?</a></div>
</div>
<div id="pgFrontShortcuts">
- <h2><img src="/layout/images/en/hdr_shortcuts.png" width="85" height="10" alt="Shortcuts" /></h2>
+ <h2><img src=func_image('hdr_shortcuts.png') width="85" height="10" alt="Shortcuts" /></h2>
<div id="pgFrontShortcutsWrap">
<ul id="pgFrontShortcutsList">
<li>
@@ -77,7 +77,7 @@
</div>
</div>
<div id="pgFrontSupportUs">
- <h2><img src="/layout/images/en/hdr_supportus.png" width="81" height="10" alt="Support Us" /></h2>
+ <h2><img src=func_image('hdr_supportus.png') width="81" height="10" alt="Support Us" /></h2>
<div id="pgFrontSupportUsWrap">
<div id="txtFrontSupportUsText">
func_lang("PostgreSQL is free. Please support our work by making a <a
href=\"/about/donate\">donation</a>").
@@ -88,7 +88,7 @@
<div id="pgFrontBottomContainer">
<div id="pgFrontNews" class="txtNewsEvent">
<a href="/about/newsarchive">
- <img src="/layout/images/en/hdr_latestnews.png" width="90" height="10" alt="Latest News" />
+ <img src=func_image('hdr_latestnews.png') width="90" height="10" alt="Latest News" />
</a>
<div class="pgNewsEventsWrap">
<!-- INCLUDE about/news-index-loop.html -->
@@ -110,7 +110,7 @@
</div>
<div id="pgFrontPlanet">
<a href="http://www.planetpostgresql.org">
- <img src="/layout/images/en/hdr_planetpg.png" width="140" height="10" alt="Planet PostgreSQL" />
+ <img src=func_image('hdr_planetpg.png') width="140" height="10" alt="Planet PostgreSQL" />
</a>
<div id="pgFrontPlanetWrap">
<!-- BEGIN planet_loop -->
@@ -134,13 +134,13 @@
</div>
<div id="pgFrontEvents" class="txtNewsEvent">
<a href="/about/eventarchive">
- <img src="/layout/images/en/hdr_upcomingevents.png" width="123" height="10" alt="Upcoming Events" />
+ <img src=func_image('hdr_upcomingevents.png') width="123" height="10" alt="Upcoming Events" />
</a>
<div class="pgNewsEventsWrap">
<!-- INCLUDE about/events-index-loop.html -->
</div>
<a href="/about/eventarchive">
- <img src="/layout/images/en/hdr_upcomingtraining.png" alt="Upcoming training" />
+ <img src=func_image('hdr_upcomingtraining.png') alt="Upcoming training" />
</a>
<div class="pgNewsEventsWrap">
<div id="pgFrontTrainingSummary">