Форуми / Cotonti / Extensions / Multilanguage and news plugin


#1 09.09.2010 05:11

I have a question...What if I want to use multilanguage news items.

The news plugin lets you use {INDEX_NEWS}, but i really want something like
{INDEX_{PHP.usr.lang}-news} (if you get my drift.. :) )

Where I have the following categories:


What is/are the best way(s) to solve this...

==- I say: Keep it EZ -==
#2 09.09.2010 16:09
Rewrite the news plugin I guess (and release it here). I think you should keep the news category as a fallback (the default language) and use 'en-news' if the user has english configured (dutch being the default) and just 'news' for dutch users.

if (usr.lang != cfg.defaultlang) ...
#3 09.09.2010 17:35
Hi Gert,

Tnx..I am already rewriting the news plugin for language support... ;)
And got it to work!!

Index Template (TPL):
<div class="block">

In the news.php i do:
  $ttmp=sed_get_news($v[0], "news.".$v[0], $v[1], $dadd, $v[2]);
  $t->assign("INDEX_NEWS_".strtoupper($v[0]), $ttmp);
  //sed_watch("INDEX_NEWS_".strtoupper($usr['lang'])."_".strtoupper($v[0]), $ttmp);
  $t->assign("INDEX_NEWS_".strtoupper($usr['lang'])."_".strtoupper($v[0]), $ttmp);

My pagecategories are named:

Notice the use of '_' instead of '-'
It turned out that Xtemplate cannot use '-' in the assign ?????

And I got separate tpl files for all separate news cats..
You cannot use the rewrite rules from the i18n example.. it needs '_'.

Good idea about the original news cat as a fallback, I will use that!

Releasing it will be difficult, because i have a custom news plugin..
I use a half baked 0.9 news plugin with additional hooks and other stuff I changed.
==- I say: Keep it EZ -==
#4 09.09.2010 21:29
Sick, this is nice.. will follow this closely :D
#5 14.09.2010 04:16
I keep on busy with this multilanguage site... :)

I am now adding very nice stuff to the recentitems plugin.
So this will become language aware (as I call it).. (optinal off course)

But I am still wondering.... Why must I make these things..
Shouldn't this be in the standard cotonti package ?? (I mean this is NO rocket science I am making)

What do others think off multilanguage in the default Cot ??

I am asking this because I am making to much 'corehacks', so upgrading will be more difficult for me, and that is something I would like to avoid...

Added 56 days later:


I see in the project tracker that you are starting Internationalization... :D

I have some things already made and some 'good' ideas.
Maybe I can help ?
==- I say: Keep it EZ -==

Відредаговано: ez (10.11.2010 04:13, 13 років тому)
#6 10.11.2010 05:47
Sorry, I'm not posting any technical details on its implementation until the work is actually finished. It works on top of structure and pages without affecting them, as a plugin that stores i18n data in separate tables and provides interface for translation editing.
May the Source be with you!
#7 10.11.2010 06:07
no prob..
==- I say: Keep it EZ -==