You can use __(), _e(), _x() or _ex() and your textdomain to make your theme or plugin translatable.
I stripped your code snippet to the basics, so you will get the idea more easily:
<select class="widefat">
<?php foreach ( $this->getImageSizes() as $name => $atts ) : ?>
<option value="<?php echo $name; ?>" ?>>
<?php echo ucwords( __( $name, 'textdomain' ) ); ?>
</option>
<?php endforeach; ?>
</select>
Unfortunately internationalization is not possible with variables like $name
so you will have to provide the default image size names to make them accessible:
$sizes = array(
__( 'thumbnail', 'textdomain' ),
__( 'medium', 'textdomain' ),
__( 'large', 'textdomain' )
);
If you’re adding the image sizes yourself you can avoid the hack above if adding them like this:
add_image_size( __( 'custom-image-size', 'textdomain' ), $width, $height, $crop );
Related Posts:
- How to add qtranslate multi language support for media?
- Conflict with single and double quotes
- show hide image script after 4 seconds [closed]
- How to create .pot files with POedit?
- Restricting users to view only media library items they have uploaded?
- Translate a plugin using .po .mo files
- How do I disable responsive images in WP 4.4?
- Filter to remove image dimension attributes?
- How to get a list of all the possible thumbnail sizes set within a theme
- How do I get the avatar URL instead of an HTML IMG tag when using get_avatar?
- Image Upload from URL
- Programmatically adding images to media library
- How do I delete all UNUSED images from my uploads directory?
- Set default image sizes in WordPress to hard crop
- How to make a WordPress plugin translation ready?
- Is it possible set a featured image with external image URL
- get attachment title based on attachment id
- Stop wordpress from hardcoding img width and height attributes
- Theme localization of “slugs” (custom post types, taxonomies)
- Handle issues with change of image scaling (rounding) in 4.1 (WP Ticket #18532)
- Programmatically get images by URL and save in uploads folder
- Prevent WordPress from generating medium_large 768px size of image uploads?
- remove or update add_image_size
- Get Image Description
- How to extend the gallery block in Gutenberg?
- Image quality based on image size
- Function to get URL of original uploaded image – full size
- how to get original image using wp_get_attachment_image_src
- What is a good alternative to using $content_width for image optimization?
- get the attachement url for the medium sized image
- Can I attach image to post without adding it to post?
- Automatically replace original uploaded image with large image size
- WordPress crop tool greyed out
- How to scale up featured post thumbnail?
- Upload images to remote server
- Custom image size / thumbnail – Crop to aspect ratio even when source image is smaller than set dimensions
- Each custom image size in custom upload directory?
- Getting Images from theme’s directory in pages
- Set default image link target in Gutenberg image block
- Add an alignment option for images
- How to delete resized (cropped) image uploads and prevent future resizing?
- How to automatically add rounded corners to thumbnails?
- How to get a translated string from a language other than the current one?
- WordPress adding scaled images that don’t exist (1536×1536 and 2048×2048)
- Download an image from a webpage to the default uploads folder
- Add image size where largest possible proportional size is generated
- WP 4.4. responsive images browser choosing the “wrong” one
- After Moving a Site to Another Domain, All Images Are Lost
- How to print translation supported text with HTML URL
- How to get a localized version of WordPress from a repository?
- Prevent WordPress from adding image’ title automatically
- Localization: I want the backend: english and frontend in defined language
- Overide Gallery Default Link to Settings
- Retrieve featured image
- Working with l10n contexts (_x etc)
- How to change image type for specific size?
- Add new image size to media uploader so users can insert into post?
- How to insert pictures without hard coded dimensions?
- Uploaded images don’t show in Media Library if there are special characters in IPTC Keywords
- How to modify image editor dialog options on WordPress?
- Why WordPress automatic cropping all my images?
- Allow contributor role to upload images and not edit already published articles
- What’s the proper way to find and remove duplicate images from posts and the media library?
- Remove images (files) that were generated when using add_image_size()
- How to integrate get_post_time with date_i18n function?
- get_post_gallery with Gutenberg
- Is there a hook which fires after all thumbnails are generated?
- Auto Add Image Title,Caption,Alt Text,Description while uploading Images in WordPress
- Is there a simple way to just insert a link to an image (without inserting an image)?
- Watermarking Images with WordPress with WP_Image_Editor
- How to avoid WordPress stripping EXIF metadata when resizing images?
- is it possible to replace the use of gd_lib with imagick or ImageMagick?
- How to have different captions for same image, for galleries?
- gettext does not translate when called in ajax
- Get attachment/image info in JS
- How to reference a theme image in a stylesheet?
- wp_get_attachment_image_src and server path
- Limit image resolution on upload
- How to display a page’s featured image?
- Separate Media Library for each user
- Featured image shortcode
- get_post_gallery_images returns thumbs . I want full size
- How to provide translations for a WordPress TinyMCE plugin?
- How to escape the single quote character in i18n translation strings?
- Setting JPEG compression for custom image sizes doesn’t work in specific cases
- Maintaining image color and quality when uploading using custom sizes
- Rename files on upload
- Retina images – custom syntax for inserting images into post content
- How to insert images into posts without using Add Media dialog
- Using Images in WordPress – Best Practices
- How to find attachment by it’s name?
- How can I determine if a post has an image attachment?
- Media Upload Folder – how to manage
- Wrong image dimensions in Insert Media after add_image_size()
- How to set the default embed image size
- PHP Fatal error: Call to undefined function download_url()
- Why is wp_get_attachment_image_src not working with my custom size (add_image_size)
- Mixed content warnings after changing site adress from HTTP to HTTPS
- How to give image source in wordpress page editor?
- Displaying images from external RSS feeds?