diff --git a/fields/class-cmb-file-field.php b/fields/class-cmb-file-field.php index 929f2e3b..9a3b60a5 100644 --- a/fields/class-cmb-file-field.php +++ b/fields/class-cmb-file-field.php @@ -29,6 +29,7 @@ public function default_args() { 'text', 'application', ), + 'string-select-file' => esc_html__( 'Select File', 'cmb' ), ) ); } @@ -48,6 +49,12 @@ function enqueue_scripts() { wp_enqueue_media( array( 'post' => $post_ID ) ); wp_enqueue_script( 'cmb-file-upload', trailingslashit( CMB_URL ) . 'js/file-upload.js', array( 'jquery', 'cmb-scripts' ), CMB_VERSION ); + wp_localize_script( 'cmb-file-upload', 'CMBFile', array( + 'strings' => array( + 'selectFile' => $this->args['string-select-file'], + ), + ) ); + } /** diff --git a/fields/class-cmb-image-field.php b/fields/class-cmb-image-field.php index 66ccfc60..4efeced2 100644 --- a/fields/class-cmb-image-field.php +++ b/fields/class-cmb-image-field.php @@ -26,6 +26,7 @@ public function default_args() { 'image', ), 'show_size' => false, + 'string-select-file' => esc_html__( 'Select Image', 'cmb' ), ) ); } diff --git a/js/file-upload.js b/js/file-upload.js index 14a81881..d0729b41 100644 --- a/js/file-upload.js +++ b/js/file-upload.js @@ -9,7 +9,7 @@ jQuery( document ).ready( function() { var frameArgs = { multiple: false, - title: 'Select File', + title: CMBFile.strings.selectFile }; library = container.attr( 'data-type' ).split( ',' );