Joomfish preview hack
We are using JoomFish component for multilingual sites and we have encountered a problem with content pages which include FORM. As it is difficult to translate such a pages we have implemented a little hack into JoomFish component which changes preview to normal HTML. Then it is possible to translate also content pages which includes FORMS.

How it works:

The problem with FORMS in JoomFish is there because when you are going to translate any content item, then the preview shows original html as a part of translation page. If this content item includes FORM html element then the Joomfish interface does not work as expected. To make Joomfish working we have just put original HTML into textarea so it is not processed as html but as a normal text. This way it is not a problem anymore to translate pages which includes FORMS.

Disadvantages:

This solution brings 2 disadvantages.

  • You do not see preview directly during translation in Admin interface and you cannot use WYSIWYG editor if this hack is applied
  • You need to copy the html manually from Original textarea into Translated Textarea. This is because we wanted to modify minimum Joomfish source code and to make the copy button working it would require more changes.


What needs to be changed:

Actually the changes are very small and made in one file. You need to modify following file:

/administrator/components/com_joomfish/admin.joomfish.html.php

At line 1593 you need to change following:

Original code:

<td align="left" valign="top" id="original_value_<?php echo $field->Name?>">
<?php
  echo $field->originalValue;
?>
</td>

Changed code:

<td align="left" valign="top" id="original_value_<?php echo $field->Name?>">
<?php
   /* echo $field->originalValue; */
?>
<?php
if( strtolower($field->Type)=='text' || strtolower($field->Type)=='titletext' ) {
   echo $field->originalValue;
?>
<?php
} else {
  $ta_rows = ($field->Rows>0)?$field->Rows:15;
  $ta_cols = ($field->Columns>0)?$field->Columns:100;
?>
  <textarea name="MyOriginalName" rows="<?php echo $ta_rows;?>" cols="<?php echo $ta_cols;?>" ><?php echo $field->originalValue; ?></textarea>
<?php
}
?>
</td>


Modified file for JoomFish 1.8.2 version can be downloaded here.