Something to play with - possible changes to Joomfish

Discuss the development and implementation of Joomla! components here.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Something to play with - possible changes to Joomfish

Post by Geraint » Tue Sep 27, 2005 10:16 am

Mambelfish was a great component and an essential part of Mambo, however it didn't quite do everything I wanted:
  • It was too slow
  • It often didn't work with components that made queries involving multiple tables e.g. Joins
  • It couldn't deal with components who's tables used primary keys not called "id"
  • I could never get caching of menus to work properly
  • I had problems with adding content in the the non-default language via the front end - it would get overwritten when the "translation" into the default language was made
I therefore set about hacking and believe the changes I have made, deal with the first 4 of my problems.  I am using these changes on a production site and thought I'd submit them for others to play with/comment on while we wait for the release of Joomfish.  Let me know what you think.

I can now translate PHP-shop, ponygallery and simpleboard forum messages as well as what was possbile before.

Geraint

p.s. To deal with menu caching see : http://forum.joomla.org/index.php/topic,7522.0.html
p.p.s. Installing mambofish 1.5 with joomla 1.0.1 0 you need to refer to http://forum.joomla.org/index.php/topic ... l#msg48301
You do not have the required permissions to view the files attached to this post.

User avatar
pulp
Joomla! Apprentice
Joomla! Apprentice
Posts: 47
Joined: Fri Aug 19, 2005 2:37 am
Location: Jeddah
Contact:

Re: Something to play with - possible changes to Joomfish

Post by pulp » Thu Oct 13, 2005 2:20 pm

Thanks, i will try these changes...
Creative Engineering IT & Design Solutions
http://www.creative-e.net
Bi-Lingual RTL Joomla Implementations

zanami
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Oct 19, 2005 1:36 pm

Re: Something to play with - possible changes to Joomfish

Post by zanami » Tue Oct 25, 2005 7:21 am

  • Geraint wrote: Mambelfish was a great component and an essential part of Mambo, however it didn't quite do everything I wanted:
    ...
    • I had problems with adding content in the the non-default language via the front end - it would get overwritten when the "translation" into the default language was made
...
Geraint
[/quote]

Great mod! It's easy now to deal with that other than "id" key fields!

I just can't think of any nice way to add content in non-default language... My only idea is to use the mbf_content table to store all of content that can be translated.
i.e. if the site's default language is english we create a dummy content record in the original table with content (text) fields set to "NA" with all other fields set as normal
Next we insert new "translation" records into MBF table with language set to "english" (or whatever other language we write in).
So all languages become equal. If needed we can promote ANY language to be "default" OR we can disable it at all, so we'll see nothing if there's no translation to current selected language

Any comments? I'm stuck and  really need some fresh ideas...

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Thu Oct 27, 2005 7:30 am

I add "content" via a "submit news" menu item (note that if you use the correct section/category ids this is not restricted to news items.

What my changes do is add the "new content" to both the content table and mambelfish mbf_content table as a translation - subsequently if the default language version is added this replaces the original content table version and hey presto you have both languages.  I have not tried a 3rd language (since I only use 2 in my setup).

Geraint

User avatar
lpkb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 159
Joined: Mon Aug 22, 2005 9:44 pm
Contact:

Re: Something to play with - possible changes to Joomfish

Post by lpkb » Wed Nov 09, 2005 5:02 pm

should i just copy these files in the "changes.zip" over top of the old ones, backing up the old ones in case it doesn't work? would you trust copying these over on a production site? (ie. will the changes make the default functionality different, or is it just an "add-on" that leaves default functionality the same?)

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Wed Nov 09, 2005 5:43 pm

I would not recomend using these in a production environment before testing them out yourself.  For example I have only tested them in a bilingual (as opposed to multilingual setup).

If you want to try them you overwrite the existing files (backing them up before hand of course).  Let me know how you get on.

I have been discussing with Alex (Akede) implementing some of this functionality into Joomfish when its released (before too long hopefully).

Geraint

User avatar
lpkb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 159
Joined: Mon Aug 22, 2005 9:44 pm
Contact:

Re: Something to play with - possible changes to Joomfish

Post by lpkb » Wed Nov 09, 2005 10:05 pm

okay, i'm going to experiment with this...

what else do i need to do after I copy these files over the existing mamblefish files? i did so, but don't see any difference yet (besides that my mamblefish module is displaying differently--no spaces or "|" dividers--why is that?)

lpkb

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Thu Nov 10, 2005 9:11 am

You shouldn't "see" much in terms of changes just more functionality.  Can you clarify what you mean by
no spaces or "|" dividers


I realised looking back at the code that the config file I included still points to the old "xml" config files - if you manually modify the config.mambelfish.php file to make sure it includes the following line (NOTE the mbf.php) :

Code: Select all

$mambelfish_whichContentElements = "mbf.php";       // which type of content elements to use - xml or mbf.php files
You should now be able to translate more than you could before - you could try some ponygallery stuff or simpleboard (joomlaboard).  Also I am attaching the required mbf.php files for translating phpShop.

If you made the suggested change to deal with menu caching you can switch that on via the module settings.

All the best

Geraint
You do not have the required permissions to view the files attached to this post.

User avatar
lpkb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 159
Joined: Mon Aug 22, 2005 9:44 pm
Contact:

Re: Something to play with - possible changes to Joomfish

Post by lpkb » Thu Nov 10, 2005 1:40 pm

okay i'll try this out.

i also just noticed my visitor's book (akobook) now says:

Code: Select all

Warning: Missing argument 4 for translate() in /home/rscji/public_html/components/com_mambelfish/classes/mambelfish.class.php on line 234

Warning: Missing argument 5 for translate() in /home/rscji/public_html/components/com_mambelfish/classes/mambelfish.class.php on line 234

Warning: Invalid argument supplied for foreach() in /home/rscji/public_html/components/com_mambelfish/classes/mambelfish.class.php on line 241
before the items appear correctly below it...

l

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Thu Nov 10, 2005 1:51 pm

Are these items actually translated (I haven't converted the contentElement file from xml to php format for akobook) - if not you can still use the xml versions (set $mambelfish_whichContentElements = "xml" in the configfile).

I'll install the component myself to see if I can recreate the warnings.

Geraint

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Thu Nov 10, 2005 2:23 pm

Actually my last response was a red herring!

akobook.php makes an unecessary direct call to MambelFish::translate c. Line 38 (the menu name was translated automatically two lines earlier!).

Just comment this line out = it does absolutely nothing in akobook.

In the meantime I have made a change to the function declaration to trap old function calls.

Geraint

User avatar
lpkb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 159
Joined: Mon Aug 22, 2005 9:44 pm
Contact:

Re: Something to play with - possible changes to Joomfish

Post by lpkb » Thu Nov 10, 2005 4:23 pm

Geraint, you are right about the akobook issue!

Now with the change you mentioned above, new options also appear in the translation administration, and i have begun translating simpleboard. early problem is that it translates the forum links but not the descriptions. it does seem to be working in other respects with three languages.

as to the module I mentioned, see the attached graphic. It used to say "Castellano  |  English  |  Français" but now as you see it says "CastellanoEnglishFrançais"

Thanks again
You do not have the required permissions to view the files attached to this post.

User avatar
lpkb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 159
Joined: Mon Aug 22, 2005 9:44 pm
Contact:

Re: Something to play with - possible changes to Joomfish

Post by lpkb » Thu Nov 10, 2005 4:31 pm

also, is there anyway to get the titles of the items to show up? when i go into mamblefish translations > simpleboard, everything title is blank and i have to physically open it to see what it is.

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Thu Nov 10, 2005 4:40 pm

Ok - I understand now.

This is the language switcher module you are talking about.  Assuming you are using "hlist" as a type if you set the "textSpacer" to blank (or " | ") in the config file you should get what you are looking for.

I haven't figured out how the title field yet I'm afraid - that's the next project.

Geraint

p.s. As an aside I use himage flags myself (Welsh and British).  The non-speaking Welsh visitors got a bit upset when I used the Welsh and English flags.

User avatar
rainwebs
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sun Oct 09, 2005 11:23 pm
Location: Eichenzell, Germany
Contact:

Re: Something to play with - possible changes to Joomfish

Post by rainwebs » Thu Nov 10, 2005 4:45 pm

Hi,

I didn't have a look at Geraint code. But, I developed an adaptation for the MambelFish 1.1 and Simpleboard 1.0.3. You may have a look at the code extentions for simpleboard. Maybe this can help to find out what's going wrong.

Fishermambs

Code templates

Regards Rainer
Freeware for Halloween fans: http://halloween.jigetiser.com
Wallpapers, Screensavers, Posters, Calendars, Jigsaw Puzzles

User avatar
lpkb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 159
Joined: Mon Aug 22, 2005 9:44 pm
Contact:

Re: Something to play with - possible changes to Joomfish

Post by lpkb » Thu Nov 10, 2005 4:53 pm

@geraint: i've changed the config file but it doesn't seem to be affecting the module display...any other ideas?  :)

@rainwebs: thanks for the input. i'm not sure how much sense it would make to me as I haven't been inside the code too much, but maybe someone will find it helpful. i appreciate it.

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Thu Nov 10, 2005 5:06 pm

Title problem was an easy fix (I now own a debugger!).  Change the mbf.php file for simpleboard so that the type of the "name" field is "titletext" as opposed to just "text".

Code: Select all

$tempContentElement["fields"][]=array("type"=>"titletext","name" => "name","translate" =>"1", "label" => "Name");
Assuming your cache has been cleared can you confirm what type of language list you are using and tell me what you get in the source code for that part of the page (i.e. from view source in the browser).

Geraint

p.s. Rainer : the changes I made to the fish mean that no changes are required in Simpleboard, ponygallery, phpshop (and more components I'm sure) to support widescale translation functionality.  The goal is to get this extended functionality into Joomfish!

User avatar
rainwebs
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sun Oct 09, 2005 11:23 pm
Location: Eichenzell, Germany
Contact:

Re: Something to play with - possible changes to Joomfish

Post by rainwebs » Thu Nov 10, 2005 7:30 pm

Quite cool. May had to have a deeper look, first  :-[

Are you already part of the Joomfish team (as shown at the SF project page)?

Regards Rainer
Freeware for Halloween fans: http://halloween.jigetiser.com
Wallpapers, Screensavers, Posters, Calendars, Jigsaw Puzzles

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Thu Nov 10, 2005 7:50 pm

rainwebs wrote: Are you already part of the Joomfish team (as shown at the SF project page)?
Yes - I'm hoping to get much of this functionality layered into the changes that Alex has already made, during the next few weeks.  Not sure which release but I'm sure it'll all get in since it generalises and expands on the current approach rather than requiring wholesale restructuring.

I have bilingual sites that require simpleboard, phpshop and ponygallery on an ongoing basis!

Geraint

User avatar
lpkb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 159
Joined: Mon Aug 22, 2005 9:44 pm
Contact:

Re: Something to play with - possible changes to Joomfish

Post by lpkb » Thu Nov 10, 2005 10:14 pm

great! the titles are now appearing in the simpleboard item in the dropdown list. is it similar for the simpleboard2 item? i peeked but didn't see a "name" in that one.

as to the module...i just added some space in the css and it's fine.  :)  thanks again!

User avatar
lpkb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 159
Joined: Mon Aug 22, 2005 9:44 pm
Contact:

Re: Something to play with - possible changes to Joomfish

Post by lpkb » Thu Nov 10, 2005 10:43 pm

i did have one other question regarding the descriptions of the forums--they are not translating. are you having the same issue there? the forum/category names are translating fine, but the description remains in the default language.

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Fri Nov 11, 2005 9:16 am

Simpleboard2 is for translating messages and no there are not text=>titletext changes neede there.  The translation process only works from the admin side at present - probably only useful for admin/sticky messages until I write a frontend message translation module.

My forum descriptions are translating fine (Simpleboar 1.1.0 stable).  Which version of Simpleboard are you using?  What does your URL looklike (I only need the bit after the hostname - and if you are running some advanced SEF what the index.php? type URL would be).

Geraint

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Fri Nov 11, 2005 10:20 am

If you make 3 trivial changes to Joomlaboard

1.in listcat.php c. line 240 change to read (NB the id field)

Code: Select all

           //Get the forumdescription
            $database->setQuery("SELECT description, id from #__sb_categories where id='$singlerow->id'");
2. in showcat.php c. line 240  change to read (NB the id field)

Code: Select all

      //Get the category name for breadcrumb
      $database->setQuery("SELECT id,name,locked,review, parent from #__sb_categories where id='$catid'");
3. in view.php c. line 195 - the same again

I'll try to find a solution that doesn't require these changes.

Geraint

p.s. Changes fixed typos
Last edited by Geraint on Fri Nov 11, 2005 10:58 am, edited 1 time in total.

ivailo
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Fri Nov 11, 2005 10:29 am
Location: Bulgaria

Re: Something to play with - possible changes to Joomfish

Post by ivailo » Fri Nov 11, 2005 5:48 pm

Could you plese help me !
I am trying to use Mambo + Mambelfish + Zoom Gallery
I've tried to use your changes.zip , but it seems it's not working for me.
Or may be I need to change something.
When i make XXXXX.xml file to find the componets that should be translated nothing hapens.

Plese help me

ivailo
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Fri Nov 11, 2005 10:29 am
Location: Bulgaria

Re: Something to play with - possible changes to Joomfish

Post by ivailo » Sat Nov 12, 2005 3:54 pm

I've tried changes.zip
I've tried Pony Gallery with mambelfish and Mambo For the first table with prymary key id the translation is working, but for the second table with primary key cid I am receiving that error:
Warning: Invalid argument supplied for foreach() in D:\apachefriends\xampp\htdocs\administrator\components\com_mambelfish\admin.mambelfish.html.php on line 467

Could you help

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Sun Nov 13, 2005 7:56 pm

This warning relates to a another assumption in the code that the primary key is called id (thanks for spotting it since I don't really use the contentelementconfiguration stuff myself) - this shouldn't affect the translation process though.

What might help the translation is to fix a couple of typos in ponygallerycategory.mbf.php (and similar in phpgallery.mbf.php)

change

Code: Select all

      $tempContentElement["fields"][]=array("type"=>"text","name" => "name","translate" =>"1", "label" => "Name");
to

Code: Select all

      $tempContentElement["fields"][]=array("type"=>"titletext","name" => "name","translate" =>"1", "label" => "Name");
I could never get Zoom gallery to work so haven't looked at translations there.

Geraint

ivailo
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Fri Nov 11, 2005 10:29 am
Location: Bulgaria

Re: Something to play with - possible changes to Joomfish

Post by ivailo » Sun Nov 13, 2005 11:13 pm

I've tried that: 
For that table -  ponycategory.mbf I am receiving the same error. I am receiving that error on any components with diferent than id primary kay. That's why I think that the primary key is the problem.

Thats the mbf file for that table:
"contentelement",
  "name" => "PonyGalleryCategories",
  "author" => "Geraint Edwards",
  "version" => "1.0",
  "description" => "Definition for album categories",
  "primarykey" => "cid",
  "tablename" => "ponygallery_catg");
      $tempContentElement["fields"][]=array("type"=>"referenceid","name" => "cid","translate" =>"0", "label" => "cid");
      $tempContentElement["fields"][]=array("type"=>"titletext","name" => "name","translate" =>"1", "label" => "Name");
      $tempContentElement["fields"][]=array("type"=>"titletext","name" => "description","translate" =>"1", "label" => "Description");
   
  $phpContentElement[$tempContentElement["tablename"]]=$tempContentElement;
 
?>

Can you suggest anything : Or is there a patch for mambelfis. I've looked that there will be joom!fish for Joomla, may be that problem will be fixed there.

Thanks for your help
Last edited by ivailo on Sun Nov 13, 2005 11:31 pm, edited 1 time in total.

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Mon Nov 14, 2005 8:53 am

You're right, as I said in my last message this is a something I missed in my changes.zip attachment - "id" is hardcoded as the primarykey (sql statement at line c.462 of admin.mambelfish.html.php.  I have a fix but it is tied in with other changes made after this thread was started.  When this functionality gets into the fish I'll make sure the fix is incluced.

In the meantime the warning doesn't affect your ability to translate so don't worry about it.

Your ponycategory.mbf.php file should read:

Code: Select all

<?php
$tempContentElement = array("type" => "contentelement",
  "name" => "PonyGalleryCategories",
  "author" => "Geraint Edwards",
  "version" => "1.0",
  "description" => "Definition for album categories",
  "primarykey" => "cid",
  "tablename" => "ponygallery_catg");
       $tempContentElement["fields"][]=array("type"=>"referenceid","name" => "cid","translate" =>"0", "label" => "cid");
       $tempContentElement["fields"][]=array("type"=>"titletext","name" => "name","translate" =>"1", "label" => "Name");
       $tempContentElement["fields"][]=array("type"=>"htmltext","name" => "description","translate" =>"1", "label" => "Description");
    
  $phpContentElement[$tempContentElement["tablename"]]=$tempContentElement; 
?>
Note the types should be referenceid, titletext and htmltext.

Geraint

ivailo
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Fri Nov 11, 2005 10:29 am
Location: Bulgaria

Re: Something to play with - possible changes to Joomfish

Post by ivailo » Mon Nov 14, 2005 10:35 am

Thanks that's working I've just translated the first categories.
Did you know if i'll be anle to translate static items like : User Pannel - Most Viewed - Top Rated - Last Added - Last Commented Categories

Thanks again for that changes.zip  patch you've wrote. It's very helpfull.

Regards,

User avatar
Geraint
Joomla! Guru
Joomla! Guru
Posts: 561
Joined: Fri Aug 19, 2005 5:23 pm
Location: Gogledd Cymru

Re: Something to play with - possible changes to Joomfish

Post by Geraint » Mon Nov 14, 2005 10:44 am

To translate the application text you need to create and add a suitable language file to compontents/com_ponygallery/language/ - I have a partly built cymraeg.php (but that's probably not much help to you!).

Geraint


Locked

Return to “Components”