Forum Support

Shape 5
May 11, 2021, 08:21:28 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Shape 5 Forum
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: S5 Quick Contact - Display the Calendar in a different Language  (Read 661 times)
lcmp
Jr. Member
**
Offline Offline

Posts: 9



« on: February 06, 2017, 09:16:12 AM »

I am not a programmer but I know my way around Joomla and PHP enough to have found a solution to display the calendars in quick contact in at least 2 different languages.

It may help somebody in the future who?s looking to display the calendars in different languages.

Take note. This simple solution will allow the user to select a date on the calendar in their native language but, when a selection is made, the post to the form will revert to English. But at least you allowed you user to make the selection in their native language.


You will need to modify the following files:

joomla_root/modules/mod_s5_quick_contact/tmpl/default.php

joomla_root/modules/mod_s5_quick_contact/s5_quick_contact/pikaday.js


1. First make a copy / backup of these 2 files just in case something goes wrong.

2. Make 2 more copies of the pikaday.js file and leave them in the same folder along with the original.

Rename 1 copy of this file to:


pikaday_en.js


( for english )

Rename the other copy of the file to:


pikaday_es.js

( I needed the calendar in spanish hence the: _es in the file name. You can rename your files to whatever you wish but adding the lang specific prefix helps to keep everything in order.  eg, for french you coud rename to pikladay_fr.js )

3. Now open your:

pikaday_es.js

Go to line 241. it reads:

i18n: {

Below this line you will see the words to be translated.

i.e:


previousMonth : 'Previous Month',


For spanish you would change this line to


previousMonth : 'Mes Anterior',

Translate all the days, months, abbreviations etc. to the desired language.

Save the file and close.

4. Now go to:

joomla_root/modules/mod_s5_quick_contact/tmpl/

and open:

default.php

remember to make a backup of this file as well just in case you make a mistake when you alter the original code.


Go to line 195. it reads like this:


Code:

$doc->addCustomTag('<script src="'.$s5_qc_url.'s5_quick_contact/pikaday.js" type="text/javascript"></script>');



Replace that line with:


Code:

$lang = JFactory::getLanguage();
if ($lang->getTag() == 'en-GB') {
  $doc->addCustomTag('<script src="'.$s5_qc_url.'s5_quick_contact/pikaday_en.js" type="text/javascript"></script>');
}

$lang = JFactory::getLanguage();
if ($lang->getTag() == 'es-ES') {
  $doc->addCustomTag('<script src="'.$s5_qc_url.'s5_quick_contact/pikaday_es.js" type="text/javascript"></script>');
}



The first string of code defines what js file to look for when the site language is English.

The second string of code defines what js file to look for when the site language is Spanish. Replace the variables in the second string of code to your specific language and remember to replace the file names to whatever names you used in step 2.

Clear your browser cache, reload your site and you should have the calendar displaying different languages automatically depending on the user selected language.

I repeat:

This is a simple / humble solution to let the user be able to make a selection from the calendar in their native language. After the user makes the selection, the calendar posts the calendar selection to the form in English.

I?m not a programmer so please don?t ask me for custom PHP code. I played around with the code and googled a little bit for joomla specific language code and was lucky enough to get it to work.
enjoy,



Logged
mikek
Administrator
*****
Offline Offline

Posts: 28743



WWW
« Reply #1 on: February 07, 2017, 08:02:19 AM »

Great! Thanks for posting this, I'm sure others will find it helpful!
Logged

Mike Knott
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
jeisson222
Jr. Member
**
Offline Offline

Posts: 6



« Reply #2 on: June 26, 2017, 09:25:15 PM »

Hola gracias por el aporte, hice lo que dices pero cuando se hace la seleccion del la fecha en mi caso la traduccion a espa?ol, la fecha seleccionada queda en ingles y no logro encontrar la traduccion.
http://hoteltierradeoro.com/web/index.php/habitaciones
Logged
mikek
Administrator
*****
Offline Offline

Posts: 28743



WWW
« Reply #3 on: June 27, 2017, 07:17:39 AM »

Hello,

Please post your questions in English.
Logged

Mike Knott
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
jeisson222
Jr. Member
**
Offline Offline

Posts: 6



« Reply #4 on: June 27, 2017, 08:41:04 PM »

I leave an image
Logged
mikek
Administrator
*****
Offline Offline

Posts: 28743



WWW
« Reply #5 on: June 28, 2017, 07:26:37 AM »

Hello,

That is controlled by default javascript functions, and not something the module can control very well. There are some instructions here for modifying it so that it shows just numbers and no text. Anything beyond that though is not possible with the current script.

https://www.shape5.com/component/option,com_smf/Itemid,75/topic,42553.0/
Logged

Mike Knott
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Looking for the largest variety in template designs? Look no more. Never buy 1 theme again. Signups start at just $89 for access to all of our themes.
Send Us An Email
Please send us your questions and we will email you back as soon as we can. Product support questions should be posted in our support forums under the Help menu. Our staff will assist you from there.