Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 09:10 am EST

Geeklog Forums

How use multi-language in blocks?


Status: offline

alb3rt

Forum User
Regular Poster
Registered: 10/30/06
Posts: 71
Location:Mexico City
I created a block with the ID name_lang (es,en), but doesn't enable the language and the 2 blocks always appears (both languages)

I also created a block with the ID name (disabled) and name_lang (es,en; enable). Finaly i added:

$lang = COM_getLanguageId();
if (empty($lang)) {
$result = DB_query("SELECT onleft,name FROM {$_TABLES['blocks']} WHERE is_enabled = 1"Wink;
} else {
$result = DB_query("SELECT onleft,name FROM {$_TABLES['blocks']}"Wink;
}

In theme's functions.php.

What is the correct mode to do this?

Thanks.
D Web Studio - www.d-webstudio.net
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
I originally wrote this and it sometimes confuses me. So don't feel bad if you are having trouble with it.
Quote by: alb3rt

I created a block with the ID name_lang (es,en), but doesn't enable the language and the 2 blocks always appears (both languages)

I also created a block with the ID name (disabled) and name_lang (es,en; enable).

This is backwards. The block id with no language tag should be enabled and the blocks with _lang should be disabled.

Finaly i added:

$lang = COM_getLanguageId();
if (empty($lang)) {
$result = DB_query("SELECT onleft,name FROM {$_TABLES['blocks']} WHERE is_enabled = 1"Wink;
} else {
$result = DB_query("SELECT onleft,name FROM {$_TABLES['blocks']}"Wink;
}

In theme's functions.php.

What is the correct mode to do this?

Thanks.
This should be correct.
 Quote

AlbertoVilla

Anonymous
Dear Joe:


Perhaps we are doing something wrong?' As we did it just the way you mentioned to Alb3rt and I am afraid it is not working or we are doing something wrong. Could you be so kind to explain it again, please. Alb3rt told me that he has been trying to make the blocks work in multi-language, but without success.

Thanks in advance.

Alberto
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
You need 3 (or more ) blocks.

Block 1, is called foo (as an example). It is enabled and placed in the block list whereever it is you want the block to appear.
Block 2 is called foo_en. It is the English version of the block. It is disabled and on the same side as the primary block.
Repeat for Blocks 3 and up with different language values.
 Quote

AlbertoVilla

Anonymous
Joe:

Thanks a lot!
 Quote

All times are EST. The time is now 09:10 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content