query(); $app->redirect(JRoute::_("index.php?option=com_chronoforms&chronoform=xxx&Itemid=". JRequest::getInt('Itemid')), JText::_('DELETED_ITEM')); } else { $app->redirect(JRoute::_("index.php?option=com_chronoforms&chronoform=xxx&Itemid=". JRequest::getInt('Itemid')), JText::_('NOT_AUTH') ); }}?>language action contains:DELETED_ITEM=Item successfully deletedNOT_AUTHORIZED=Not authorized.prob is that the system message doesnt display the value of the constant but the constant itself.could somebody pls point out to me what I'm doing wrong?J!2.5 CF 4 RC3.21"> system msg and language action - Forums

Forums

system msg and language action

?
Guest 17 Apr, 2012
hi all,

I am facing a prob with a couple of my language strings:

after the db save I am using a custom code action for displaying a system msg:
<?php
$app =& JFactory::getApplication();
$url = 'index.php?option=com_chronoforms&chronoform=listhorses&Itemid='. JRequest::getInt('Itemid');
$message =  JText::_('SAVED_ENTRY');
if (isset ($_POST['input_submit_14']))
   $app->redirect(JRoute::_( $url ), $message );
else $app->redirect(JRoute::_( $url ), false );
?>

the language action contains:
SAVED_ENTRY=Entry successfully saved

on another form that lists all entries the delete logic is like this:
<?php
$database =& JFactory::getDBO();
$app =& JFactory::getApplication();
$uid = JRequest::getVar( 'cf_uid' , '', 'get');
if ($uid) {
	$user =& JFactory::getUser();
	$cf_user_id = JRequest::getVar( 'cf_user_id' , '', 'get' );
	if ( (!$user->authorise('core.admin') AND $cf_user_id = $user->id) OR $user->authorise('core.admin') ) {
		$database->setQuery("DELETE FROM #__cf_sometable WHERE cf_uid = '$uid'");
		$database->query();
		$app->redirect(JRoute::_("index.php?option=com_chronoforms&chronoform=xxx&Itemid=". JRequest::getInt('Itemid')), JText::_('DELETED_ITEM'));
	} else {
		$app->redirect(JRoute::_("index.php?option=com_chronoforms&chronoform=xxx&Itemid=". JRequest::getInt('Itemid')), JText::_('NOT_AUTH') );
	}
}
?>

language action contains:
DELETED_ITEM=Item successfully deleted
NOT_AUTHORIZED=Not authorized.

prob is that the system message doesnt display the value of the constant but the constant itself.

could somebody pls point out to me what I'm doing wrong?

J!2.5 CF 4 RC3.21
GreyHead 18 Apr, 2012
Hi gabrialaH,

I'm not sure exactly what is happening here. Are you using the ChronoForms Multi-Language actions?

If so, ChronoForms doesn't use standard Joomla! Language files so you can't use JText::_(); it only tries to translate 'displayed' text i.e. Form HTML, the email template; and it does the translation (by search and replace) late in the process, usually after any PHP is complete.

For your messages you can either add your own language files, or if there are just a few phrases define them with a switch statement in the PHP.

Instead
?
Guest 18 Apr, 2012
hi Bob,

yes I am trying to use multi language actions.
in J1.5 I could simply add an en-GB.com_chronoforms.ini to the respective J!language folder and got all the JTEXT stuff translated as desired. trying to do the same with J!2,5 and the lastest CF doesnt appear to be working any longer. also tried adding
JFactory::getLanguage()->load('com_chronoforms');
to ../components/com_chronoforms/chronoforms.php but to no avail.
using multi language actions JText::_(); works in custom elements / custom code / for labels etc but not for system messages.

setting up a switch for the strings in the diff languages might work though

hmm! why do J!language files not work anymore? any idea why that is?
and why are J!language files not part of CF in the first place?
GreyHead 21 Apr, 2012
Hi gabrielaH,

I don't know why your language files aren't working :-(

In my custom actions I have added them using this code (they load from the action folder, and $this->action is the action name):
		$this->base_dir = JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_chronoforms'.DS.'form_actions'.DS.$this->action;
		$lang =& JFactory::getLanguage();
		$lang->load( 'com_chronoforms.'.$this->action, $this->base_dir );


ChronoForms has never had language files; I think originally Max found it simpler that way and there is not a lot of front-end language displayed. There have been two versions created that used language files - I did an early version of CF a long time ago and more recently an version of CFv4 was converted. Max didn't' chose to use either of these; I think because by the time the conversion was done they were already well behind his development version.

Bob
Max_admin 21 Apr, 2012
Hi Gabriela,

Your "Multi language" action is the first one inside your event ? it can only translate content before its displayed.

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.