WordPress.org

Forums

WP FullCalendar
How to translate days and months in the calendar ? (16 posts)

  1. pitou
    Member
    Posted 2 years ago #

    Thank you for the quick update! Super!
    How can I translate the days and months that display in the calendar? Which file I need to edit ? In version 0.7 I changed main.js, but in version 0.8 does not work anymore.

    http://wordpress.org/extend/plugins/wp-fullcalendar/

  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    see wp-fullcalendar.php around lines 86-129

    if you can tell me what's not being translated (And language) maybe we can look into it for future updates

  3. mustermann
    Member
    Posted 2 years ago #

    Hallo Marcus,
    please have a look at "main.js". There you can find all months, days of the week in long and short-code in english language.

    Ich have translated the content in file main.js with "..." in German Language. Here you will find the result:
    http://oldtimer-veranstaltung.de/kalender/veranstaltungen/kalender/

    The bug "p" and "a" for output "." is in the file main.js for showing events in the calendar since the last version of WP plug-in wp-fullcalendar.

  4. pitou
    Member
    Posted 2 years ago #

    Hello Marcus,
    Look here: the names of days and months are not translated (in french for me), but the words Today, Month and Week are ok.
    On the other hand I noted a small translation error in wpfullcalendar.php: week = in french semaine and not semane.

  5. Christian
    Member
    Posted 2 years ago #

    Hello,

    I found some bugs for french languages or other, and I add some french translations.

    Here the code

    $wp_fullcalendar_languages = array(
    			'es' => array('buttonText' => array('today'=>'hoy','month'=>'mes','week'=>'semana','day'=>'dia')),
    			'pt' => array('buttonText' => array('today'=>'hoje','month'=>'mes','week'=>'semana','day'=>'dia')),
    			'fr' => array('buttonText' => array('today'=>'aujourd\'hui','month'=>'mois','week'=>'semaine','day'=>'jour'),
    						  'titleFormat'=> array('month'=>'MMMM yyyy','week'=>'\'Du\' d[ MMMM][ yyyy] \'au\' {d MMMM[ yyyy]}','day'=>'dddd d MMMM yyyy'),
    						  'columnFormat'=> array('month'=>'ddd','week'=>'ddd d/M','day'=>'dddd d MMMM yyyy'))
    		);
    		$calendar_languages = array_merge($calendar_languages, $wp_fullcalendar_languages);

    I add titleFormat or columnFormat for the french language.
    But there is a bug just after : you use array_merge, but if two or more array elements have the same key, the last one overrides the others. So we lost the first part of the french translation....

    I also fixed "semaine" instead of "semane"

    Just after there is another bug. It should be $js_vars instead of $jsvars.

    if( array_key_exists($locale_code, $calendar_languages) ){
    		    $js_vars['wpfc_locale'] = $calendar_languages[$locale_code];

    Christian

  6. Christian
    Member
    Posted 2 years ago #

    This fixes the bug

    $wp_fullcalendar_languages = array(
    			'es' => array('buttonText' => array('today'=>'hoy','month'=>'mes','week'=>'semana','day'=>'dia')),
    			'pt' => array('buttonText' => array('today'=>'hoje','month'=>'mes','week'=>'semana','day'=>'dia')),
    			'fr' => array('buttonText' => array('today'=>'aujourd\'hui','month'=>'mois','week'=>'semaine','day'=>'jour'),
    						  'titleFormat'=> array('month'=>'MMMM yyyy','week'=>'\'Du\' d[ MMMM][ yyyy] \'au\' {d MMMM[ yyyy]}','day'=>'dddd d MMMM yyyy'),
    						  'columnFormat'=> array('month'=>'ddd','week'=>'ddd d/M','day'=>'dddd d MMMM yyyy'))
    		);
    		$calendar_languages = array_merge_recursive($calendar_languages, $wp_fullcalendar_languages);

    See it online : http://www.gf38.fr/evenements/

  7. pitou
    Member
    Posted 2 years ago #

    Salut Christian,
    Merci de cette réponse détaillée, en french en plus. J'ai apporté les modifs que tu indiques et mon problème est résolu. Merci beaucoup !
    J'ai cliqué sur le lien qui mène au Grenoble Foot 38 : super, look vraiment très pro, bravo. Mais je ne comprends pas une chose : sur ton calendrier, je vois que les jours de la semaine sont toujours en anglais. Donc le problème est le même que celui que j'ai décrit plus haut. Ou est-ce que j'ai loupé qqch ?

  8. Christian
    Member
    Posted 2 years ago #

    merci pour les compliments.

    As I was logged as admin I had no cache so I saw the right site and but it was not your case. I emptied the cache now and all is fine.

  9. estepix
    Member
    Posted 2 years ago #

    Hello everyone,

    I have been checking the new translation capabilities for the JS part of the plugin and there's a problem merging translations from Events Manager 5.2+ (around lines 86-123) and "extra" translations (around lines 124-130).

    The problem is that when array_merge finds a a key in $wp_fullcalendar_languages that already existed in $calendar_languages, it doesn't merge the values, instead the keys from the latest array substitute those from the first one, i.e., for 'es', 'pt', 'fr' and 'de' the only translations we see are those corresponding to "buttonText".

    I have changed the line:
    $calendar_languages = array_merge($calendar_languages, $wp_fullcalendar_languages);
    to
    $calendar_languages = $calendar_languages + $wp_fullcalendar_languages;

    And the content gets translated properly. @Marcus if you think this fix will do, could you please add it to the following release?

    Also, this is a big step forward towards localising the plugin, so many thanks for your hard work!!!! However I miss a filter which would allow us to modify $wp_fullcalendar_languages or even extract the text to the pot file so we can translate the strings the normal way.

  10. estepix
    Member
    Posted 2 years ago #

    sorry the fixed I proposed does not work either, actually it works the other way around, the keys from the first array are maintained, those from the second discarded

  11. estepix
    Member
    Posted 2 years ago #

    I think I got it right now, changing the line:
    $calendar_languages = array_merge($calendar_languages, $wp_fullcalendar_languages);
    to
    $calendar_languages = array_merge_recursive($calendar_languages, $wp_fullcalendar_languages);

    seems to do the trick. The array is merged along with its child keys contents.

  12. Christian
    Member
    Posted 2 years ago #

    the solution I've posted some line before ;)

  13. estepix
    Member
    Posted 2 years ago #

    that's right @Christian! sorry I didn't read the thread carefully and thought that yours was a French only problem. It would have saved me quite a bit of time

    All credit is yours!!! ;)

  14. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    thanks for the input guys, and props to @Christian

    @mustermann I'm not entirely sure what you meant, could you rephrase? maybe the solutions posted after fix your issue as it's for all languages

  15. mustermann
    Member
    Posted 2 years ago #

    Marcus, if I need a translation months, days and other form english language to German Language I must put the translation in your code from wp full calendar. I must put it after every new version from you.

    Thanks for help.

  16. Jan-Erik
    Member
    Posted 2 years ago #

    Marcus,

    Please add the following Finnish translations to:
    wp-content/plugins/wp-fullcalendar/wp-fullcalendar.php

    'fi'=>array('closeText'=>'Sulje','prevText'=>'<Edel','nextText'=>'Seur>','currentText'=>'Tänään','monthNames'=>array('Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kesäkuu','Heinäkuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'),'monthNamesShort'=>array('Tammi','Helmi','Maalis','Huhti','Touko','Kesä','Heinä','Elo','Syys','Loka','Marras','Joulu'),'dayNames'=>array('Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'),'dayNamesShort'=>array('Su','Ma','Ti','Ke','To','Pe','La'),'dayNamesMin'=>array('Su','Ma','Ti','Ke','To','Pe','La'),'weekHeader'=>'Sm','dateFormat'=>'dd/mm/yy','firstDay'=>1,'isRTL'=>false,'showMonthAfterYear'=>false,'yearSuffix'=>''),

    and

    'fi' => array('buttonText' => array('today'=>'Tänään','month'=>'Kuukausi','week'=>'Viikko','day'=>'Päivä')),

    Yours,

    Jan-Erik

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP FullCalendar
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.