wp_localize_script and translations inside dont work
-
My theme is using wp_localize_script for diplsaying some strings in js, but translatepress doesnt seem to work and has wp_localize_script isnide blacklisted functions. This is the code:
$localize_array = array( 'ajax_url' => $ajax_url, 'payout_not_valid_email_msg' => esc_html__('The email address is not valid. Please add a valid email address.', 'listeo_core'), 'is_rtl' => is_rtl() ? 1 : 0, 'lang' => defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : '', // WPML workaround until this is standardized 'price_min' => $_price_min, '_price_max' => $_price_max, 'currency' => get_option( 'listeo_currency' ), 'currency_position' => get_option( 'listeo_currency_postion' ), 'currency_symbol' => esc_attr($currency_symbol), 'submitCenterPoint' => get_option( 'listeo_submit_center_point','52.2296756,21.012228700000037' ), 'centerPoint' => get_option( 'listeo_map_center_point','52.2296756,21.012228700000037' ), 'country' => get_option( 'listeo_maps_limit_country' ), 'upload' => admin_url( 'admin-ajax.php?action=handle_dropped_media' ), 'delete' => admin_url( 'admin-ajax.php?action=handle_delete_media' ), 'color' => get_option('pp_main_color','#274abb' ), 'dictDefaultMessage' => esc_html_("Drop files here to upload","listeo_core"), 'dictFallbackMessage' => esc_html__("Your browser does not support drag'n'drop file uploads.","listeo_core"), 'dictFallbackText' => esc_html__("Please use the fallback form below to upload your files like in the olden days.","listeo_core"), 'dictFileTooBig' => esc_html__("File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.","listeo_core"), 'dictInvalidFileType' => esc_html__("You can't upload files of this type.","listeo_core"), 'dictResponseError' => esc_html__("Server responded with {{statusCode}} code.","listeo_core"), 'dictCancelUpload' => esc_html__("Cancel upload","listeo_core"), 'dictCancelUploadConfirmation' => esc_html__("Are you sure you want to cancel this upload?","listeo_core"), 'dictRemoveFile' => esc_html__("Remove file","listeo_core"), 'dictMaxFilesExceeded' => esc_html__("You can not upload any more files.","listeo_core"), 'areyousure' => esc_html__("Are you sure?","listeo_core"), 'maxFiles' => get_option('listeo_max_files',10), 'maxFilesize' => get_option('listeo_max_filesize',2), 'clockformat' => (get_option('listeo_clock_format','12') == '24') ? true : false, 'prompt_price' => esc_html__('Set price for this date','listeo_core'), 'menu_price' => esc_html__('Price (optional)','listeo_core'), 'menu_desc' => esc_html__('Description','listeo_core'), 'menu_title' => esc_html__('Title','listeo_core'), "applyLabel" => esc_html__( "Apply",'listeo_core'), "cancelLabel" => esc_html__( "Cancel",'listeo_core'), "clearLabel" => esc_html__( "Clear",'listeo_core'), "fromLabel" => esc_html__( "From",'listeo_core'), "toLabel" => esc_html__( "To",'listeo_core'), "customRangeLabel" => esc_html__( "Custom",'listeo_core'), "mmenuTitle" => esc_html__( "Menu",'listeo_core'), "pricingTooltip" => esc_html__( "Click to make this item bookable in booking widget",'listeo_core'), "today" => esc_html__( "Today",'listeo_core'), "tomorrow" => esc_html__( "Tomorrow",'listeo_core'), "next_7_days" => esc_html__( "Next 7 days",'listeo_core'), "yesterday" => esc_html__( "Yesterday",'listeo_core'), "last_7_days" => esc_html__( "Last 7 Days",'listeo_core'), "last_30_days" => esc_html__( "Last 30 Days",'listeo_core'), "this_month" => esc_html__( "This Month",'listeo_core'), "last_month" => esc_html__( "Last Month",'listeo_core'), "map_provider" => get_option('listeo_map_provider','osm'), "address_provider" => get_option('listeo_map_address_provider','osm'), "maps_reviews_text" => esc_html__('reviews','listeo_core'), "maps_noreviews_text" => esc_html__('Not rated yet','listeo_core'), "category_title" => esc_html__('Category Title','listeo_core'), "day_short_su" => esc_html_x("Su", 'Short for Sunday', 'listeo_core'), "day_short_mo" => esc_html_x("Mo", 'Short for Monday','listeo_core'), "day_short_tu" => esc_html_x("Tu", 'Short for Tuesday','listeo_core'), "day_short_we" => esc_html_x("We", 'Short for Wednesday','listeo_core'), "day_short_th" => esc_html_x("Th", 'Short for Thursday','listeo_core'), "day_short_fr" => esc_html_x("Fr", 'Short for Friday','listeo_core'), "day_short_sa" => esc_html_x("Sa", 'Short for Saturday','listeo_core'), "radius_state" => get_option('listeo_radius_state'), "maps_autofit" => get_option('listeo_map_autofit','on'), "maps_autolocate" => get_option('listeo_map_autolocate'), "maps_zoom" => (!empty(get_option('listeo_map_zoom_global'))) ? get_option('listeo_map_zoom_global') : 9, "maps_single_zoom" => (!empty(get_option('listeo_map_zoom_single'))) ? get_option('listeo_map_zoom_single') : 9, "autologin" => get_option('listeo_autologin'), "no_results_text" => esc_html__('No results match','listeo_core'), "no_results_found_text" => esc_html__('No results found','listeo_core'), "placeholder_text_single" => esc_html__('Select an Option','listeo_core'), "placeholder_text_multiple" => esc_html__('Select Some Options ','listeo_core'), "january" => esc_html__("January",'listeo_core'), "february" => esc_html__("February",'listeo_core'), "march" => esc_html__("March",'listeo_core'), "april" => esc_html__("April",'listeo_core'), "may" => esc_html__("May",'listeo_core'), "june" => esc_html__("June",'listeo_core'), "july" => esc_html__("July",'listeo_core'), "august" => esc_html__("August",'listeo_core'), "september" => esc_html__("September",'listeo_core'), "october" => esc_html__("October",'listeo_core'), "november" => esc_html__("November",'listeo_core'), "december" => esc_html__("December",'listeo_core'), "opening_time" => esc_html__("Opening Time",'listeo_core'), "closing_time" => esc_html__("Closing Time",'listeo_core'), "remove" => esc_html__("Remove",'listeo_core'), "onetimefee" => esc_html__("One time fee",'listeo_core'), "multiguest" => esc_html__("Multiply by guests",'listeo_core'), "quantitybuttons" => esc_html__("Quantity Buttons",'listeo_core'), "booked_dates" => esc_html__("Those dates are already booked",'listeo_core'), "replied" => esc_html__("Replied",'listeo_core'), "recaptcha_status" => $recaptcha_status, "recaptcha_version" => $recaptcha_version, "recaptcha_sitekey3" => trim($recaptcha_sitekey3) ); wp_localize_script( $this->_token . '-frontend', 'listeo_core', $localize_array);
what can i do to print the translations correctly?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘wp_localize_script and translations inside dont work’ is closed to new replies.