Minor refactoring of wp_localize_script