Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: 1 2 [3] 4

Author Topic: [MOD] Multi-language simple Mod  (Read 17068 times)

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: [MOD] Multi-language simple Mod
« Reply #30 on: June 03, 2008, 07:52:24 PM »

Actually I'm trying different stuff !

1/ en_settings (without data)
Code: [Select]
CREATE TABLE `EN_settings` (
  `id` int(8) NOT NULL auto_increment,
  `name` varchar(20) NOT NULL,
  `value` varchar(60) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=24 ;
Ok create a setting table for English but can't login.

2/ en_settings (with same data as settings)
Code: [Select]
INSERT INTO `settings` VALUES (1, 'website_title', 'sNews 1.6');
INSERT INTO `settings` VALUES (2, 'home_sef', 'home');
INSERT INTO `settings` VALUES (3, 'website_description', 'sNews CMS');
INSERT INTO `settings` VALUES (4, 'website_keywords', 'new, site, snews');
INSERT INTO `settings` VALUES (5, 'website_email', 'info@mydomain.com');
INSERT INTO `settings` VALUES (6, 'contact_subject', 'Contact Form');
INSERT INTO `settings` VALUES (7, 'language', 'FR');
INSERT INTO `settings` VALUES (8, 'charset', 'UTF-8');
INSERT INTO `settings` VALUES (9, 'date_format', 'd.m.Y. H:i');
INSERT INTO `settings` VALUES (10, 'article_limit', '1');
INSERT INTO `settings` VALUES (11, 'rss_limit', '5');
INSERT INTO `settings` VALUES (12, 'display_page', '0');
INSERT INTO `settings` VALUES (13, 'display_new_on_home', '');
INSERT INTO `settings` VALUES (14, 'display_pagination', '');
INSERT INTO `settings` VALUES (15, 'num_categories', 'on');
INSERT INTO `settings` VALUES (16, 'approve_comments', '');
INSERT INTO `settings` VALUES (17, 'comments_order', 'ASC');
INSERT INTO `settings` VALUES (18, 'comment_limit', '30');
INSERT INTO `settings` VALUES (19, 'word_filter_enable', '');
INSERT INTO `settings` VALUES (20, 'word_filter_file', '');
INSERT INTO `settings` VALUES (21, 'word_filter_change', '');
INSERT INTO `settings` VALUES (22, 'username', 'SAME CODE AS DEFAULT');
INSERT INTO `settings` VALUES (23, 'password', 'SAME CODE AS DEFAULT');
Got an error when creating table = duplicate entry , same ID (stuff like that) .
An can't login in this one too, sic  :-\

Thank's anyway for your help Codetwist. You right I will send a PM to the author.
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Re: [MOD] Multi-language simple Mod
« Reply #31 on: June 03, 2008, 10:56:27 PM »

Dunno ... why are there just `settings` used in those INSERT statements? Is that only post mistake? Because if You try that for real then it should contain `en_settings` as target table name instead. Like this:
Code: [Select]
INSERT INTO `en_settings` VALUES (1, 'website_title', 'sNews 1.6');

And why table creation command contains AUTO_INCREMENT=24 ? It's wrong IMHO and shouldn't be there.
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: [MOD] Multi-language simple Mod
« Reply #32 on: June 04, 2008, 12:07:06 AM »

Damned, stupid I am  :P :P

I had copy and paste my SQL export DB to create the english Tables !

So I erase everything and re-create all the tables



And you know what ?

It's working  :D :D :D Thank's a lot Codetwist. ( karmas for you )
I learn everyday with this great sNews  ;)

Well, well this ML version seems to work very nice with the     
Content Re-ordering - the Ultimate Solution by Keyrocks. For the moment  :P :P

Thank's again Codetwist.
« Last Edit: June 04, 2008, 12:21:57 AM by stephane »
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: [MOD] Multi-language simple Mod
« Reply #33 on: July 03, 2008, 05:41:22 PM »

Hello,
If I'm using this great Mod for a French/English website, do you think is that possible to have 2 different logo, one for each language.

Visiting the website in French display the logo in French and in English the English logo.
Of course there is two versions of the image logo as jpeg file somewhere on the server.

Maybe something like the body id Mod, but how can I make this ?  ???

Any brilliant idea, thanks a lot
Stéphane
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Re: [MOD] Multi-language simple Mod
« Reply #34 on: July 04, 2008, 08:21:18 AM »

IN this mod it probably variable $_SESSION['lang'] to check.

In index php before xhtml code that outputs logo image:
Code: [Select]
<?php
switch ($_SESSION['lang'])
{
   case 
'FR' :
      
$logoImgSrc '<whatever1>';
      break;
   case 
'EN' :
      
$logoImgSrc '<whatever2>';
      break;
   default :
      
$logoImgSrc '<whatever3>';
}
?>


And in place of hardcoded image name:
Code: [Select]
<?php echo $logoImgSrc?>
« Last Edit: July 04, 2008, 01:36:52 PM by codetwist »
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: [MOD] Multi-language simple Mod
« Reply #35 on: July 04, 2008, 11:49:32 AM »

Thanks a lot Codetwist,
I will try that ant let you know is it's working fine.

S.
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: [MOD] Multi-language simple Mod
« Reply #36 on: July 04, 2008, 01:25:05 PM »

 :-[ :-[
Doesn't seems to work. I got always the default image and no change happen when switching language !

Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Re: [MOD] Multi-language simple Mod
« Reply #37 on: July 04, 2008, 01:38:22 PM »

Fixed broken code in original post (was missing break statements).
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: [MOD] Multi-language simple Mod
« Reply #38 on: July 04, 2008, 02:45:20 PM »

Yes it's working perfectly  :D

You're the best, thanks a lot (karma for you  ;)

Thanks
Stéphane
Logged

amak

  • Newbie
  • *
  • Karma: 4
  • Posts: 40
Re: [MOD] Multi-language simple Mod
« Reply #39 on: July 18, 2008, 02:49:44 PM »

I'm just a bit lost in implementing this into 1.7RC, anyone tried this?

Thanks for hints!
Logged
Regards,
Amak

sparco

  • Newbie
  • *
  • Karma: 0
  • Posts: 2
Re: [MOD] Multi-language simple Mod
« Reply #40 on: April 11, 2009, 06:36:34 AM »

how to transform for 1.7 ?
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: [MOD] Multi-language simple Mod
« Reply #41 on: May 19, 2009, 02:14:34 PM »

A little UP for this good question. How to transfrom in snews 17 ?
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [MOD] Multi-language simple Mod
« Reply #42 on: January 01, 2011, 07:10:51 AM »

well, I gave it a shot but no luck so far. I keep getting blank sites.
I tried Pali's version a while back as well but ... I'm not advanced enough to strip out all the excess things to get a working core file. Sorry. Etatus version should be doable, it's just a matter of sorting out where to put the various parts (and what to change some parts to, to make it work in 1.7.) I'm still working on it, although I guess I need to sober up a little before the next attempt. ('appy new <hick> yeAR!!!!!!!!!!) :P
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [MOD] Multi-language simple Mod
« Reply #43 on: January 01, 2011, 10:00:35 AM »

hehe - I just remembered, there's a simpler way. At least for my needs. One db, with one prefixed table for each language; one root index.php, one snews.php (in root) plus associated files (js/admin.js, css/style.css, lang/lang files); one folder for each language, containing a config file with db variables for the language and an index.php file with snews function calls. And Bob's your uncle.

I'm using a cookie-based lang selection in the root index.php. I imagine that it could be exchanged for a session-based selection, but that's beyond me at the moment so haven't delved into it.

The cookie thing is courtesy of, yes, Bob (bakercad). Works like a dream. 1.7 Multilang with no minimal hassle... ;)
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [MOD] Multi-language simple Mod
« Reply #44 on: January 01, 2011, 10:04:08 AM »

potty that own posts can't be modified anymore...
Bob's cookie jar is here
Logged
Pages: 1 2 [3] 4