91
Chado
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/9/20 0:15

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


Quote:

IsiRyder wrote:
When using [language][/language] in titles, changing language to spanish and so on, i have not enough space to do it. How can i change the length in a safe way?

Hi IsiRyder,
I am not sure which titles you mean, but you may need to change the length of the fields in your database. Some title fields were created with a fixed length. MCity's post just before your post deatailed a way to lengthen news topic titles. If that doesn't help, let us know what titles you are talking about and maybe someone has already figured it out.

Hope that helps...
Chad



92
Chado
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/9/8 15:32

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


Thanks a lot mCity! We are slowly making progress on getting many of the modules multilingualized (new word!)
Chad



93
Chado
Re: clone the news module ?
  • 2003/8/8 3:55

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


Hi javier! Just a quick thought...if you have already done it, could you post a news2 module that is ready to go. It might be a real help to a lot of people.
Thanks!
Chad



94
Chado
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/19 17:25

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


Making Multi-lingual Menu items
Quote:
hsalazar wrote: Bang! It worked!...Still missing: a way to change titles in blocks,... and a way to change tags in the main menu.

Hsalazar, Glad to hear that the hacks are working out! Your site is looking great!

I have a couple ideas for how to make custom multi-lingual menus that I am experimenting with on my site. Right now these deal with the menu items only and not the menu title. Maybe one of them will help you with your site there.

Idea #1: Make a custom PHP block and put the following code in and obviously change it to fit your language and links.
Quote:
global $xoopsConfig;
$arr[key] = value;
//put as many Japanese links here as needed
if ($xoopsConfig['language'] == "japanese") {
$Mylink["ホーム"] = "{X_SITEURL}modules/wfsection/article.php?articleid=8";
$Mylink["CLCFamilyについて"] = "{X_SITEURL}";
$Mylink["セレブレーションサンデー!!"] = "{X_SITEURL}modules/wfsection/article.php?articleid=5";
$Mylink["ハウス チャーチ"] = "{X_SITEURL}";
$Mylink["聖書の英会話"] = "{X_SITEURL}";
$Mylink["FAQ"] = "{X_SITEURL}modules/xoopsfaq/";
$Mylink["FORUM"] = "{X_SITEURL}modules/newbb/";
//put English links here
} else {
$Mylink["Home"] = "{X_SITEURL}modules/wfsection/article.php?articleid=8";
$Mylink["About Us"] = "{X_SITEURL}";
$Mylink["Celebration Sunday!"] = "{X_SITEURL}modules/wfsection/article.php?articleid=5";
$Mylink["House Churches"] = "{X_SITEURL}";
$Mylink["English Bible Classes"] = "{X_SITEURL}";
$Mylink["FAQ"] = "{X_SITEURL}modules/xoopsfaq/";
$Mylink["Forum"] = "{X_SITEURL}modules/newbb/";
}
//build table based on links
echo "<div class='blockContent'><table cellspacing=0>";
foreach ($Mylink as $Show => $Link) {
echo "<tr><td id='mainmenu'>
<a class='menuMain' href=$Link>$Show</a></td></tr>";
}
echo "</table></div>";


I don’t think too many of you will have the same Menu items as me! My site, clcfamily.net, for a church in Osaka, Japan is very much under contruction and there isn't too much content up, except the FAQ, but it would give you an idea of how all these multi-lingual hacks are working.

Using that idea you can make as many menus or other types of pages that you need…

Idea #2: Using the recently released iMenu 2 – in blocks/imenu.php file change line 30 to this:
Quote:
$out='<a class="menuMain" target="'.$fc_item['target'].'" href="'.$fc_item['link'].'">· '.$myts->makeTboxData4Show($fc_item['title']).'</a>';

That will force the menu titles to go through to XOOPS decoder.

I hope that helps!
Chad
clcfamily.net



95
Chado
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/17 15:59

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


Quote:
This hack works great but what's about translating the story title not just the body content

Actually, it is also easy to make the Titles multilingual in much the same way as the content, with a simple hack to the same module.textsanitizer.php file. I did a quick look at how the tables are setup and most title fields are limited to 255 characters, so that probably is enough space most of the time for at least 2 languages.
I tested this real quickly here and it seems to work in at least the news, FAQ, Forum and WF-Sections. I don’t have a lot of other modules installed at the moment on my test site, so I couldn’t test too many others.
The only thing I found that didn't work was the comment titles. Someone might dig around and see if they can find how the comment title is produced.

Toward the bottom of the module.textsanitizer.php file in your class folder, there is a function called makeTboxData4Show and another one makeTboxData4Preview. In both of them just before the line:
return $text;
you need to add a new line like this:
$text =& $this->xoopsCodeDecode($text, 0);
That is it! This forces the titles to go through the XOOPS codedecoder where it will find your original language hack.

Hope this helps!
Chad

Here is what those two functions look like on my computer:
Quote:
function makeTboxData4Show($text, $smiley=0)
{
$text = $this->htmlSpecialChars($text);
$text =& $this->xoopsCodeDecode($text, 0);//added by chad
return $text;
}

function makeTboxData4Preview($text, $smiley=0)
{
$text = $this->stripSlashesGPC($text);
$text = $this->htmlSpecialChars($text);
$text =& $this->xoopsCodeDecode($text, 0);//added by chad
return $text;
}



96
Chado
Re: SOLVED - Making Xoops CONTENT Multilingual
  • 2003/7/17 2:17

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


Thanks everyone,

You're right - the XOOPS code funtion changed my code! I edited my original post and changed it to a quote box and it seems to show up correctly. Basically the backslash was not showing up. I thought the code box would let us put anything in there, but not so....

If this doesn't work, PM me and I will be happy to email you my module.textsanitizer.php file.

Have fun!
Chad



97
Chado
Re: SOLVED - Making Xoops CONTENT Multilingual
  • 2003/7/16 3:59

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


Quote:
(More on that later)

I forgot to mention this, but while working on this hack, I tried to make it in such a way that it would automatically adapt to any language without having to go in and change the textsantizer code every time for each language - but I wasn't able to do it. So someone who knows php much better might be able to do it and make this hack something that could be used as is for anyone.....

So, instead of looking for each language (i.e. [english] or [japanese]), would it be possible to do something similar to the font or color code ([ font = Impact]) and have just one code that traps for different language - say something like [lang = english] and then have textsanitizer look at the language and if it is the current language then show the text, else don't show it. Does this make sense??

If someone could do this, it might be a much more useful hack for everyone.

Thanks,
Chad



98
Chado
SOLVED - Making Xoops CONTENT Multilingual
  • 2003/7/15 14:24

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


This hack will work with news, forum, wf-sections, tinycontent or any module that uses the textsanitizer.
After searching the boards and posting a couple questions that never were answered, I had a go at this myself and well…necessity is the mother of invention….I discovered the module.textsanitizer.php file and messed with it till I got it to work. I am not a coder, so I am sure that someone can improve on this. (More on that later)
First things first:
This hack assumes that you are using the multi-lingual hack that can be downloaded here from ModsCentral.
To install it on Xoops2.x, follow the instructions I posted here.
That will get your XOOPS to be multilingual.

Now to make your content multilingual:
1. Open the module.textsanitizer.php file in the class folder. Around line 145 is the function “&xoopsCodeDecode” After the line
Quote:
$replacements = array();

and before the line
Quote:
$patterns[] = "/\[ code](.*)\\[\/ code\]/esU";

Place this code:
Quote:
//multi-lingual hack by chad--if japanese show japanese else show nothing
global $xoopsConfig;
$patterns[] = "/\[japanese](.*)\[\/japanese\]/sU";
if ($xoopsConfig['language'] == "japanese") {
$replacements[] = '\\1';
} else {
$replacements[] ="" ;
}
//if english show english else show nothing
$patterns[] = "/\[english](.*)\[\/english\]/sU";
if ($xoopsConfig['language'] == "english") {
$replacements[] = '\\1';
} else {
$replacements[] = "";
}
//end multi-lingual hack

Of course you will change the language ('english','japanese') to reflect the languages that you are targeting. The name in the brackets has to match the name of your language pack that you downloaded (or created). You could add more if you are targeting more than 2 languages.

To use this:
When you add your article just enclose the section you want shown in a particular language in brackets with that language name. This is very similar to adding a url or code to an article. For example: Quote:
[english]This is my English text.[/english][japanese]kore ha nihongo desu.[/japanese] This text (not enclosed in brackets) will show up in both (all) languages.


If you are just targeting European languages, you may not have to worry about this, but if you are targeting multi-byte languages like Japanese you may have to manually change the character encoding of your English global.php file to match your japanese one.

That’s it! Basically very simple – If you are having problems with the layout, you probably are putting spaces between the codes.
I hope this helps!
Chad



99
Chado
Re: Language selection
  • 2003/7/1 15:20

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


Elena, Jose: I am glad the hack worked for you.

I wonder if anyone has tried to make their articles bilingual. I mean, would it be possible to do something like this:
<{if $xoops_langcode =='ja'}> Include my Japanese article here <{else}> Put my English one here <{/if}>

In other words, if the selected language is Japanese, it would only show the Japanese text, or English then only English.
This actually works on my theme.html file, but I can't seem to get it to work form within an article. Can someone who understands coding and XOOPS articles give me a pointer on this.

Thanks!
Chad



100
Chado
Re: Language selection
  • 2003/6/30 2:15

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


There have been several questions recently about using the language hack by Adi Chiributa in XOOPS 2.x. It was originally hacked for XOOPS 1, but I tweaked it just a bit and have been able to get it to work in my test environment using the two languages that I will be targeting (Japanese and English). It seems to work just fine. (I am not a programmer though so I may be missing something) Just remember, as the author says, this is only for the interface and not content. You can get the hack here from ModsCentral.

In the author's readme he gives instructions on how to install the hack. Basically everything works except for the hack to the XOOPS/include/common.php. Instead of including the hack at the place where he said, include it just BEFORE the “include site-wide lang file” section:

// ############ Include function for language selection ##############
include(XOOPS_ROOT_PATH."/modules/language/common/functions.php");

// #################### Include site-wide lang file ##################

The SPACE character that is part of the default setup shows up strange in the block if you are using the flags, so you will have to change that by selecting edit on the admin blocks page.

If you are going to be using a multi-byte language (like Japanese), you may need to change the character encoding for English or other single-byte languages so that people coming with English browsers will be able to see the content that is in Japanese. If you need to change the character encoding for any of your languages, that setting can be found toward the bottom of the global.php file for each language. It took me a lot of hunting to find that.

I hope this works for you.




TopTop
« 1 ... 7 8 9 (10)



Login

Who's Online

246 user(s) are online (160 user(s) are browsing Support Forums)


Members: 0


Guests: 246


more...

Donat-O-Meter

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

Latest GitHub Commits