21
hsalazar
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/19 18:24

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


Chad, all:

I've successfully hacked the blocks titles using Chad's idea # 2. This is what I did, in case somebody points it as a mistake:

I opened the file header.php and in the final part, after line 170, there's a switch statement with five cases.

For every case, I included a line to instantiate the sanitizer, like this:
Quote:
$myts =& MyTextSanitizer::getInstance();


Then, for every instance of the string:
Quote:
'title' => $block_arr[$i]->getVar('title')

I wrapped around the call to the sanitizer, to make the variable pass through the decoder, so I changed the string to this:
Quote:
'title' => $myts->makeTboxData4Show($block_arr[$i]->getVar('title'))

Please take a look at this and tell me if it works for you.

In my case, I had to repeat the wrapping for the incblocks module, because in the inside of the box, the titles of the individual blocks weren't making the translation, but all I had to do was change a bit the file triblocks.php. Lines 59-61 used to read:
Quote:

$block['contenu'][]=$bcontent;
$block['titre'][]=$block_arr[$i]->getVar('title');

and I changed them to read:
Quote:

$myts =& MyTextSanitizer::getInstance();
$block['contenu'][]=$bcontent;
$block['titre'][]=$myts->makeTboxData4Show($block_arr[$i]->getVar('title'));

So far, this works fine. Please let me know if you can also change this successfully.

PS: As for the menu items, I understand that by using a custom block, as Chad suggests, I'd lose the functionality of having the submenus displayed for those modules that have suboptions, right?

22
hsalazar
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/19 19:08

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


Chad, All:

I've successfully hacked my way to translation of menu items. All I had to do was to modify, within the file modules/system/blocks/system_blocks.php the function b_system_main_show().

Three changes:

1) Added instantiation of text sanitizer

2) Where it says
Quote:

$modules[$i]->getVar('name')

I put
Quote:

$myts->makeTboxData4Show($modules[$i]->getVar('name'))

And where it says:
Quote:

$sublink['name']

I put
Quote:

$myts->makeTboxData4Show($sublink['name'])

So far, so good. Please try the hack and let me know if it works. Cheers.

PS: Also had to repeat the procedure in the file header.php to pass through the decoder the variable xoops_pagetitle.

23
Daigoro
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/19 23:59

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2



Hsalazar,
I've successfully completed the changes you describe in your last two posts. I've not found any side-effects. Good work!

I don't understand your PS in the last post. Please elaborate.

I'm not much of an php-shark so I'm unable to make similar changes to various modules. Do you plan to "extend your service" to also make hacks for the available 2.0 modules?
(Polls and tinyevent comes to mind.) (^_^)

Best regards!

24
hsalazar
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/20 0:06

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


Daigoro:

The postscript meant if you don't change also header.php in the pagetitle part, the whole string appears in the title of the page, on top of the browser.

As to extending the hack to serve other modules, I'm not sure. I'm in fact using somebody else's hacks and just extended what I needed. But whatever I do, I'll share here gladly.

25
Daigoro
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/20 17:17

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Hsalazar,
Thanks. Later tonight I'll try to change the pagetitle according to your description.
I'll also try to catch up on my php skills (afterall, it's just yet another language to learn), so I will be able to hack other modules like you have done. IF I succeed, I'll post the functionality here.

Best regards!

26
Daigoro
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/21 18:55

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Hi again Hsalazar,

Quote:

PS: Also had to repeat the procedure in the file header.php to pass through the decoder the variable xoops_pagetitle.


I'm afraide I have to ask for a step by step description, on how to implement the above. It seems I'm only able to either make it do nothing or to make the complete website invisible. Please let me know how you did it. Thanks.

Best regards,

27
hsalazar
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/21 19:43

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


Daigoro:

No problem. In the original header.php file, there are, in lines 97 and 115, two instances of the same line:
Quote:

$xoopsTpl->assign('xoops_pagetitle', $xoopsModule->getVar('name'));

What I did was replace each line with this:
Quote:

$myts =& MyTextSanitizer::getInstance();
$perro = $myts->makeTboxData4Show($xoopsModule->getVar('name'));
$xoopsTpl->assign('xoops_pagetitle', $perro);

As you see, I used an intermediate variable, $perro, to store the name of the page once passed through the sanitizer, and then assigned this value to the Smarty variable xoops_pagetitle.
I thinks that's all I did. If you stumble into some trouble, please let me know.
Also, be aware there's a new option available to make sites multilingual. I haven't tried it yet, but in some ways (I just read one document) it seems easier than the route we've followed here. It rests to be seen how is it that you upload content in the other option. [This new option is available by registering in PetitOOps. Browse the recent news here.]

28
Daigoro
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/21 23:00

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Hsalazar,

Thanks for your quick answer. I've tested the latest description you have posted, and it seems not to work. However, with a slight change it's working for the slogan part of the title. The main title remains a mixture of all languages. I guess you did change a bit more.

I'm aware of the new multilangual hack. I've looked very briefly at it, and it appears to be quiet limited in it's functionality. I ought to try to install it, but it will have to wait until I have abit more time (and an extra xoops-instalation) on my hands. If you try it, please let me know your opinion.

Best regards,
--
Daigoro

29
hsalazar
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/22 0:14

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


Daigoro:

If it works for the slogan part of the title, it might mean you changed the file in a different line.
The structure of this part of the file has something like this:

If the user IS registered...
--- If there's a module defined as initial
------ Assign $xoopsModule->getVar('name') to the variable xoops_pagetitle
--- Else (no module defined as initial)
------ Assign $xoopsConfig['slogan'] to the variable xoops_pagetitle
Else (the user IS NOT registered)
--- If there's a module defined as initial
------ Assign $xoopsModule->getVar('name') to the variable xoops_pagetitle
--- Else (no module defined as initial)
------ Assign $xoopsConfig['slogan'] to the variable xoops_pagetitle

So it might be possible that you included the wrapper to the conditions related to the assignment of the slogan to the variable xoops_pagetitle.

30
Daigoro
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/22 8:01

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Hsalazar,

I was aware of the structure, and I did change the lines for all four cases. To start with I only tried the title part, but it didn't work. Then to test, I tried the slogan-part, and it's working fine.

I still have the problem with the title part, but not the slogan part.

This is what I did:

For every instance of this line:
Quote:

$xoopsTpl->assign('xoops_pagetitle', $xoopsModule->getVar('name'));

I replaced the line with this:
Quote:

$myts =& MyTextSanitizer::getInstance();
$perro = $myts->makeTboxData4Show($xoopsModule->getVar('name'));
$xoopsTpl->assign('xoops_pagetitle', $perro);


And for every instance of this line:

Quote:

$xoopsTpl->assign('xoops_pagetitle', $xoopsConfig['slogan']);

I replaced the line with this:
Quote:

$myts =& MyTextSanitizer::getInstance();
$perro = $myts->makeTboxData4Show($xoopsConfig['slogan']);
$xoopsTpl->assign('xoops_pagetitle', $perro);


Just to make sure I'm not confusing things. The title part mentioned above means the browser title, currently reading XOOPS Official Site, and the slogan part is located just next to the title, currently reading Forum.

What did I do wrong?

Login

Who's Online

417 user(s) are online (306 user(s) are browsing Support Forums)


Members: 0


Guests: 417


more...

Donat-O-Meter

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

Latest GitHub Commits