11
irmtfan
Re: Different Theme for Each Language, Script
  • 2006/11/29 17:47

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


yes its generic.
Quote:
is it the style.css available in most themes


almost 90% of themes.

also you can easily add your codes to it.
for example block's titles have Left and Center and even Right positions in different themes. so you must modify it for your needs. but it will be very little.

so why not test it and send me any error or issue in RTL or even LTR?

12
BCdudes
Re: Different Theme for Each Language, Script
  • 2006/11/29 17:59

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


I would, maybe when i come to design the next site, I have done 3 multilingual sites so far, 2 of them i used the long method (crap, believe me), and 1 i used this new method which (to be honest) i think is quicker than all.

but i ll try your method, and if i run into any troubles i ll PM u, cheers man.

13
irmtfan
Re: Different Theme for Each Language, Script
  • 2006/11/29 19:56

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Ok
back to the topic title any one know how to change theme by change language?

it must be like this:
lang1 --> themes/THEME_NAME1
lang2 --> themes/THEME_NAME2
...

14
BCdudes
Re: Different Theme for Each Language, Script
  • 2006/11/29 20:23

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


Yes, I know, here it is:

Edit "header.php" in the root folder
and insert this code:

if ($xoopsConfig['language'] == '[b][color=FF0000]lang1[/color][/b]') { 
   
$xoopsConfig['theme_set']='[b][color=FF0000]theme1[/color][/b]'
  } 
if (
$xoopsConfig['language'] == '[b][color=11FF11]lang2[/color][/b]') { 
   
$xoopsConfig['theme_set']='[b][color=11FF11]theme2[/color][/b]'
  } 
if (
$xoopsConfig['language'] == '[b][color=1111FF]lang3[/color][/b]') { 
   
$xoopsConfig['theme_set']='[b][color=1111FF]theme3[/color][/b]'
  } 
if (
$xoopsConfig['language'] == '[b]lang4[/b]') { 
   
$xoopsConfig['theme_set']='[b]theme4[/b]'
  } 
.
.
.
.


insert the code before this line (at about line 30)
include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';

15
draj
Re: Different Theme for Each Language, Script
  • 2006/12/13 12:17

  • draj

  • Quite a regular

  • Posts: 271

  • Since: 2005/6/23


Hallo BCdudes!

Well, I was just looking for a solution in this direction.

Pl. help me to understand before I begin messing around.

The theme will change due to the Language selection.

Will the blocks also change completely due to the language?

I also want some of the blocks to disappear in different language.

Thanks for your help in advance.

16
BCdudes
Re: Different Theme for Each Language, Script
  • 2006/12/13 14:35

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


Yes, the theme will completely change due to the language selection.

The block styles will change, but the content+location of the blocks will not change due to the language.

What you can do however, you can put different contents in the block when it goes to a different language, for example:

[en] this block is for the date and time and other information [/en] [fr] Je ne parle pas le francais [/fr]

or try using empty tags, like:
[en] this is my info in english that i dont want in german [/en] [de] [/de]

this was, when you switch to "de", the content becomes empty .

but you cant make blocks disappear on theme change, because blocks are dealt with in the mySQL db, not at the theme level.

regards

17
draj
Re: Different Theme for Each Language, Script
  • 2006/12/13 15:11

  • draj

  • Quite a regular

  • Posts: 271

  • Since: 2005/6/23


Hi!

Thanks for the promt reply.

I am using the latest 2.2.5RC2 and the header.php looks quite different with the latest development.

I would be thankful, if you could help me in this. Pl. inform us where exactly the code you suggested must be inserted.

The reason why I ask:

I can get the blocks empty with the other language content on adding the language specific tags.

However this is impossible. There is more that one year work in the content and cannot make all the tags add [de][/de]!

Hence the content and the BLOCK needs to disappear with the language. Otherwise it is practically unusable, you know!

There are many reasons why I did tell phppp to add language field in the database.

If one starts a new website with a new language at a later date and wants to have the same database, then one can create new fields with a default and everything gets automatically assigned to the old language.

Thanks,

The following is the code in header.php
if (!defined("XOOPS_ROOT_PATH")) {
    die(
"XOOPS root path not defined");
}

// Ensure charset setting
if (!headers_sent()) {
    
header('Content-Type:text/html; charset='._CHARSET);
}

$GLOBALS['xoopsLogger']->context "core";

// Get blocks
$block_handler =& xoops_gethandler('block');
$block_handler->assignBlocks();

$GLOBALS['xTheme']->checkCache();
/////////////////// Add the new code here ?/////////////////// 
if ($xoopsConfig['language'] == 'lang1') { 
   
$xoopsConfig['theme_set']='theme1'
  } 
if (
$xoopsConfig['language'] == 'lang2') { 
   
$xoopsConfig['theme_set']='theme2'
  }
/////////////////// 
if (!isset($GLOBALS['xoopsOption']['template_main'])) {
    include 
XOOPS_ROOT_PATH.'/include/old_theme_functions.php';
    
$xoopsTheme['thename'] = $GLOBALS['xoopsConfig']['theme_set'];
}
$GLOBALS['xoopsLogger']->context "module";
?>

18
aph3x
Re: Different Theme for Each Language, Script
  • 2006/12/13 15:24

  • aph3x

  • Theme Designer

  • Posts: 834

  • Since: 2004/12/26


So many hacks for absolutely nothing! LOL

See THIS site made for a friend

A 2.2.4 multilanguage site...arabic/english yet NO hack, NO two themes, NO two style.css just the brilliant xlanguage tags that shifts the header from right to left when arabic and from left to right when english...then again that was just me thinkin'
Everything I'm not made me everything I am
The Themes

19
BCdudes
Re: Different Theme for Each Language, Script
  • 2006/12/13 15:45

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


I think this looks alright

if (!defined("XOOPS_ROOT_PATH")) {
    die(
"XOOPS root path not defined");
}

// Ensure charset setting
if (!headers_sent()) {
    
header('Content-Type:text/html; charset='._CHARSET);
}

$GLOBALS['xoopsLogger']->context "core";

// Get blocks
$block_handler =& xoops_gethandler('block');
$block_handler->assignBlocks();

$GLOBALS['xTheme']->checkCache();
[
color=993300]/////////////////// Add the new code here ?/////////////////// 
if ($xoopsConfig['language'] == 'lang1') { 
   
$xoopsConfig['theme_set']='theme1'
  } 
if (
$xoopsConfig['language'] == 'lang2') { 
   
$xoopsConfig['theme_set']='theme2'
  }
/////////////////// [/color]
if (!isset($GLOBALS['xoopsOption']['template_main'])) {
    include 
XOOPS_ROOT_PATH.'/include/old_theme_functions.php';
    
$xoopsTheme['thename'] = $GLOBALS['xoopsConfig']['theme_set'];
}
$GLOBALS['xoopsLogger']->context "module";
?>


If not, try this:

if (!defined("XOOPS_ROOT_PATH")) {
    die(
"XOOPS root path not defined");
}

// Ensure charset setting
if (!headers_sent()) {
    
header('Content-Type:text/html; charset='._CHARSET);
}

$GLOBALS['xoopsLogger']->context "core";

// Get blocks
$block_handler =& xoops_gethandler('block');
$block_handler->assignBlocks();

$GLOBALS['xTheme']->checkCache();

if (!isset(
$GLOBALS['xoopsOption']['template_main'])) {
    include 
XOOPS_ROOT_PATH.'/include/old_theme_functions.php';
    
$xoopsTheme['thename'] = $GLOBALS['xoopsConfig']['theme_set'];
}
$GLOBALS['xoopsLogger']->context "module";


[
color=993300]/////////////////// Add the new code here ?/////////////////// 
if ($xoopsConfig['language'] == 'lang1') { 
   
$xoopsConfig['theme_set']='theme1'
  } 
if (
$xoopsConfig['language'] == 'lang2') { 
   
$xoopsConfig['theme_set']='theme2'
  }
/////////////////// [/color]

?>



I am not really familiar with 2.2.x, as for getting your blocks to disappear automatically with the new language, its a bit difficult i think, because each block operates independantly, and the method described in only relates to switching the layout (CSS files, images..etc..), but not the contents or the blocks.

To what I understand, you will need to add new lang tags in every single block, and add the new language to all module "language" folder !

Sorry about that, maybe someone else would help you.

20
draj
Re: Different Theme for Each Language, Script
  • 2006/12/13 15:47

  • draj

  • Quite a regular

  • Posts: 271

  • Since: 2005/6/23


Hi!

Well, to shift left to right may not be a problem, so long as the block remains and changes the content within.

My problem is to get the block totally disappear.

What about the following solution without having to add in the header.php?


<{if {$xoops_langcode} == en}>
<{include file="$xoops_theme/navigation/block_left_en.html"}>
<{else}>
<{include file="$xoops_theme/navigation/block_left_de.html"}>
<{/if}>

Login

Who's Online

137 user(s) are online (89 user(s) are browsing Support Forums)


Members: 0


Guests: 137


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits