Skip to content

Commit

Permalink
Make 'Select File' label translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
barryceelen committed Aug 29, 2016
1 parent 60e052f commit faa7291
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion classes.fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ public function get_default_args() {
return array_merge(
parent::get_default_args(),
array(
'library-type' => array( 'video', 'audio', 'text', 'application' )
'library-type' => array( 'video', 'audio', 'text', 'application' ),
'string-select-file' => esc_html__( 'Select File', 'cmb' ),
)
);
}
Expand All @@ -442,6 +443,11 @@ 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' ) );

wp_localize_script( 'cmb-file-upload', 'CMBFile', array(
'strings' => array(
'selectFile' => $this->args['string-select-file'],
)
) );
}

public function html() {
Expand Down
2 changes: 1 addition & 1 deletion js/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(',');
Expand Down

0 comments on commit faa7291

Please sign in to comment.