sNews Forum

sNews 1.6 (previous version) => Mods/addons => Topic started by: Rui Mendes on May 19, 2007, 08:46:13 pm

Title: [MOD] Multiple Languages
Post by: Rui Mendes on May 19, 2007, 08:46:13 pm
Hello

You can have multiple languages on your website, new function "flags()"  to put in your index.php.
Example for freench put snews_FR and image FR.JPG (if you want show flag)
(http://snews.engcivil.net/images/ml1.JPG) (http://snews.engcivil.net/images/ml2.JPG) (http://snews.engcivil.net/images/ml3.JPG)

To make language available just add in Language List  (example: EN,PT,FR), you can find this in site settings

Download New Version (http://snews.engcivil.net/ml.zip) September, 5

Want see a demo ?  Here (http://www.engcivil.net/demos/ml)

If you want help to have many languages, you need to translate snews1.6 minimal and new variables
Code: [Select]
<?php 
# RUI VARIABLES 
   
$l['langlist'] = 'Language List (i.e: EN,PT,FR)';
   
$l['choselang'] = 'Language';
   
$l['new_articles'] = 'New Articles';
   
$l['new_comments'] = 'New comments';} return $l[$variable]; 
?>


I ask one more thing, Can you translate sNews Home
Quote
Experience the lightweight elegance!
sNews is a completely free, standards compliant, PHP and MySQL driven content management system. Consisting of only one small core file, sNews is extremely lightweight, easy to install, and easy to use via a simple web interface.

sNews is for everyone
With sNews you can create a website that consists of dynamic pages and have a blog at the same time. sNews has a front page option and categories for you to categorize your articles. Corporate CMS or a personal blog - your choice.

Search Engines dig sNews. Really.
sNews uses search engine friendly URLs throughout, to make your website truly loved by Google and other search engines (as well as your visitors). This makes a sNews driven site highly Search Engine Optimized from the get-go and will greatly assist in your site obtaining a good SEO ranking.

Send to me, my email is:
engcivil.net[at]gmail.com

Best regards,
Rui Mendes
Title: [MOD] Multiple Languages
Post by: Rui Mendes on May 19, 2007, 11:50:35 pm
If you download first version, please download again "File update fixed'

Sorry, I think is working 100%
Title: [MOD] Multiple Languages
Post by: Keyrocks on May 20, 2007, 12:08:01 am
Excellent contribution Rui. :)
Title: [MOD] Multiple Languages
Post by: Sasha on May 20, 2007, 01:47:24 am
hm you fix now this file  :| ...this file is corrupt ZIP anr RAR cant open file ..you need to fix this again  ......
Title: [MOD] Multiple Languages
Post by: Joost on May 20, 2007, 01:53:12 am
Quote from: sasha
hm you fix now this file  :| ...this file is corrupt ZIP anr RAR cant open file ..you need to fix this again  ......
I have no problems opening the file (zip and 7-zip). Download again
Title: [MOD] Multiple Languages
Post by: Sasha on May 20, 2007, 02:46:45 am
hm working now :) thx joost
Title: [MOD] Multiple Languages
Post by: Pali on May 21, 2007, 11:08:40 am
Inside the zip called snews16ml2.zip is folder MA containing sNews1.6 with Multiple Areas 1.0 mod... Has somebody correct version?
Title: [MOD] Multiple Languages
Post by: Rui Mendes on May 21, 2007, 12:01:12 pm
I'm sorry my mistake

Please download again
Title: [MOD] Multiple Languages
Post by: Ghassem Tofighi on May 21, 2007, 02:56:24 pm
Thanks ruimendes
Nice job
But there is some problems:

1) Multi Language is not only converting words from some language to another.for example for "right to left languages" we must change the css file.

2)when I hear about multi language cms I think in this way:
if multi language is meaning 2 languages, in article section we must have 2 fields for title,text,and which fields that are different from one language to another one.
this is not very complicated job and by html form generator function in sNews you can easily add it to admin section.

3)I asked before a question that in suggestion section but nobody didn't answer me.It was about choosing language and I have the same purpose.
but in my design I thought to specify language in url like this :
http://localhost/en/article/title ....
http://localhost/xx/article/title ....
and in admin section I used en_title and xx-title (instead of title ) and en_text and xx-text (instead of text) article table of my database.

4)you release an individual package for your work . please consider the situation I patch my sNews and I want add your mod. then please describe how change sNews to reach your design instead of releasing new type of sNews.

Thanks  ;)
Title: [MOD] Multiple Languages
Post by: Pali on May 21, 2007, 05:35:35 pm
Hello,

nice mod, i like the SESSION way - this is the simplest way to implement this thing to sNews... There is no need big hacking of sNews core...

Of course - this will not work with COOKIES disabled.

Complex thing like requested by ght is far away from this and is much more complicated... Big CMS have problems with this also.

Thanks Rui
Title: [MOD] Multiple Languages
Post by: Leonardo on May 22, 2007, 02:06:58 am
Quote from: ght
Thanks ruimendes

2)when I hear about multi language cms I think in this way:
if multi language is meaning 2 languages, in article section we must have 2 fields for title,text,and which fields that are different from one language to another one.
this is not very complicated job and by html form generator function in sNews you can easily add it to admin section.

3)I asked before a question that in suggestion section but nobody didn't answer me.It was about choosing language and I have the same purpose.
but in my design I thought to specify language in url like this :
http://localhost/en/article/title ....
http://localhost/xx/article/title ....
and in admin section I used en_title and xx-title (instead of title ) and en_text and xx-text (instead of text) article table of my database.

4)you release an individual package for your work . please consider the situation I patch my sNews and I want add your mod. then please describe how change sNews to reach your design instead of releasing new type of sNews.
My interpretation of multi-language is like yours.
I did a MOD for sNews 1.5, now I'm working on the 1.6 version.
I'll release it in my website, where you can see how it works.

The admin section is not yet friendly.
My patch changes deeply the code, so it's hard the apply to a website.
It's easier to start from scratch and apply all the other mods.

Leonardo
Title: [MOD] Multiple Languages
Post by: codetwist on May 23, 2007, 10:21:24 am
Hey, rui ;)

I admire Your determination and productivity; great mods definitely.

@leo1981, ght : Done work is done work. Still there always is room for improvements and other approaches; that's healthy competition ;)
Title: [MOD] Multiple Languages
Post by: Leonardo on May 24, 2007, 06:23:21 am
Quote from: codetwist
@leo1981, ght : Done work is done work. Still there always is room for improvements and other approaches; that's healthy competition ;)
I built that mod because I needed for my website. It's not a competition. ;)
The two mods have the same name, but different behaviors.

Leonardo
Title: [MOD] Multiple Languages
Post by: codetwist on May 24, 2007, 08:52:02 am
@Leonardo : Competition isn't bad per se ;)  So, bring Yours out of its CLOSET RIGHT HERE AND NOWWWWWWW ...  :lol:

On more serious note may be You can drop a note in Programming section (I hope we still have one) with list of   feature set ;) This thread after all is for finished version of ruis MOD.
Title: [MOD] Multiple Languages
Post by: Davor on June 07, 2007, 01:02:26 am
Great mod, but unfortunately it doesn't work well for me :(

When I want to edit article in language other than English, I can't choose category - article is shown on Home page in English section of site. If I want to edit article, I can't - have to delete it first, then republish edited version.

Hope it will be fixed soon  :)
Title: [MOD] Multiple Languages
Post by: Rui Mendes on June 07, 2007, 01:57:41 am
I'm sorry.
I'm busy, I'll see this soon promise.
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on September 05, 2007, 02:50:41 am
Hello friends

Correct a litle bugs and patch from sNews 1.6. See first post

I make a few changes, I think this way will working for who had cookies disable.

This version is the same policy of sNews ("Consisting of only one small core file").

Next stage making sNews1.6ML-AM (sNews Multiple Languages and Admin Mods).

Stay tuned...

 ;D
Title: Re: [MOD] Multiple Languages
Post by: Boogada on September 08, 2007, 09:35:26 am
hi

I just installed this mod and I think its ok, but it is not working well with the German translation.  (http://snewscms.com/forum/index.php?topic=4679.0) It is not showing the new article and new comments headline.

(http://www.hohle-phrasen.de/DE.JPG)

So I guess I need to fix the DE language file? What exactly is wrong? And sorry I'm very new to this software.

the installation is here (http://www.hohle-phrasen.de/news/)
Title: Re: [MOD] Multiple Languages
Post by: Joost on September 08, 2007, 11:59:27 am
Not acquainted (yet) with Rui's mod, but at least you should have these (translated) in snews_DE.php

Code: [Select]
<?php
# RUI VARIABLES 
$l['langlist'] = 'Language List (i.e: EN,PT,FR)';
$l['choselang'] = 'Language';
$l['new_articles'] = 'New Articles';
$l['new_comments'] = 'New comments';} return $l[$variable];
}
?>

I recommend comparing the translation file with one of the included translations.
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on September 08, 2007, 12:38:24 pm
Yes you're right Joost, thank you.

I forgot put here "new variables" (only in this post (http://snewscms.com/forum/index.php?topic=5818.0)).

Help me see the first post.

Another thing, see if Spanish and Freench are OK (I use translation.com to do this)

Title: Re: [MOD] Multiple Languages
Post by: Boogada on September 08, 2007, 01:26:13 pm
thank you, I added and translated the missing variables and it works now.

Code: [Select]
# RUI VARIABLES
$l['langlist'] = 'Sprachenliste (z.B.: EN,PT,ES,FR)';
$l['choselang'] = 'Sprache';
$l['new_articles'] = 'Neue Artikel';
$l['new_comments'] = 'Neue Kommentare';
Title: Re: [MOD] Multiple Languages
Post by: Joost on September 09, 2007, 11:05:16 am
Rui,

Are you aware of the following problem?
The default language-section works like every other sNews site. However, any secondary language is session based, it requires $xlang being set.
This means I cannot link to a page set to the secondary language. I am almost certain, that Google will have major problems indexing the secondary language. It might not even index it at all.

I ran into the same problem earlier and hoped you've had a solution for this issue. Just letting you know. :)


 
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on September 09, 2007, 12:49:00 pm
Hello Joost, thank you.
Since last night, I was think about it.

Wait 1 or 2 more days. I start change code last night and I think is ready but need to do more tests

yourhost.com/en/
yourhost.com/pt/
yourhost.com/fr/
yourhost.com/de/

yourhost.com/en/cat1/
yourhost.com/pt/cat1/
yourhost.com/fr/cat1/
yourhost.com/de/cat1/

I make one feature to link to another language
I think this way we solve this problem. What you think about it?
Title: Re: [MOD] Multiple Languages
Post by: Joost on September 09, 2007, 01:14:21 pm
Looks promising, Rui. Does it mean there has to be a .htaccess (mod_rewrite) modification?
Title: Re: [MOD] Multiple Languages
Post by: Vasile Rusnac on September 13, 2007, 08:43:10 pm
Hi guys,

since I have migrated to snews from joomla I was thinking of this mod to be more more or less as joomfish combined with joomsef which means that links should look something like this: http://host.com/lang/article/ (idea that you have already came to) while posting articles to different languages will require to click on "translate" or some other link in the admin panel, where you can select which language you would like to post your article  and the content of it.

and obviously, there should be re-wrote the .htaccess file to make the links appear in the correct format

i am aware this is not an easy thing to do :) but this is the right thing to do to assure pages are indexed by search bots and to make it easier for admins to translate pages.

cheers.
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on September 13, 2007, 10:21:03 pm
Hello guys, I'm so sorry I was very, very busy (next week maybe I've more time) .

I have some problems to solve

This mod takes more time to finish, I prefer publish when is ready. I'm sorry :(

You can try this DEMO (http://www.engcivil.net/demos/ml) click in flag you want, I can't make automatically (must think how can do it).

This Mod you can add categories with same name but different language.
Example:
Create a category Software for portuguese and another category Software for English.
Create new article sNews to put in Portuguese Software, and new article sNews for English software.
...
I'll try to add this: when you search for software, appears all articles for software (a flag country add to each article), and when you click jump for that language. This can be disable if want.

When you create a new article (or edit) you can select a language. No click to translate (see example to understand).

cheers.
bye
Title: Re: [MOD] Multiple Languages
Post by: Vasile Rusnac on September 14, 2007, 10:52:47 am
Hi Rui,

nice job, I think it looks better and better  ;)
I can say you provided a very good solutions for search results: the articles list with flags for each, thats awesome.

While, for the country flags to appear automatically you can use a script similar to a gallery population: there is a folder flags/ with several images in it (en.png, pt.png, fr.png) and the script populates all images in that folder in the desired place with link to &lang=imagename

one thing, though, is the language switch: whenever I click on a new language I am redirected to the frontpage. Users might wish to stay on the same page, for ex, sitemap, where they will have to navigate again.
Maybe <? echo ($_SERVER['PHP_SELF']); ?>?action=language&lang=pt will be a better solution? Just a thought.

Good luck in your Mod finishing, we will definitely wait for your release. Cheers.
Title: Re: [MOD] Multiple Languages
Post by: Dobri on September 14, 2007, 04:27:45 pm
Hi,

very nice mod,but have a problem.

I'm testing Multiple Language version by Rui Mendes. A set a static page as homepage(Admin -> Settings -> Contents -> Use Page as Home Page -> ...some page..) on one of the languages and I need to set different static page as home page on any other  language, but it is not possible.

Can you help mi to solve this problem?

Thank you.
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on September 15, 2007, 02:02:51 pm
Hello Dobri.

I never think about it, but I'll try to makes this happen.
Please wait, I'm very busy right now to solve some problems with this mod.
Be patient, I'm working alone with this.

Good weekend for all
Title: Re: [MOD] Multiple Languages
Post by: Keyrocks on November 10, 2007, 08:29:24 pm
@ Rui... if you read this before you log out... stay tuned... I have a couple of questions to bring up... I will be back with them in this post in a few minutes.

I am working on a way to switch language files in my latest MEMU project revision. It has language files - english.php and french.php (for now) - in the root/languages folder and this is the same as I have it in the currently available MEMU download. These files have the complete language array structure in both of them as it was in the default sNews 1.6 package... but without the switch string in the top of them. I have been working with a modified version of bakercad's template switch script since it is small and simple, and I only wanted to switch the language variables. It is almost working, but not quite.

Then I had a look at this Mod you did for Multiple Language sites... downloaded your package... and identified all of the Language Mod locations in the snews.php file... about 44 of them not counting the language variables themselves.

I would like to try adding this Mod to my new MEMU project.
Question - are there any changes to the database?
Question - does an article need to be created and saved in each language so that articles display in each language when the site language changes?
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on November 10, 2007, 08:55:17 pm
Hello Doug.
I send to you a PM.
Title: Re: [MOD] Multiple Languages
Post by: Keyrocks on November 10, 2007, 09:09:17 pm
Hello Doug.
I send to you a PM.
Check your e-mail  ;)
I answered my first question... found the answer in the readme.html file.
To answer the second one... I guess I'll just have to install it and find out... eh?
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on November 10, 2007, 09:15:04 pm
Doug give me 1hour, I'm working.
Title: Re: [MOD] Multiple Languages
Post by: Keyrocks on November 10, 2007, 10:26:30 pm
Sure... no problem... even though it is Saturday and you should have the day off... no?  ;D
The only problem I am having with my switch mod is that I cannot use the s('language') variable in it... within my config.php file. It keeps throwing the Call to undefined function s() message.
But, when I create a static variable as - $gl['language'] = 'english'; - I can use the gl('language') within the switch and it works fine.
But... I need to get the variable value out of the settings table (row 7, by default).
Question... any idea why the "s" variable won't work there?  ???
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on November 10, 2007, 11:53:23 pm
Yes must work, teaching.  ;D
I'm sorry, my delay.

I've same problem with variables in my package am, when try help elessar, but no success  :(.
I know we can use global variables, maybe this works, not try yet.

Another way:
In my sNews AM, I use variables in separeted file.
try to use include your config.php inside "function snews_startup", before (update_articles;)

About another question: You need to create and save to each languages, to be displayed when site language change, maybe we can discuss another way to do this.

Today I did some progress with sNews gallery (navigation on images)

I'm sorry again my friend.
Title: Re: [MOD] Multiple Languages
Post by: Keyrocks on November 10, 2007, 11:57:24 pm
Thanks Rui... no problem. I finally got it working as desired... actually about 2 minutes ago... and a modded version of bakercad's template switch script was not required.  ;D
It is funny how bits of script will work in some locations but not others. I know there is some simple reason why this happens but someone else with more knowledge than I will have to tell me what it is.
Title: Re: [MOD] Multiple Languages
Post by: Boogada on November 16, 2007, 11:06:11 am
hey,

here I am again, I got this mod now running on my new site  (http://www.marc-gaertner.de). I changed some stuff in the snews.php file too to get the menu and the contact form translated. but I have one question: how can I link to an article? if I am currently looking at the german version (default) and click on a link to one of the english articles I get an 404 error. so how can get links to specific articles that I can use at some other page?
Title: Re: [MOD] Multiple Languages
Post by: Joost on November 16, 2007, 01:06:46 pm
@Boogada

You cannot link to a page that is not a default language. This mod is session based. Probably not default languages won't be indexed by search engines either.
Title: Re: [MOD] Multiple Languages
Post by: Boogada on November 16, 2007, 01:23:45 pm
@Boogada

You cannot link to a page that is not a default language. This mod is session based. Probably not default languages won't be indexed by search engines either.

meh. this is of course not what I wanted to read. is this supposed to be a feature in a future version or some different multi-language mod. I don't really need this fast, I need to create some more translated content first.
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on November 17, 2007, 09:51:41 am
Hello Boogada.

One version I did [WIP] can do this, I don't know where I put it, I'll try find that version and you can solve your problem.

I can say, you need to create a link to that article (and switch function inside to change language).

This project is stop for now, need to finish sNews Gallery first. When finish, I will rewrite code (no session need)

Your website is very good, congratulations.
Title: Re: [MOD] Multiple Languages
Post by: marcos on November 22, 2007, 10:57:42 pm
@Rui, the RSS is also separated by language? For example someone will select the german language interface and he will subscribe on RSS feeds. He will receive only german articles?
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on November 23, 2007, 10:04:06 pm
When I finish my sNews Gallery, I restart this project (rewrite code), I try make this happen like you said. No sense with other way, yes you will receive only german articles.
Title: Re: [MOD] Multiple Languages
Post by: marcos on November 27, 2007, 02:59:06 am
Yeah cool!  ;D I will wait. Thanks.
Title: Re: [MOD] Multiple Languages
Post by: henrich on January 17, 2008, 11:25:47 pm
A bug we have found regarding the future posting feature, the bug was present (has affected) simple sNews 1.6 package and sNews 1.6 + ML (Multiple Languages).

With Rui Mendes, together we have fixed also this bug. See there http://snewscms.com/forum/index.php?topic=6680.0 (http://snewscms.com/forum/index.php?topic=6680.0)
Title: Re: [MOD] Multiple Languages
Post by: Nicu Alecu on May 08, 2008, 10:11:47 am
Question to Rui (or anybody else who knows anything about this!

I have several ML installations running on various domains and everything's peachy (well, almost, ;)) except for one huge issue which I didn't notice until recently. Here it goes: on all off this installs I added the Google Sitemap Add-on (http://snewscms.com/forum/index.php?topic=5555.0) and started monitoring the indexed URLs using google's wm tools; funny thing is ... all the pages and/or articles do not get indexed and I get this warnings (on each and all of them!):
Quote
URLs not followed!
When we tested a sample of the URLs from your Sitemap, we found that some URLs were not accessible to Googlebot because they contained too many redirects. Please change the URLs in your Sitemap that redirect and replace them with the destination URL (the redirect target). All valid URLs will still be submitted.
And the error:
Quote
HTTP Error: 302 (Moved temporarily)
And big G's explanation:
Quote
The server is currently responding to the request with a page from a different location, but the requestor should continue to use the original location for future requests. This code is similar to a 301 in that for a GET or HEAD request, it automatically forwards the requestor to a different location, but you shouldn't use it to tell the Googlebot that a page or site has moved because Googlebot will continue to crawl and index the original location.
And a more extensive explanation (also from big G): here (http://www.google.com/support/webmasters/bin/answer.py?answer=48551&hl=en)

Now I can understand that this can come from the specific alterations in .htaccess which are there for good "friendly url" reasons, but it messes up the SEF status of all articles and pages.

I did some testing, it only occurs in Rui's ML version, no matter what other mods/add-ons are added (it pops up on pure blank ML install, too).
I'm pretty sure .htaccess alterations are to blame (yeah, I'm that smart  ;)) but I have no clue as what to do to make it disappear (yeah, I'm not that smart :D).
Any help would be highly appreciated, or I'll have to ditch all the ML installs and go for some other solution (like multiple installs of some kind), and I'm not very happy about that.  :(
Title: Re: [MOD] Multiple Languages
Post by: Joost on May 08, 2008, 01:08:21 pm
I've tested ML long, long time ago, so some things might have changed.
Back then, I've found out the following:
Ml is session based, you cannot access a non default language page, without changing the language setting first.
So if  English is default, I cannot access a Russian page that's stored in my bookmarks or is linked to from a different site.
The 302 is generated by sNews, a design flaw in sNews. Instead of producing a 404 instantly it starts off with a redirect (302) to the 404 page, then followed by a 404 header.
Title: Re: [MOD] Multiple Languages
Post by: Nicu Alecu on May 08, 2008, 01:21:33 pm
Thanks Joost, I got it and it looks like I'm not that smart afterall!  :'(
What you said about not being able to access a 2nd (3rd or whatever) language page from an external link makes sense now ... and I guess it's because there's no session present to direct the browser (or robot) to that specific page (or article). Pushing this logic further, it means that even though Rui's solution works extremely nice when doing regular browsing through a site, the generated content cannot (and will not) be able to be deeplinked (is that the word?) and pretty much worthless from the SEF point of view ... am I right?
Cause if I am, it means I'll have to "redo" a lot of work on the sites that I've been using ML on ... uhhh! ::)
Title: Re: [MOD] Multiple Languages
Post by: codetwist on May 08, 2008, 02:38:38 pm
@ Nicu : You got it right. Session based features are best for in-house systems as they are simpler. But for public anonymous use and SEO they don't work at all unless it's supported by additional processing of urls. If same category/page/article has different seftitles for different languages then You can switch languages and reload language var-s in start-up according to data found for specific seftitle. Or You can search this forum for other mods which were incorporating language in urls from very beginning.
Title: Re: [MOD] Multiple Languages
Post by: Nicu Alecu on May 08, 2008, 02:41:35 pm
Yep, I think I'll do just that, thank you codetwist.
Like this one, for instance: http://snewscms.com/forum/index.php?topic=6421.msg43288#msg43288
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on May 08, 2008, 09:56:31 pm
Hello Nicu.

I'm sorry, I know there are some bugs I need to fix. A few time ago, I start my 2nd generation of ML (with no sessions). I was very busy with some projects (sNews1.7, my website sNews and sNews Gallery).

I've one ideia to devellop the 2nd version sNews ML, I'll use one ideia that I use in sNewsGallery I think will solve all problems, please be patient I'll be very, very busy next 3 weeks.

I promisse I'll finish this version, I want to my website too.

Yes etatus has a good solution

Thank you, mates
Title: Re: [MOD] Multiple Languages
Post by: Nicu Alecu on May 09, 2008, 08:32:37 am
Rui, you're a man with many good ideas  :)
I'll be waiting for ML2, but in the meantime, I'll just have to ditch all ML installs, cause it it really messes up the indexing.
Title: Re: [MOD] Multiple Languages
Post by: rubenpol on June 26, 2008, 04:54:13 pm
Small fix for xhtml validation.

On flag() function change & for &amp;


Search for:
Code: [Select]
href="'.$db['website'].'index.php?action=language&lang='.$lang.'"
And Replace for:
Code: [Select]
href="'.$db['website'].'index.php?action=language&amp;lang='.$lang.'"
Title: Re: [MOD] Multiple Languages
Post by: Rui Mendes on June 26, 2008, 05:39:21 pm
Thanks rubenpol.

First Karma 2 U
Title: Re: [MOD] Multiple Languages
Post by: rubenpol on June 26, 2008, 05:57:17 pm
Hi Rui!

I'm modifying your code to generate a language ul, and show the small flags through CSS.

Example

In snews.php
Code: [Select]
// LANG FLAGS
function flags() {
$langlist = explode(',',s('langlist'));
foreach($langlist as $lang) {

echo '<li><a title="'.$lang.'" href="'.$db['website'].'index.php?action=language&amp;lang='.$lang.'" class="'.$lang.'">'.$lang.'</a></li>';

}}

In index.php
Code: [Select]
<ul id="lang">
    <?php flags(); ?>
  </ul>

IN CSS stylesheet I defined a class for each lang like
Code: [Select]
#lang .EN {
background: url(flags/flag_en.gif) no-repeat;
padding-left: 20px;
padding-right: 10px;
display: inline;
}

We could generate an inline style on each <a>, but the code will become so dirty, and i think that the better way is make it manually. Sorry, but i love semantic code ;)

Congratulations RUI, it's a great addon for our snews!
Title: Re: [MOD] Multiple Languages
Post by: antvoi on September 06, 2008, 08:36:08 am
did you integrate ML with Sub Categories?
Title: Re: [MOD] Multiple Languages
Post by: rjs on March 03, 2011, 06:51:49 pm
i was wondering if anyone got this working in sNews1.7 yet, just curious as this mod seems to be a little more straight forward than the others available, and I have already used it in 1.6 and love it.

Would like to play with 1.7 but really need this mod as I use multilingual content