Skip to content

Commit

Permalink
Internal: Document i18n translators comments (elementor#16189)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiy authored Oct 13, 2021
1 parent 47f31a6 commit ab7b11a
Show file tree
Hide file tree
Showing 39 changed files with 77 additions and 51 deletions.
3 changes: 2 additions & 1 deletion assets/dev/js/editor/controls/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ ControlMediaItemView = ControlBaseDataView.extend( {

$galleryThumbnails.empty();

this.ui.status.text( hasImages ? sprintf( '%s Images Selected', imagesCount ) : __( 'No Images Selected', 'elementor' ) );
/* translators: %s: Selected images count. */
this.ui.status.text( hasImages ? sprintf( __( '%s Images Selected', 'elementor' ), imagesCount ) : __( 'No Images Selected', 'elementor' ) );

if ( ! hasImages ) {
return;
Expand Down
2 changes: 1 addition & 1 deletion assets/dev/js/editor/elements/views/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ BaseElementView = BaseContainer.extend( {
{
name: 'edit',
icon: 'eicon-edit',
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Edit %s', 'elementor' ), this.options.model.getTitle() ),
callback: () => $e.run( 'panel/editor/open', {
model: this.options.model, // Todo: remove on merge router
Expand Down
8 changes: 4 additions & 4 deletions assets/dev/js/editor/elements/views/column.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,26 @@ ColumnView = BaseElementView.extend( {
editTools = {};

editTools.edit = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Edit %s', 'elementor' ), elementData.title ),
icon: 'column',
};

if ( elementor.getPreferences( 'edit_buttons' ) ) {
editTools.duplicate = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Duplicate %s', 'elementor' ), elementData.title ),
icon: 'clone',
};

editTools.add = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Add %s', 'elementor' ), elementData.title ),
icon: 'plus',
};

editTools.remove = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Delete %s', 'elementor' ), elementData.title ),
icon: 'close',
};
Expand Down
8 changes: 4 additions & 4 deletions assets/dev/js/editor/elements/views/section.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,28 @@ const SectionView = BaseElementView.extend( {

if ( ! this.isInner() ) {
editTools.add = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Add %s', 'elementor' ), elementData.title ),
icon: 'plus',
};
}

editTools.edit = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Edit %s', 'elementor' ), elementData.title ),
icon: 'handle',
};

if ( elementor.getPreferences( 'edit_buttons' ) ) {
editTools.duplicate = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Duplicate %s', 'elementor' ), elementData.title ),
icon: 'clone',
};
}

editTools.remove = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Delete %s', 'elementor' ), elementData.title ),
icon: 'close',
};
Expand Down
6 changes: 3 additions & 3 deletions assets/dev/js/editor/elements/views/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ WidgetView = BaseElementView.extend( {
editTools = {};

editTools.edit = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Edit %s', 'elementor' ), elementData.title ),
icon: 'edit',
};

if ( elementor.getPreferences( 'edit_buttons' ) ) {
editTools.duplicate = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Duplicate %s', 'elementor' ), elementData.title ),
icon: 'clone',
};

editTools.remove = {
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title: sprintf( __( 'Delete %s', 'elementor' ), elementData.title ),
icon: 'close',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class Component extends ComponentBase {

renderTab( tab, args ) {
const { model, view } = args,
/* translators: %s: Element Name. */
/* translators: %s: Element name. */
title = sprintf( __( 'Edit %s', 'elementor' ), elementor.getElementData( model ).title );

elementor.getPanelView().setPage( 'editor', title, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ module.exports = Marionette.ItemView.extend( {
const title = this.model.get( 'title' );

elementor.promotion.showDialog( {
/* translators: %s: Widget Title. */
/* translators: %s: Widget title. */
headerMessage: sprintf( __( '%s Widget', 'elementor' ), title ),
/* translators: %s: Widget Title. */
/* translators: %s: Widget title. */
message: sprintf( __( 'Use %s widget and dozens more pro features to extend your toolbox and build sites faster and better.', 'elementor' ), title ),
top: '-7',
element: this.el,
Expand Down
2 changes: 1 addition & 1 deletion assets/dev/js/editor/utils/heartbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class Heartbeat {
const modal = this.getModal();

modal
/* translators: %s: Locked User Name. */
/* translators: %s: Locked user name. */
.setMessage( sprintf( __( '%s has taken over and is currently editing. Do you want to take over this page editing?', 'elementor' ), lockedUser ) )
.show();
}
Expand Down
4 changes: 2 additions & 2 deletions core/admin/admin-notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ private function notice_api_upgrade_plugin() {
}

$message = sprintf(
/* translators: 1: Details URL, 2: Accessibility text, 3: Version number, 4: Update URL, 5: Accessibility text */
/* translators: 1: Details URL, 2: Accessibility text, 3: Version number, 4: Update URL, 5: Accessibility text. */
__( 'There is a new version of Elementor Page Builder available. <a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">View version %3$s details</a> or <a href="%4$s" class="update-link" aria-label="%5$s">update now</a>.', 'elementor' ),
esc_url( $details_url ),
esc_attr( sprintf(
/* translators: %s: Elementor version */
/* translators: %s: Elementor version. */
__( 'View Elementor version %s details', 'elementor' ),
$new_version
) ),
Expand Down
2 changes: 1 addition & 1 deletion core/app/modules/import-export/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private function render_import_export_tab_content() {
$intro_text_link = sprintf( '<a href="https://go.elementor.com/wp-dash-import-export-general" target="_blank">%s</a>', esc_html__( 'Learn more', 'elementor' ) );

$intro_text = sprintf(
/* translators: %1$s: New line break, %2$s: Learn More link. */
/* translators: 1: New line break, 2: Learn More link. */
__( 'Design sites faster with a template kit that contains some or all components of a complete site, like templates, content & site settings.%1$sYou can import a kit and apply it to your site, or export the elements from this site to be used anywhere else. %2$s', 'elementor' ),
'<br>',
$intro_text_link
Expand Down
1 change: 1 addition & 0 deletions core/base/background-process/wp-background-process.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ public function schedule_cron_healthcheck( $schedules ) {
// Adds every 5 minutes to the existing schedules.
$schedules[ $this->identifier . '_cron_interval' ] = array(
'interval' => MINUTE_IN_SECONDS * $interval,
/* translators: %d: Interval in minutes. */
'display' => sprintf( esc_html__( 'Every %d Minutes', 'elementor' ), $interval ),
);

Expand Down
2 changes: 1 addition & 1 deletion core/base/background-task.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public function schedule_cron_healthcheck( $schedules ) {
// Adds every 5 minutes to the existing schedules.
$schedules[ $this->identifier . '_cron_interval' ] = array(
'interval' => MINUTE_IN_SECONDS * $interval,
/* translators: %d: interval */
/* translators: %d: Interval in minutes. */
'display' => sprintf( esc_html__( 'Every %d minutes', 'elementor' ), $interval ),
);

Expand Down
8 changes: 4 additions & 4 deletions core/base/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public static function get_editor_panel_config() {
'has_elements' => static::get_property( 'has_elements' ),
'support_kit' => static::get_property( 'support_kit' ),
'messages' => [
/* translators: %s: the document title. */
/* translators: %s: Document title. */
'publish_notification' => sprintf( esc_html__( 'Hurray! Your %s is live.', 'elementor' ), static::get_title() ),
],
];
Expand Down Expand Up @@ -1009,7 +1009,7 @@ public function get_css_wrapper_selector() {
*/
public function get_panel_page_settings() {
return [
/* translators: %s: Document title */
/* translators: %s: Document title. */
'title' => sprintf( esc_html__( '%s Settings', 'elementor' ), static::get_title() ),
];
}
Expand Down Expand Up @@ -1255,10 +1255,10 @@ public function get_last_edited() {
$display_name = get_the_author_meta( 'display_name', $post->post_author );

if ( $autosave_post || 'revision' === $post->post_type ) {
/* translators: 1: Saving date, 2: Author display name */
/* translators: 1: Saving date, 2: Author display name. */
$last_edited = sprintf( esc_html__( 'Draft saved on %1$s by %2$s', 'elementor' ), '<time>' . $date . '</time>', $display_name );
} else {
/* translators: 1: Editing date, 2: Author display name */
/* translators: 1: Editing date, 2: Author display name. */
$last_edited = sprintf( esc_html__( 'Last edited on %1$s by %2$s', 'elementor' ), '<time>' . $date . '</time>', $display_name );
}

Expand Down
1 change: 1 addition & 0 deletions core/common/modules/connect/apps/base-app.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function render_admin_widget() {

if ( $this->is_connected() ) {
$remote_user = $this->get( 'user' );
/* translators: %s: Remote user. */
$title = sprintf( esc_html__( 'Connected as %s', 'elementor' ), '<strong>' . esc_html( $remote_user->email ) . '</strong>' );
$label = esc_html__( 'Disconnect', 'elementor' );
$url = $this->get_admin_url( 'disconnect' );
Expand Down
2 changes: 1 addition & 1 deletion core/common/modules/finder/categories/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function get_category_items( array $options = [] ) {
}

$items[ $post_type ] = [
/* translators: %s the title of the post type */
/* translators: %s: Post type singular label. */
'title' => sprintf( esc_html__( 'Add New %s', 'elementor' ), $post_type_object->labels->singular_name ),
'icon' => 'plus-circle-o',
'url' => $url,
Expand Down
1 change: 1 addition & 0 deletions core/debug/classes/htaccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function run() {

if ( strstr( $server, 'APACHE' ) ) {
$htaccess_file = get_home_path() . '.htaccess';
/* translators: %s: Path to .htaccess file. */
$this->message .= ' ' . sprintf( esc_html__( 'File Path: %s', 'elementor' ), $htaccess_file ) . ' ';
return file_exists( $htaccess_file );
}
Expand Down
2 changes: 1 addition & 1 deletion core/documents-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public function create( $type, $post_data = [], $meta_data = [] ) {
$post_data['post_title'] = esc_html__( 'Elementor', 'elementor' );
if ( 'post' !== $type ) {
$post_data['post_title'] = sprintf(
/* translators: %s: Document title */
/* translators: %s: Document title. */
__( 'Elementor %s', 'elementor' ),
call_user_func( [ $class, 'get_title' ] )
);
Expand Down
2 changes: 1 addition & 1 deletion core/editor/notice-bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function get_init_settings() {
'muted_period' => 90,
'option_key' => '_elementor_editor_upgrade_notice_dismissed',
'message' => sprintf(
/* translators: %1$s Link open tag, %2$s: Link close tag. */
/* translators: 1: Link open tag, 2: Link close tag. */
esc_html__( 'Love using Elementor? %1$sLearn how you can build better sites with Elementor Pro.%2$s', 'elementor' ),
'<a href="%s">',
'</a>'
Expand Down
2 changes: 2 additions & 0 deletions core/files/assets/files-upload-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ public function handle_upload_prefilter( $file ) {
$display_type = strtoupper( $file_type );

if ( $file_type !== $ext ) {
/* translators: 1: File extension, 2: File type. */
$file['error'] = sprintf( esc_html__( 'The uploaded %1$s file is not supported. Please upload a valid %2$s file', 'elementor' ), $ext, $display_type );
return $file;
}

if ( ! self::is_enabled() ) {
/* translators: %s: File type. */
$file['error'] = sprintf( esc_html__( '%1$s file is not allowed for security reasons', 'elementor' ), $display_type );
return $file;
}
Expand Down
1 change: 1 addition & 0 deletions core/files/assets/svg/svg-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ public function handle_upload_prefilter( $file ) {
if ( ! $file['error'] && self::file_sanitizer_can_run() && ! $this->sanitize_svg( $file['tmp_name'] ) ) {
$display_type = strtoupper( $this->get_file_type() );

/* translators: %s: File type. */
$file['error'] = sprintf( esc_html__( 'Invalid %1$s Format, file not uploaded for security reasons', 'elementor' ), $display_type );
}

Expand Down
2 changes: 1 addition & 1 deletion core/kits/assets/js/repeater-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class extends RepeaterRow {
const globalType = this.ui.removeButton.data( 'e-global-type' ),
globalTypeTranslatedCapitalized = 'font' === globalType ? __( 'Font', 'elementor' ) : __( 'Color', 'elementor' ),
globalTypeTranslatedLowercase = 'font' === globalType ? __( 'font', 'elementor' ) : __( 'color', 'elementor' ),
/* translators: First %s: Font/Color. Second %s: typography/color */
/* translators: 1: Font/Color, 2: typography/color. */
translatedMessage = sprintf( __( 'You\'re about to delete a Global %s. Note that if it\'s being used anywhere on your site, it will inherit a default %s.', 'elementor' ), globalTypeTranslatedCapitalized, globalTypeTranslatedLowercase );

this.confirmDeleteModal = elementorCommon.dialogsManager.createWidget( 'confirm', {
Expand Down
2 changes: 1 addition & 1 deletion core/kits/documents/tabs/tab-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function add_default_globals_notice() {
'name' => $current_section['section'] . '_schemes_notice',
'type' => Controls_Manager::RAW_HTML,
'raw' => sprintf(
/* translators: %1$s Link open tag, %2$s: Link close tag. */
/* translators: 1: Link open tag, 2: Link close tag. */
esc_html__( 'In order for Theme Style to affect all relevant Elementor elements, please disable Default Colors and Fonts from the %1$sSettings Page%2$s.', 'elementor' ),
'<a href="' . esc_url( Settings::get_url() ) . '" target="_blank">',
'</a>'
Expand Down
2 changes: 1 addition & 1 deletion core/settings/page/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function get_panel_page_settings() {
$document = Plugin::$instance->documents->get( $this->post->ID );

return [
/* translators: %s: Document title */
/* translators: %s: Document title. */
'title' => sprintf( esc_html__( '%s Settings', 'elementor' ), $document::get_title() ),
];
}
Expand Down
14 changes: 12 additions & 2 deletions core/utils/import-export/wp-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ private function set_authors_from_import( $import_data ) {
$login = sanitize_user( $post['post_author'], true );

if ( empty( $login ) ) {
/* translators: %s: Post author. */
$this->output['errors'][] = sprintf( esc_html__( 'Failed to import author %s. Their posts will be attributed to the current user.', 'elementor' ), $post['post_author'] );
continue;
}
Expand Down Expand Up @@ -362,6 +363,7 @@ private function set_author_mapping() {
}
$this->author_mapping[ $santized_old_login ] = $user_id;
} else {
/* translators: %s: Author display name. */
$error = sprintf( esc_html__( 'Failed to create new user for %s. Their posts will be attributed to the current user.', 'elementor' ), $this->authors[ $old_login ]['author_display_name'] );

if ( defined( 'IMPORT_DEBUG' ) && IMPORT_DEBUG ) {
Expand Down Expand Up @@ -428,6 +430,7 @@ private function process_categories() {
}
$result++;
} else {
/* translators: %s: Category name. */
$error = sprintf( esc_html__( 'Failed to import category %s', 'elementor' ), $cat['category_nicename'] );

if ( defined( 'IMPORT_DEBUG' ) && IMPORT_DEBUG ) {
Expand Down Expand Up @@ -488,6 +491,7 @@ private function process_tags() {
}
$result++;
} else {
/* translators: %s: Tag name. */
$error = sprintf( esc_html__( 'Failed to import post tag %s', 'elementor' ), $tag['tag_name'] );

if ( defined( 'IMPORT_DEBUG' ) && IMPORT_DEBUG ) {
Expand Down Expand Up @@ -558,6 +562,7 @@ private function process_terms() {
}
$result++;
} else {
/* translators: 1: Term taxonomy, 2: Term name. */
$error = sprintf( esc_html__( 'Failed to import %1$s %2$s', 'elementor' ), $term['term_taxonomy'], $term['term_name'] );

if ( defined( 'IMPORT_DEBUG' ) && IMPORT_DEBUG ) {
Expand Down Expand Up @@ -655,6 +660,7 @@ private function process_posts() {
$post = apply_filters( 'wp_import_post_data_raw', $post );

if ( ! post_type_exists( $post['post_type'] ) ) {
/* translators: 1: Post title, 2: Post type. */
$this->output['errors'][] = sprintf( esc_html__( 'Failed to import %1$s: Invalid post type %2$s', 'elementor' ), $post['post_title'], $post['post_type'] );
do_action( 'wp_import_post_exists', $post );
continue;
Expand Down Expand Up @@ -743,6 +749,7 @@ private function process_posts() {
}

if ( is_wp_error( $post_id ) ) {
/* translators: 1: Post type singular label, 2: Post title. */
$error = sprintf( __( 'Failed to import %1$s %2$s', 'elementor' ), $post_type_object->labels->singular_name, $post['post_title'] );

if ( defined( 'IMPORT_DEBUG' ) && IMPORT_DEBUG ) {
Expand Down Expand Up @@ -789,6 +796,7 @@ private function process_posts() {
$term_id = $t['term_id'];
do_action( 'wp_import_insert_term', $t, $term, $post_id, $post );
} else {
/* translators: 1: Taxonomy name, 2: Term name. */
$error = sprintf( esc_html__( 'Failed to import %1$s %2$s', 'elementor' ), $taxonomy, $term['name'] );

if ( defined( 'IMPORT_DEBUG' ) && IMPORT_DEBUG ) {
Expand Down Expand Up @@ -946,6 +954,7 @@ private function process_menu_item( $item ) {

$menu_id = term_exists( $menu_slug, 'nav_menu' );
if ( ! $menu_id ) {
/* translators: %s: Menu slug. */
$this->output['errors'][] = sprintf( esc_html__( 'Menu item skipped due to invalid menu slug: %s', 'elementor' ), $menu_slug );

return;
Expand Down Expand Up @@ -1090,7 +1099,7 @@ private function fetch_remote_file( $url, $post ) {
if ( is_wp_error( $remote_response ) ) {
@unlink( $tmp_file_name );

return new WP_Error( 'import_file_error', sprintf( /* translators: 1: The WordPress error message. 2: The WordPress error code. */ esc_html__( 'Request failed due to an error: %1$s (%2$s)', 'elementor' ), esc_html( $remote_response->get_error_message() ), esc_html( $remote_response->get_error_code() ) ) );
return new WP_Error( 'import_file_error', sprintf( /* translators: 1: WordPress error message, 2: WordPress error code. */ esc_html__( 'Request failed due to an error: %1$s (%2$s)', 'elementor' ), esc_html( $remote_response->get_error_message() ), esc_html( $remote_response->get_error_code() ) ) );
}

$remote_response_code = (int) wp_remote_retrieve_response_code( $remote_response );
Expand All @@ -1099,7 +1108,7 @@ private function fetch_remote_file( $url, $post ) {
if ( 200 !== $remote_response_code ) {
@unlink( $tmp_file_name );

return new WP_Error( 'import_file_error', sprintf( /* translators: 1: The HTTP error message. 2: The HTTP error code. */ esc_html__( 'Remote server returned the following unexpected result: %1$s (%2$s)', 'elementor' ), get_status_header_desc( $remote_response_code ), esc_html( $remote_response_code ) ) );
return new WP_Error( 'import_file_error', sprintf( /* translators: 1: HTTP error message, 2: HTTP error code. */ esc_html__( 'Remote server returned the following unexpected result: %1$s (%2$s)', 'elementor' ), get_status_header_desc( $remote_response_code ), esc_html( $remote_response_code ) ) );
}

$headers = wp_remote_retrieve_headers( $remote_response );
Expand Down Expand Up @@ -1129,6 +1138,7 @@ private function fetch_remote_file( $url, $post ) {
if ( ! empty( $max_size ) && $filesize > $max_size ) {
@unlink( $tmp_file_name );

/* translators: %s: Max file size. */
return new WP_Error( 'import_file_error', sprintf( esc_html__( 'Remote file is too large, limit is %s', 'elementor' ), size_format( $max_size ) ) );
}

Expand Down
Loading

0 comments on commit ab7b11a

Please sign in to comment.