Multi-language plugin updated

GreyHead 07 Sep, 2009
Hi all,

I've attached an updated version of the multi-language plugin. This should work with the current release and most of the other recent releases (it uses a Plugin helper that was introduced a few months ago).

To install the updated plugin, download and unzip the attachment and FTP the cf_multi_language.php file to your components/com_chronocontact/plugins folder. It should work with any existing multi-language configurations but back-up to be safe!

The main changes are:[list]
  • Uses the Plugin helper and has the same look and feel as more recent plugins
  • Shows the language tags alongside the textarea inputs (only after the plugin has been saved)
  • Split the ten textareas into two tabs
  • Added a help tab - see the text below
  • This version now checks the ChronoForms error messages and so will, for example, show multi-language Imageverification error messages.
  • [/list]

    You can see a development version of this plugin working here Note: this is a live site so please don't make valid posts. You can see all the features by changing the language using the flag icons at the top right, or submitting the form with an invalid anti-spam code.

    Please treat this release as a beta and report any bugs you find here.


    Thanks
    Bob

    How to use the Multi Language plugin
    The plugin allows you to create multi-language forms in ChronoForms.
    The plugin works by checking the current language from the Joomla settings and then replacing 'key phrases' in the form html with the equivalent you have defined for that language.

    * In the Settings tab enter a list of the languages that you want to support using the 'country code'-'region code' format: en-GB, fr-FR
    * Enter one of these language codes as the default value to be used if there isn't a definition for a language in use.
    * On the second and third tabs are a series of text areas in which you can enter your language translations. Note that after the plugin is saved language tags will show up by the corresponding box names.
    * In each box enter each of the 'key phrases' and the language equivalents e.g. in en-GB: 'Required field=This field is required'; in fr-FR: 'Requred field=Ce champ est obligatoire'; and in nl-NL: Requred field=Dit veld is verplicht'.
    * Notice that each entry takes the form Key phrase=Translated expression. Don't leave spaces around the '=' and don't add quotes around either part of the entry.
    * Start each new 'key phrase' on a new line.
    * In your form html make sure that the 'key phrase' is entered in exactly the same way as in the plugin e.g. <input . . . title='Required field' . . . />

    Note that you can use Key phrases for any text in your for html.

    * For label text.
    * For title entries to show validation error messages.
    * For image names to show language specific images e.g 'Submit_image=submit_img_fr.jpg'
    * For short body text - remember that the entry has to go onto a single line in the text area.

    This version of the multi-language plugin will also translate ChronoForms errors so it can be used, for example, with the AntiSpam error message.

    tisch.david 28 Sep, 2009
    Hi GreyHead,

    here is a small patch for your plug-in modification, because it fails when only 2 languages are defined:
    (in cf_multi_language.php at line 74)
    $input = $helper->createTextareaTD('Language Strings'.(!empty($tags[($i-1)]) ? ': '.$tags[($i-1)] : ''),
    		$extra, $row->$extra, $attribs['textarea'], $tooltip );
    


    Best regards
    Tisch Dávid
    GreyHead 28 Sep, 2009
    Hi tisch.david,

    Thank you, updated version attached.

    Bob

    Later: bugfixed version attached
    Hubler 01 Oct, 2009
    Hi Greyhead,
    first thank you for this great component.
    I try to manage the multi-language plugin.
    I would say I'm not wrong but....it does not work.
    Mu default language is fr-FR.
    I join a screen capture for better appreciation of how I do it.
    Thank you again for help.
    Roy
    GreyHead 01 Oct, 2009
    Hi Roy,

    . . . and the problem is . . . ? What exactly? Sorry, but telling me it 'doesn't work' is next to useless.

    My guess, from zero information, is that you haven't enabled it in the Form Plugins tab.

    Bob
    tisch.david 02 Oct, 2009
    Hi GreyHead,

    in lines 75 and 76 two "]" are missing, but in line 78 it is unnecessary. The syntactically correct code snippet is:

    
    if ( !empty($tags[($i-1)]) ) {
      $tag_name =  $tags[($i-1)];
    }
    $input = $helper->createTextareaTD('Language Strings: '.$tag_name, $extra,
        $row->$extra,
        $attribs['textarea'], $tooltip );
    

    Best regards
    David
    GreyHead 02 Oct, 2009
    Hi David,

    Sorry I'd fixed that on my version but forgot to update the attachment here. I've updated the attachment to my previous post.

    Bob
    Beata 03 Nov, 2009

    Hi tisch.david,
    Thank you, updated version attached.
    Bob
    Later: bugfixed version attached



    This isn't possible to install: Error! Could not find an XML setup file in the package.
    GreyHead 03 Nov, 2009
    Hi Beata,

    Unzip and copy the cf_multi_language.php file to the ChronoForms plugins folder.

    Bob
    Beata 03 Nov, 2009
    It's has been ovewrited ???

    And what to do now? Your tutorial about multilange translation didn't help, because I have Language manager and all languages with Joomfish.

    Or maybe I didn't suceeded because plugin wasn't installed?
    emilio67 04 Nov, 2009
    Beata is right..
    the translation of the field doesn't work in chronoforms embedded as plugin into an article.
    The easiest way to do this is creating a different form for each language (just cloning each one and editing)and than embedding the plugin, with the help of joomfish, linking it to the corresponding form for each language

    for example:

    {chronocontact}form_en{/chronocontact}
    {chronocontact}form_fr{/chronocontact}
    {chronocontact}form_es{/chronocontact}

    easy....
    Beata 04 Nov, 2009
    Hi Emilio,

    Please in details, how to do this?

    I imagine to copy my form and translate into english, german and rusian, than to do links from meniu

    And what you say about these codes, where to put them:

    {chronocontact}form_en{/chronocontact}
    {chronocontact}form_fr{/chronocontact}
    {chronocontact}form_es{/chronocontact}


    But Bob said that it isn't good.......
    And how to get translation ????
    emilio67 04 Nov, 2009
    Hi Beata

    it's easy
    you copy each line of code in the joomfish content translation, one for each language.
    Just change the form name to yours.
    Go to joomfish -> translations -> choose the language you want to translate and content in the drop downs -> paste the line of code for the plugin relative to the form translated in the respective language et voilá...
    Beata 05 Nov, 2009
    I made a copy of form uzsakymas_en in chronoforms, translated it and have new address of english form
    But I can't to put a link in menu for translating menu use original link

    What you wrote:

    in Joomfish there isn't forms and I can't make translation there
    val 17 Nov, 2009
    I found an easy way to implement chronoforms within Joomfish... I hope this helps those who are lsot but I tried following the thread and I got lost. I ended it figuring it out. So this is step by step of how I came to implement Chronoforms into Joomfish.

    * You can copy the original form that you made in chronoforms and change the title, one easy way is for instance; ContactUs -> ContactUs-fr.
    * Change the text to correspond with the language you want the form to be, so for instance "name -> nom". This can be done in the form code tab, under the HTML coding. (but that is if you don't make a completely new form)

    * Once you have made your new forms in the language(s) you want, you go to Joomfish translation menu.

    * In the language drop down menu, select the language you need to translate for.

    * In the drop down menu for content elements, find where the your button for the language selection is; for instance mine was under 'Menus'

    * Select the form name where the form is placed within your website; for instance "contact"

    * There will be an original side and a translation side. On the translation side that is where you will put your new form name for the language you want to have there. For instance "ContactUs-fr"


    Just thought that this may help those who are getting confused.
    Beata 18 Nov, 2009
    How you find chronoforms in Joomfish? It isn't there at all. What Content elements you choose ?????
    Don't you mind that I need chronoforms for contact form. Contact form there is in Joomla itself, no need chronoforms.

    I use special form for booking of apartments and chronoforms don't appear in Joomfish.
    chagedorn 04 Feb, 2010
    Hello there,

    I tested the plugin and it works great with all text i put in the box
    "FormCode -> Form HTML".
    But it does not work for "FormCode -> OnSubmitCode - before/after sending email".
    Is it not implemented or am i doing something wrong?

    Btw:
    Is there any chance that there will be a native support of chronoform with Joomfish?
    GreyHead 04 Feb, 2010
    Hi changedorn,

    I don't think those boxes are supported. You can use a simple if statement to switch between languages, or redirect to a Joomfish linked article.

    I don't know if Max has any plans to create a version with JoomFish support.

    Bob
    abaddon 23 Nov, 2010
    The plugin works correctly but the error messages remain in the default language. For example my site is italian/english (it is default). When I load the English version of the form the strings are translated but error messages reamin in italian. Why?
    Thanks.
    GreyHead 24 Nov, 2010
    Hi abaddon,

    The plug-in has never supported the original validation error messages. Unfortunately the way it works makes this impossible.

    You can put error messages into title attributes in the inputs e.g.
    <input type='text' title='Областа бара валидна URL' . . . />
    . These will be tranalsted by the plug-in.

    I also recently posted here some hacked validation files for MooTools 1.2 that use standard Joomla! language files to translate the validation error messages.

    Bob
    This topic is locked and no more replies can be posted.