Multi language calendar

Marzyslaw 29 Oct, 2009
Hi,

I started to use ChronoForms and it is powerfull. I searched forums, but I didn't found how to made a multi language calendar. There are mamy posts about this problem, but I must to switch the calendar if I switch the language with Joom!Fish. I tried to put some code into HTML section of form, but it doesn't work.

I tried with this:
    <?php
    $doc = & JFactory::getDocument();

    global $mosConfig_lang;
    if ($mosConfig_lang=='polish'){

    $script = "
    window .addEvent('domready', function() {
      myCal_date_1 = new Calendar({date_1: 'd/m/Y'},
      {
        classes: ['dashboard'],
        months: ['Styczen', 'Luty', 'Marzec', 'Kwiecien', 'Maj', 'Czerwiec', 'Lipiec',
                 'Sierpien', 'Wrzesien', 'PaĆșdziernik', 'Listopad', 'Grudzien']
      });
    });
    ";
    }
    else{

    $script = "
    window .addEvent('domready', function() {
      myCal_date_1 = new Calendar({date_1: 'd-m-Y'},
      {
        classes: ['dashboard']
      });
    });
    ";

    }
    $doc->addScriptDeclaration($script);
    ?>


I think the problem is in $mosConfig_lang=='polish' statement. Who knows how to check current language?

Sorry if my english is not very well.

Marzyslaw
GreyHead 29 Oct, 2009
Hi Marzyslaw,

$lang =& JFactory::getLanguage();
$LangTag = $lang->getTag();

Bob
Marzyslaw 29 Oct, 2009
Thank you Bob!

But I don't know in which part of my code I should put lines you mentioned. Or my code is not correct.

Marzyslaw
GreyHead 29 Oct, 2009
Hi Maryszlaw,

$lang->getTag() will give you the language tag like en-GB or pl-PL; $lang->getName() will give you the name but the Tag is the better code to use.

Bob
Marzyslaw 29 Oct, 2009
Thank you Bob!

I tried and it's working very good

Marzyslaw
Marzyslaw 29 Oct, 2009
Hi Bob!

I've one more question. When I started to use the mentioned code I've a problem with Multi Language PlugIn. It seems like it not working. Why? Should I translate whole form in HTML window?
GreyHead 29 Oct, 2009
Hi Maryszlaw,

It shouldn't have any effect on the Plugin, they both use the same code but I can't see why that would be a problem :-(

I don't have time to look now, added to the 'to-do' list.

Bob
Marzyslaw 29 Oct, 2009
Hi Bob!

Sorry, it's my fault. đŸ˜¶
I don't know how, but I'd Plugin not activated. I must do it when I experimented with my form and I must forgot that.

So thank you for your help.
This topic is locked and no more replies can be posted.