Welcome to Geeklog Monday, May 20 2019 @ 10:34 am EDT

Geeklog Forums

multilingual featered story


Status: offline

suvi

Forum User
Chatty
Registered: 20/11/05
Posts: 44
Location:Zurich

There can be only one featured story and storys don't support php so far.
I needed to make a biligual site (english/german). So I made this ugly
hack in index.php in order to have the featured story adjusted to the
selected language:

if ( !empty ($_USER['language'])) {
$lang = $_USER['language'];
} elseif ( !empty ($_COOKIE['language'])) {
$lang = $_COOKIE['language'];
} else {
$lang = $_language_default;
}
if ( strtolower($lang) == "english_utf-8" ) {
//we don't do anthing, because the featured story is allready in english.
} else {
//now following the german context
$A['introtext']= 'Zurich Telecom blablabla...';
$A['title'] = 'Wilkommen bei Zurich Telecom!';
}

// display first article
$display .= STORY_renderArticle ($A, 'y');


The STORY_renderArticle() Function just plots out the other text.
It's ugly, it's small and it works.

This hack works on GL 1.4 beta 1 . Anyone with a nicer hack please post.

Cheers
Suvi and jump good to 2006 from switzerland.

Status: offline

LWC

Forum User
Full Member
Registered: 19/02/04
Posts: 818
Why just the featured story? I see you use - at least partially - the original multilingual hack by Euan.

Euan's code is outdated and was later fixed and improved by yours truly - especially since Euan's version stopped working once Geeklog was upgraded. My code's purpose is to achieve the same thing, but while interfering as less as possible with Geeklog's core.

If you use it, your visitors could choose a language (via a cookie) and will only see topics and stories (and in my new version, also polls) in that language.

I've kept my hack updated in the "feature request" sub-site, which is down currently.

And I don't know where else to keep this code, so I've just opened a new topic just for my own hack. I would always keep it updated there from now on.

All times are EDT. The time is now 10:34 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content