Skip to content
New issue

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

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

Already on GitHub? # to your account

Ensure the 'cloudinary' textdomain is not added automatically #1017

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ module.exports = function ( grunt ) {
'!vendor/**/*',
'!package/**/*',
'!php/media/class-filter.php',
'!php/misc/class-image-sizes-no-textdomain.php',
],
},
},
Expand Down
13 changes: 3 additions & 10 deletions php/class-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Cloudinary;

use Cloudinary\Misc\Image_Sizes_No_Textdomain;
use Cloudinary\Settings\Setting;
use Google\Web_Stories\Story_Post_Type;
use WP_Post;
Expand Down Expand Up @@ -472,7 +473,7 @@ public static function get_support_link( $args = array() ) {
$plugin->version
)
),
'tf_description' => esc_attr( __( 'Please, provide more details on your request, and if possible, attach a System Report', 'cloudinary' ) ),
'tf_description' => esc_attr( __( 'Please, provide more details on your request, and if possible, attach a System Report', 'cloudinary' ) ),
);

$args = wp_parse_args(
Expand Down Expand Up @@ -924,15 +925,7 @@ public static function get_registered_sizes( $attachment_id = null ) {
/** This filter is documented in wp-admin/includes/media.php */
$image_sizes = apply_filters(
'image_size_names_choose',
array(
// phpcs:disable WordPress.WP.I18n.MissingArgDomain
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'medium_large' => __( 'Medium Large' ),
'large' => __( 'Large' ),
'full' => __( 'Full Size' ),
// phpcs:enable WordPress.WP.I18n.MissingArgDomain
)
Image_Sizes_No_Textdomain::get_image_sizes()
);

$labels = wp_parse_args( $labels, $image_sizes );
Expand Down
36 changes: 36 additions & 0 deletions php/misc/class-image-sizes-no-textdomain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Returns image sizes used in `class-utils.php`.
*
* These sizes are defined in a separate file, because the `addtextdomain`
* task in `gruntfile.js` would otherwise try to add our textdomain to
* them, which we don't want.
*
* We need these size names to use the default WordPress translations.
*
* @package Cloudinary
*/

namespace Cloudinary\Misc;

/**
* Class Image_Sizes_No_Textdomain
*/
class Image_Sizes_No_Textdomain {
/**
* Get image sizes.
*
* @return array
*/
public static function get_image_sizes() {
return array(
// phpcs:disable WordPress.WP.I18n.MissingArgDomain
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'medium_large' => __( 'Medium Large' ),
'large' => __( 'Large' ),
'full' => __( 'Full Size' ),
// phpcs:enable WordPress.WP.I18n.MissingArgDomain
);
}
}