Forums

language

?
Guest 09 Sep, 2011
hi all,

I am using a single language on user side and have set up a range of forms. a range of language strings are being used across forms.

I could use the multi language action for it but that means redefining the same strings over and over again or I could not use language strings at all but plain JTEXT::_('text'). either way however means multiple editing when changing a string.

therefore how can I include a 'regular' language file ?
in other components this is usually being done using something like
  $language =& JFactory::getLanguage();
  $language->load('com_chronoforms');


J1.5.23, CF4 RC2.0
Max_admin 09 Sep, 2011
Hi Gabriela,

Maybe you should simply copy the language strings ?

Or if you decided to use JTEXT::_('text') then you may use the code you mentioned and upload a language file for Chronoforms in the languages directory, I didn't work with languages on J1.5 for a long time and I can't remember what was required exactly to get them working, but you may inspect one of the core Joomla extensions ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 15 Sep, 2011
Hi Gabriela,

A similar approach that I have used is to 'include' a language file into the Form HTML. That way you can use one language file and include it in many forms. A switch on the language name will let you change between different languages.

Bob
?
Guest 06 Oct, 2011
Hi Bob and Max,

I have added to the top of
../components/com_chronoforms/chronoforms.php
amd
../plugins/content/chronoforms.php
JFactory::getLanguage()->load('com_chronoforms');

add to xml:
<languages folder="language">
    <language tag="en-GB">en-GB.com_chronoforms.ini</language>
  </languages>



since I would also like the submit button to be translated the config param input_value will be obsolete:
find in ../administrator/components/com_chronoforms/form_elements/input_submit.ctp:
<input type="button" name="submit_{n}_input_name" id="submit_{n}_input_id" value="<?php echo $element_params['input_value']; ?>" />

and adjust for:
<input type="button" name="submit_{n}_input_name" id="submit_{n}_input_id" value="<?php echo JText::_('SUBMIT'); ?>" />

find:
<input type="hidden" name="chronofield[{n}][input_submit_{n}_input_class]" id="input_submit_{n}_input_class" value="<?php echo $element_params['input_class']; ?>" />

and adjust for:
<input type="hidden" name="chronofield[{n}][input_submit_{n}_input_class]" id="input_submit_{n}_input_class" value="<?php echo JText::_('SUBMIT'); ?>" />

delete:
<?php echo $HtmlHelper->input('input_submit_{n}_input_value_config', array('type' => 'text', 'label' => 'Text', 'class' => 'small_input', 'value' => '')); ?>

find in ../administrator/components/com_chronoforms/form_elements/input_submit.php:
$element_params = array(
	'input_name' => 'input_submit_{n}',
	'input_id' => '',
	'input_class' => '',
	'input_value' => 'Submit');
and adjust for:
$element_params = array(
	'input_name' => 'input_submit_{n}',
	'input_id' => '',
	'input_class' => '');


currently I have 77 rows in my language file. what is working fine is when using <?php echo JTEXT::_('SOMETHING'); ?> for options, label text, show empty (on elements) and in custom code actions. I can however not get the submit button (or the reset / cancel buttons introduced by Bob here: http://chronoengine.com/forums.html?cont=posts&f=26&t=23136) to pick up the language string - language debugging confirms that (everything but the buttons are being translated)

some more observations:
this:
<input type="button" name="submit_{n}_input_name" id="submit_{n}_input_id" value="<?php echo JText::_('SUBMIT'); ?>" />

makes the submit button be displayed on admin side as 'Submit'
pls note that SUBMIT is being displayed as Submit
if I adjust this:
<input type="hidden" name="chronofield[{n}][input_submit_{n}_input_class]" id="input_submit_{n}_input_class" value="<?php echo JText::_('SUBMIT'); ?>" />

for:
<input type="hidden" name="chronofield[{n}][input_submit_{n}_input_class]" id="input_submit_{n}_input_class" value="<?php echo JText::_('SPEICHERN'); ?>" />

( user side is in German/ admin side in English)
that will be displayed as 'SPEICHERN' on user side. To get a regular spelling I would need to use:
<input type="hidden" name="chronofield[{n}][input_submit_{n}_input_class]" id="input_submit_{n}_input_class" value="<?php echo JText::_('Speichern'); ?>" />


do you happen to have an idea why the language file doesn't work for these buttons?
This topic is locked and no more replies can be posted.