Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for better translations #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 25 additions & 18 deletions acf-image-crop-v5.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ function __construct() {
*/

$this->l10n = array(
'error' => __('Error! Please enter a higher value', 'acf-image_crop'),
'width_should_be' => __( 'Width should be at least: ','acf-image_crop' ),
'height_should_be' => __( 'Height should be at least: ','acf-image_crop' ),
'selected_width' => __( 'Selected image width: ','acf-image_crop' ),
'selected_height' => __( 'Selected image height: ','acf-image_crop' ),
'size_warning' => __( 'Warning: The selected image is smaller than the required size!','acf-image_crop' ),
);


Expand Down Expand Up @@ -153,7 +157,8 @@ function render_field_settings( $field ) {
'instructions' => __('Leave blank for no restriction (does not work with hard crop option)','acf-image_crop'),
'type' => 'number',
'name' => 'width',
'class' => 'custom-target-width custom-target-dimension'
'class' => 'custom-target-width custom-target-dimension',
'append' => 'px'
));

// height - conditional: target_size == 'custom'
Expand All @@ -162,15 +167,17 @@ function render_field_settings( $field ) {
'instructions' => __('Leave blank for no restriction (does not work with hard crop option)','acf-image_crop'),
'type' => 'number',
'name' => 'height',
'class' => 'custom-target-height custom-target-dimension'
'class' => 'custom-target-height custom-target-dimension',
'append' => 'px'
));

// preview_size
acf_render_field_setting( $field, array(
'label' => __('Preview size','acf-image_crop'),
'instructions' => __('Select the preview size for this field','acf-image_crop'),
'type' => 'select',
'label' => __('Preview Size','acf'),
'instructions' => __('Shown when entering data','acf'),
'type' => 'radio',
'name' => 'preview_size',
'layout' => 'horizontal',
'choices' => acf_get_image_sizes()
));

Expand All @@ -181,7 +188,7 @@ function render_field_settings( $field ) {
'type' => 'radio',
'layout' => 'horizontal',
'name' => 'force_crop',
'choices' => array('yes' => 'Yes', 'no' => 'No')
'choices' => array('yes' => __('Yes', 'acf'), 'no' => __('No', 'acf'))
));

// save_in_media_library
Expand All @@ -192,22 +199,22 @@ function render_field_settings( $field ) {
'layout' => 'horizontal',
'name' => 'save_in_media_library',
'class' => 'save-in-media-library-select',
'choices' => array('yes' => 'Yes', 'no' => 'No')
'choices' => array('yes' => __('Yes', 'acf'), 'no' => __('No', 'acf'))
));


// return_format
acf_render_field_setting( $field, array(
'label' => __('Return Value','acf-image_crop'),
'instructions' => __('Specify the returned value on front end','acf-image_crop'),
'label' => __('Return Value','acf'),
'instructions' => __('Specify the returned value on front end','acf'),
'type' => 'radio',
'name' => 'save_format',
'layout' => 'horizontal',
'class' => 'return-value-select',
'choices' => array(
'url' => __("Image URL",'acf'),
'id' => __("Image ID",'acf'),
'object' => __("Image Object",'acf')
'object' => __("Image Array",'acf'),
'url' => __("Image URL",'acf'),
'id' => __("Image ID",'acf')
)
));

Expand Down Expand Up @@ -323,20 +330,20 @@ function render_field( $field ) {
<div class="crop-section">
<div class="crop-stage">
<div class="crop-action">
<h4>Crop the image</h4>
<h4><?php _e('Crop the image','acf-image_crop'); ?></h4>
<?php if ($imageData->original_image ): ?>
<img class="crop-image" src="<?php echo $imageData->original_image_url ?>" data-width="<?php echo $imageData->original_image_width ?>" data-height="<?php echo $imageData->original_image_height ?>" alt="">
<?php endif ?>
</div>
<div class="crop-preview">
<h4>Preview</h4>
<h4><?php _e('Preview','acf-image_crop'); ?></h4>
<div class="preview"></div>
<div class="crop-controls">
<a href="#" class="button button-large cancel-crop-button">Cancel</a> <a href="#" class="button button-large button-primary perform-crop-button">Crop!</a>
<a href="#" class="button button-large cancel-crop-button"><?php _e('Cancel','acf-image_crop'); ?></a> <a href="#" class="button button-large button-primary perform-crop-button"><?php _e('Crop!','acf-image_crop'); ?></a>
</div>
</div>
</div>
<a href="#" class="button button-large init-crop-button">Crop</a>
<a href="#" class="button button-large init-crop-button"><?php _e('Crop','acf-image_crop'); ?></a>
</div>
</div>
<div class="view hide-if-value">
Expand Down Expand Up @@ -1102,4 +1109,4 @@ function delete_field( $field ) {
// create field
new acf_field_image_crop();

?>
?>