Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Multilingual Addon/Mod  (Read 4878 times)

Rob

  • Full Member
  • ***
  • Karma: 1
  • Posts: 219
    • http://www.ruthinweather.co.uk
Multilingual Addon/Mod
« on: February 19, 2007, 02:27:28 pm »

Ok guys I have checked out every square millimetre of this forum and it looks to me that no one has done a mulitlingual Mod to sNews.

I am now living in Wales and everyone here wants multilingual capablilites, therefore I have no option but to hack sNews to allow this.

Could anyone give me some pointers on where to start with hacking sNews or will it best for me just to play around with it myself?
Logged
The road the righteous travel is like the sunrise, getting brighter and brighter until daylight has come.

brauck

  • Hero Member
  • *****
  • Karma: 18
  • Posts: 556
    • http://www.hbw-webdesign.nl/
Multilingual Addon/Mod
« Reply #1 on: February 19, 2007, 03:34:07 pm »

Maybe two (or more) instances of snews.php in separate folders with an entrance page in the root letting the visitor choose which language he/she prefers. You can have one db using prefixes. Some modding has to be done though, for example a cookie should be placed with the language preference of the visitor. Just thinking aloud.   :)
Logged
Confidence is reduced complexity.
brauck.nl for free css templates

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Multilingual Addon/Mod
« Reply #2 on: February 19, 2007, 04:41:11 pm »

There has been some activities regarding this area: multilingual anyone?.

Unfortunately, all somehow inconclusive ones or focusing only on interface language ;D

I'd say one set of snews and included mods, several language variable files needed and solution to following issues:
 - interface/session language
 - content/record language

Interface language should be easy one way or another to maintain.

Content language will be a little bit more tricky unless content in each language is maintained independently. If there is need for smooth language management (like switching languages while showing the same article for example) then sNews doesn't exactly shine as CMS of choice. I doubt that this could be made as MOD as it will require cutting through most of sNews native functions. Right term for this kind of solution will be FORK.

« Last Edit: September 24, 2007, 12:39:42 pm by codetwist »
Logged

Luka

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 36
  • Posts: 1717
    • http://www.snewscms.com
Multilingual Addon/Mod
« Reply #3 on: February 19, 2007, 05:09:03 pm »

Why not just creating another sNews installation on the same db with a prefix?

Modding sNews will result in much more code then it is now to get the same result as another sNews copy. No CMS will translate articles flawlessly for you which means you have to enter them yourself.
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Multilingual Addon/Mod
« Reply #4 on: February 19, 2007, 05:26:36 pm »

If no language switching needed in active context and content is independent then why not. That's different sites basically.
« Last Edit: September 24, 2007, 12:40:15 pm by codetwist »
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Multilingual Addon/Mod
« Reply #5 on: February 19, 2007, 06:17:20 pm »

Quote from: Grudgeuk
Could anyone give me some pointers on where to start with hacking sNews or will it best for me just to play around with it myself?
If you are going to hack anyway...

The way I see it.
a new table in db -- 2 fields only,
1) short_lang, 3 characters, primary key, unique
2) long_lang say 25 chars
Populate with values like eng english

a new field in the article table say    site_lang
a new field in categories table for the same
in admin, a dropdown box somewhere pulling values from  language table

on your site, you will need to have some switching links. The values available to them will come from language table --- set up in a form, and use images for form buttons... eg the ubiquitous little flags

The selection from the switching will be used in relevant sql calls, to pull only things that match site_lang value. update sqls will also need to be tweaked

You will have to write and layout each article,page,extra for each language used, and the same for each category.

snews in another directory, but using same db sounds so much easier.   :rolleyes:
Logged
Of all the things I have lost, it is my mind that I miss the most.

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Multilingual Addon/Mod
« Reply #6 on: February 19, 2007, 06:32:01 pm »

try something....
set up a new snews install in a new directory.. so that it is a fully functional independant site (use prefix).

Then, at the top of your root (original) index.php, where it says include('snew.php'), replace it with
if (file_exists('NEWFOLDER/snews.php'){include('NEWFOLDER/snews.php');}else{include('snew.php');}
If that operates as expected (which is that it will use the new snews.php in the original layout), then you make your switching links to affect the original include call  ie, include('snew.php'); would become include($snews_lang_select);  

You will have to ensure the selected lang gets written to the session var so as to keep the selection active... I think....

should work in theory... :)
Logged
Of all the things I have lost, it is my mind that I miss the most.

Rob

  • Full Member
  • ***
  • Karma: 1
  • Posts: 219
    • http://www.ruthinweather.co.uk
Multilingual Addon/Mod
« Reply #7 on: February 20, 2007, 09:05:21 am »

Thanks for all the advice - food for thought and looks like a bg task whatever.
Logged
The road the righteous travel is like the sunrise, getting brighter and brighter until daylight has come.

vix

  • Newbie
  • *
  • Karma: 1
  • Posts: 22
Multilingual Addon/Mod
« Reply #8 on: February 22, 2007, 02:28:00 pm »

Quote from: Luka
Why not just creating another sNews installation on the same db with a prefix?

Modding sNews will result in much more code then it is now to get the same result as another sNews copy. No CMS will translate articles flawlessly for you which means you have to enter them yourself.
This is, by far, much easier to do. There is also good guidance from keyrocks as how to go around to creating database table prefixes here: http://www.solucija.com/forum/viewtopic.php?pid=16347#p16347

What you need to do next is create a directory for each language, droping in the index.php and the snews.php (which will be looking into the specific tables - and the exact address of the website at $db['website'] )

This is fantastic!! You CAN create a website in as many different languages as you like!!

(without any hassle)
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Multilingual Addon/Mod
« Reply #9 on: February 22, 2007, 08:38:07 pm »

Quote from: vix
What you need to do next is create a directory for each language, droping in the index.php and the snews.php (which will be looking into the specific tables - and the exact address of the website at $db['website'] )
This is fantastic!! You CAN create a website in as many different languages as you like!!
(without any hassle)
Yes... indeed. You can use the same index.php over and over for each installation so that you have the same template in all installs... a user would never notice that there were different sites for different languages. The way to go would be to name each installation folder with a shortlanguage name... like en for the english site and fr for the french site and sp for the spanish site... and so one... so that the URLs would look like
Quote
http://www.yoursite.com/en/ - for english site
http://www.yoursite.com/fr/ - for french site
http://www.yoursite.com/sp/ - for the spanish site
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Mika

  • Hero Member
  • *****
  • Karma: 9
  • Posts: 1377
    • http://www.ni5ni6.com/
Multilingual Addon/Mod
« Reply #10 on: February 23, 2007, 09:54:32 am »

Phil offer a nice solution:
- another article language column and/or table

... regarding switcher:
- you could use a cookie to recognize a language which could be set via GeoIP application or a simple language selector link
- we already have multilingual UI feature which could also be tweaked accordingly
- depending on the cookie value (EN, FR, DE, IT .... whichever you need) snews mysql queries could be modified to recognize and display contents based on it
Quote
# example
$LangCookie = 'EN'; // value obtained from cookie
$query = "SELECT * FROM ".db('prefix')."articles WHERE language = '$LangCookie' AND published = 1";
/*
Note: categories, comments etc... should follow the same behaviour
*/
- pros: less stress on your site resources: smaller db, less storage used, probably better performance than several snews installations (but don't quote me on that ;) - never been tested in that context)
- cons: depending on your PHP skills, substantial amount of time spent on modifying the core

If you're planning on using multiple databases or prefixed tables (much better choice, afaik), you could use similar solution
Quote
# example
$LangCookie = 'EN_'; // value obtained from cookie
$query = "SELECT * FROM ".db('prefix').$LangCookie."articles WHERE published = 1";
/*
Note: tables should be named like this
- english
PREFIX_EN_articles
PREFIX_EN_categories
PREFIX_EN_comments
- deutch
PREFIX_DE_articles
PREFIX_DE_categories
PREFIX_DE_comments
*/
Logged
http://www.ni5ni6.com/ - Tutorials, Mods and How-To's about sNews CMS
sNews 1.6 Developers Edition - commented sNews 1.6 version

tobto

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 71
    • seo service
Multilingual Addon/Mod
« Reply #11 on: February 28, 2007, 12:13:10 am »

hi -
the question is: I try to publish article in Slavic language.
What I have to do to publish 'Search engine friendly'  line in Slavic?
It goes empty.
Thanks.
Yuri
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Multilingual Addon/Mod
« Reply #12 on: February 28, 2007, 01:20:38 pm »

There is javascript function inside snews.php that does preparation of SEF:
Code: [Select]
// generate SEF urls
function genSEF(from,to) {
...
You should change it to allow something else except pure ASCII.
« Last Edit: September 24, 2007, 12:40:53 pm by codetwist »
Logged

tobto

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 71
    • seo service
Multilingual Addon/Mod
« Reply #13 on: February 28, 2007, 01:36:27 pm »

THX, Valdis! Will try.
Cheers.
Logged