Support » Plugin: WP FullCalendar » Addition of Chinese new hook to add params to ajaxurl

  • Hi,

    thanks for the plugin, it is awesome!!!

    I have added Mandarin language for Mainland China, I hope you can add it to your code:

    $calendar_languages = array(
    //extra WP FUllCalendar translations here please:
    $wp_fullcalendar_languages = array(
    	'zh_CN' => array('buttonText' => array('today'=>'今天','month'=>'月','week'=>'周','day'=>'日'))

    Right now there is an issue though. My website is bilingual English / Chinese, using qTranslate. Right now the content in the calendar is always brought in English, because the admin-ajax.php call to bring all the Events does not carry with it the language information, so on the server it always retrieves back the default language. But by adding a param “lang” then it is alright. So I have modified your code adding a hook to add this param, I hope you can also add it to the code:

    function localize_script(){
    	$js_vars = array();
    	$js_vars['ajaxurl'] = apply_filters('wpfc_admin_url', admin_url('admin-ajax.php'));

    Then in my website I implement that filter:

    add_filter('wpfc_admin_url', function($url) {
    	if (function_exists('qtrans_getLanguage')) {
    		return add_query_arg('lang', qtrans_getLanguage(), $url);
    	return $url;

    This will make the ajaxurl be wp-admin/admin-ajax.php url become wp-admin/admin-ajax.php?lang=zh, then the content is brought in Chinese


  • The topic ‘Addition of Chinese new hook to add params to ajaxurl’ is closed to new replies.