Leonardo Prosperi's website

My first step on the web

SML 0.9 for sNews

Symmetric Multi-Language MOD 0.9 for sNews 1.6.0, I changed again the name of my mod.
Why symmetric? Because it makes articles and categories "symmetric" among the different languages.
Any articles are publishable in one or more languages, in this case the articles share comments, the publication date, the category, and SEF link.
From the previous release (0.8), I fixed the admin side and I made the article publication independent for each language.
It is possible to switch among languages easily, just changing the path:
You can see how it works here, in my web site. The last release is based on sNews 1.6.0, it is an individual package, and it can be installed from scratch or on an existing installation of sNews. In the case of an existing installation, all others mods have to be installed again.
Please download it here: sNews16SML.rar.

15.06.2007. 17:56

dandyna on 19.06.2007. 01:46

gran bel lavoro, bravo

codetwist on 13.07.2007. 07:17

Hi, there ;) Any news on SML front?

martin on 01.08.2007. 07:26

Great work!!!
But what's the major change on the structure? I have simple snews1.6 installed. I have my actually a base language. So i make the changes (which are in the readme file).
I setup the Database for an additional language: That means that i dont have to do this for my basic language? And also create the file snews_xx.php for my additional lang? The basic language variables are defined in snews.php, right?
And when a new article has to be written: Write the article in the basic lang and then switch to teh additional lang?
How to create the language - switch link? manually in the index.php?
Great thanks for that mod and greetings to italy (i ll went on vacation to italy this WE yeaa:-)).

Leonardo on 03.08.2007. 19:33

@ codetwist
No yet updates for SML. I was busy lately. If you have any suggestions, please post them.

@ martin
First, SML supposes that your base language is English.
The basic language (english) variables are defined in snews.php. The second language variables are in snews_xx.php (I remind you to change xx to your language.).
In your database, you add the fields only for the second language.
Then you login in english, write the article, change language (clicking in yoursite.com/xx/), re-edit the article in the second language.
Do you want add SMT to an existing website or start from scratch? Which languages do you need?

Chrus on 04.08.2007. 07:33

Is the language variable case sensitive? I have some problems maybe because ($_SESSION['langx']=="EN") is in capitals and en is in small letters.

Maybe it can really help if the readme.html File contents a sample, like:
Modify the MySQL database with this code, changing xx with the 2 letter code of your language (example: IT):
Create a file: snews_XX.php (where XX is your language, example: IT)
Check index.php: change XX to your language (example: IT)

Leonardo on 04.08.2007. 18:07

@ Chrus
It is case sensitive.
$_SESSION['langx'] is always uppercase.
The second language file has to have uppercase language (snews_IT).
While the links (website.com/en/) has to be lowercase, also the database fields have lowercase language (text_it or text_de).
I'll update the guide soon.
If you are upgrading an existing website, you have to translate all the fields in the db, it is better to use program like phpmyadmin. Remember to upload the new .htaccess too.

martin on 06.08.2007. 03:01

My existing lang is German. I want to add english as an additional lang.
There are already a few articles in my db. What does that mean: you have to transalte all the fields in the db? I can do that without phpmyadmin with just changing the lang and then write the additional article text, right? Or should i change some table entries or change the stucture manually?

My base lang is not english. So i already changed my lang var in the settings admin dialog and changed my lang var in the top of my snews.php. Can i do that also for SML?
Thanks for that great support. I m gonna to a test today so i hopefully get i work :-).

mille grazie!!!

Leonardo on 06.08.2007. 13:22

@ martin
If your sNews is already set in German. You shuold have already the right file snews_DE.php.
Then you have to add to the db:
ALTER TABLE categories ADD name_en varchar(100) NOT NULL;
ALTER TABLE categories ADD description_en varchar(255) NOT NULL;
ALTER TABLE articles ADD title_en varchar(100) default NULL;
ALTER TABLE articles ADD text_en longtext;
ALTER TABLE articles ADD published_en int(3) NOT NULL default '1';
Instead of 1, you can set 0, and then you'll publish manually each translated article.
When you will select /en/, you should see an empty snews. If you go to the admin section you can edit and/or publish your old articles to english.

martin on 07.08.2007. 07:47

Yess, I got it work! My last thing: I want my Homepage to be initially in german (/de/), but its in english.
Is it possible to switch to German at Sessionstart? I am a really php noob, so i havnt realize where the lang-var is set? Is it automatically set with calling the lang-directory (eg: /en/) ?

At the moment my LangVar is EN (in the admin-panel). So "en" and "de" are switched (a little bit confusing), so my Startsite is german with english interface lang (this capter is just confusing i know but also not so important:-)).
Sorry for spaming your comments, but i am not able to access my emails at day.

martin on 07.08.2007. 07:54

Sorry for asking again, but: What does the field plublished_en do? When its set to 1 the text of the article at yourwebsite.com/en/ is also displayed in yourwebsite.com/de/ ?
I hope you all understand my little strange postings :D.

Leonardo on 07.08.2007. 10:13

The homepage language is based on the browser language (lines 259,270 in snews.php), if the browser is 'DE' you will have german, in all other cases you will have english. If you change the 2 lines ($_SESSION['langx'] ='DE';), you shuold have always german at the beginning.
LangVar is the 'first language', the one the read the old database. In your case shuold be 'DE', because you added text_en, title_en to the db, right?
If you set published_en to 1, you have all the old articles "published" in English (but the articles are still empty, you have to translate, so you have an empty structure to edit); if you set to 0, you have an empty snews, this case is better, because it give you more time to translate.
Next steps: login as admin, go to website.com/en/, go in the admin section, select categories/articles view, select edit and write the translation.

wflynvpemq on 14.08.2007. 11:26

Hello! Good Site! Thanks you!

Jdd on 25.09.2007. 02:47

Great MOD leonardo, It´s just what I need, but Im new at this so I follow the instructions But I can make the languajes suich betwen english and spanish, could you take a look... Im jure I`ve done everything pretty well so far.

The instalation is here:

Thanks, and once again great MOD!

Leonardo on 25.09.2007. 09:39

I checked you website, and I notice that links don't have /en/ or /es/ extensions. Please, be sure you have snews.php that is provided with SML.
I made a ready to use en/es version, please download it here: sNews16ES.rar. You still need to change the database.

codetwist on 04.10.2007. 16:46

Hello, Leonardo ;)

Seems, that I will have to look at Your package more closely. As there were no more news on sNews site I've basically implemented rudimentary version myself, but it's based on 1.5.31.

So, here is what I did:
- used separate sets of content tables for each language (prefix);
- extended settings table with additional field defining for which or any language setting it's usable;
- put language variables outside main file for all languages


Martin on 05.05.2008. 23:52

Hi Leonardo!
Thanks for your support again!
I'm using the SML Mod actually nearly one year and i'm super happy!
This work saved a lot of time for me!
And its easy :-).

Write a comment

* = required field




3 + 2 =