Forums

2 questions

dandez 29 Aug, 2011
Hello I believe the multilanguage plugin works fine, I have a problem with translating form messages though.

For instance whe the wrong data is entered I get the message like:
this field is required
or
Please select one of the options.

I need to translate them to polish. How to do it?


Another question is: Can I resize the text in particular elements of the form. For example in few lines I'd like to have a font a bit smaller. Is there any chance to format the text with wysiwig editor or something?

Warmest Regards
Dan
GreyHead 30 Aug, 2011
Hi dandez,

If you need just Polish for your messages you can set the language in the Form JavaScript tab (click the Name Link in the Forms Manager to get to it).

Or you can use this snippet that Max posted recently to change the language - it can be adapted to recognise the current user language:
<?php
//line below will switch the validation language to french, regardless of which language is selected in the form edit page
$form->form_params->set('jsvalidation_lang', 'fr');
?>


Or you can use my Show HTML [GH] which will automatically pick up the current user language; check if there is a validation file for that language and show the English file if the specific language file doesn't exist.

The code from my action is:
		$short_tag = $form->form_params->get('jsvalidation_lang', '');
		if ( !$short_tag ) {
			$lang =& JFactory::getLanguage();
			$tag = $lang->getTag();
			$dtag = $lang->getDefault();
			if ( !$tag ) {
				$tag = $dtag;
			}
			$short_tag = strstr($tag, '-', true);
		}
		jimport('joomla.filesystem.file');
		$lang_path = $this->front_path.'js'.DS.'formcheck'.DS.'lang'.DS;
		if ( !JFile::exists($lang_path.$short_tag.'.js') ) {
			$short_tag = 'en';
		}
		$script = $this->front_url.'/js/formcheck/lang/'.$short_tag.'.js';
		$document->addScript($script);
This topic is locked and no more replies can be posted.