Skip to content

Commit 08a2d88

Browse files
authored
Merge pull request #1017 from cloudinary/fix/unwanted-textdomain-addition
Ensure the 'cloudinary' textdomain is not added automatically
2 parents 6d291d7 + 0958852 commit 08a2d88

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

gruntfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ module.exports = function ( grunt ) {
121121
'!vendor/**/*',
122122
'!package/**/*',
123123
'!php/media/class-filter.php',
124+
'!php/misc/class-image-sizes-no-textdomain.php',
124125
],
125126
},
126127
},

php/class-utils.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Cloudinary;
99

10+
use Cloudinary\Misc\Image_Sizes_No_Textdomain;
1011
use Cloudinary\Settings\Setting;
1112
use Google\Web_Stories\Story_Post_Type;
1213
use WP_Post;
@@ -472,7 +473,7 @@ public static function get_support_link( $args = array() ) {
472473
$plugin->version
473474
)
474475
),
475-
'tf_description' => esc_attr( __( 'Please, provide more details on your request, and if possible, attach a System Report', 'cloudinary' ) ),
476+
'tf_description' => esc_attr( __( 'Please, provide more details on your request, and if possible, attach a System Report', 'cloudinary' ) ),
476477
);
477478

478479
$args = wp_parse_args(
@@ -924,15 +925,7 @@ public static function get_registered_sizes( $attachment_id = null ) {
924925
/** This filter is documented in wp-admin/includes/media.php */
925926
$image_sizes = apply_filters(
926927
'image_size_names_choose',
927-
array(
928-
// phpcs:disable WordPress.WP.I18n.MissingArgDomain
929-
'thumbnail' => __( 'Thumbnail' ),
930-
'medium' => __( 'Medium' ),
931-
'medium_large' => __( 'Medium Large' ),
932-
'large' => __( 'Large' ),
933-
'full' => __( 'Full Size' ),
934-
// phpcs:enable WordPress.WP.I18n.MissingArgDomain
935-
)
928+
Image_Sizes_No_Textdomain::get_image_sizes()
936929
);
937930

938931
$labels = wp_parse_args( $labels, $image_sizes );
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Returns image sizes used in `class-utils.php`.
4+
*
5+
* These sizes are defined in a separate file, because the `addtextdomain`
6+
* task in `gruntfile.js` would otherwise try to add our textdomain to
7+
* them, which we don't want.
8+
*
9+
* We need these size names to use the default WordPress translations.
10+
*
11+
* @package Cloudinary
12+
*/
13+
14+
namespace Cloudinary\Misc;
15+
16+
/**
17+
* Class Image_Sizes_No_Textdomain
18+
*/
19+
class Image_Sizes_No_Textdomain {
20+
/**
21+
* Get image sizes.
22+
*
23+
* @return array
24+
*/
25+
public static function get_image_sizes() {
26+
return array(
27+
// phpcs:disable WordPress.WP.I18n.MissingArgDomain
28+
'thumbnail' => __( 'Thumbnail' ),
29+
'medium' => __( 'Medium' ),
30+
'medium_large' => __( 'Medium Large' ),
31+
'large' => __( 'Large' ),
32+
'full' => __( 'Full Size' ),
33+
// phpcs:enable WordPress.WP.I18n.MissingArgDomain
34+
);
35+
}
36+
}

0 commit comments

Comments
 (0)