Skip to content

Commit 7f9fce9

Browse files
fix: i18n domain and translators comments
1 parent 7dd2cc2 commit 7f9fce9

File tree

18 files changed

+262
-41
lines changed

18 files changed

+262
-41
lines changed

classes/Visualizer/Module/Admin.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public function render_review_notice( $footer_text ) {
110110
foreach ( $visualizer_page_ids as $page_to_check ) {
111111
if ( strpos( $current_screen->id, $page_to_check ) !== false ) {
112112
$footer_text = sprintf(
113+
// translators: %1$s - the name of the plugin (Visualizer), %2$s - message (You can help us by leaving a), %3$s - HTML entity code.
113114
__( 'Enjoying %1$s? %2$s %3$s rating. Thank you for being so supportive!', 'visualizer' ),
114115
'<b>Visualizer</b>',
115116
esc_html__( 'You can help us by leaving a', 'visualizer' ),
@@ -1335,7 +1336,7 @@ public function add_black_friday_data( $configs ) {
13351336
$config = $configs['default'];
13361337

13371338
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
1338-
$message_template = __( 'Our biggest sale of the year: %1$sup to %2$s OFF%3$s on %4$s. Don\'t miss this limited-time offer.', 'wp-cloudflare-page-cache' );
1339+
$message_template = __( 'Our biggest sale of the year: %1$sup to %2$s OFF%3$s on %4$s. Don\'t miss this limited-time offer.', 'visualizer' );
13391340
$product_label = 'Visualizer';
13401341
$discount = '70%';
13411342

@@ -1345,7 +1346,7 @@ public function add_black_friday_data( $configs ) {
13451346

13461347
if ( $is_pro ) {
13471348
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
1348-
$message_template = __( 'Get %1$sup to %2$s off%3$s when you upgrade your %4$s plan or renew early.', 'wp-cloudflare-page-cache' );
1349+
$message_template = __( 'Get %1$sup to %2$s off%3$s when you upgrade your %4$s plan or renew early.', 'visualizer' );
13491350
$product_label = 'Visualizer Pro';
13501351
$discount = '30%';
13511352
}

classes/Visualizer/Module/Sources.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ public function addProUpsell( $old, $feature = null ) {
138138
( in_array( $feature, $biz_features, true ) && ! apply_filters( 'visualizer_is_business', false ) ) ||
139139
( in_array( $feature, $pro_features, true ) && ! Visualizer_Module::is_pro() )
140140
) {
141+
// translators: $s - the name of the plan (PRO).
141142
$msg = sprintf( __( 'Upgrade to %s to activate this feature!', 'visualizer' ), 'PRO' );
143+
// translators: $s - the name of the plan (Plus).
142144
$plus_msg = sprintf( __( 'Upgrade to %s plan to activate this feature!', 'visualizer' ), 'Plus' );
143145
if ( in_array( $feature, $biz_features, true ) && Visualizer_Module::is_pro() ) {
144146
$msg = $plus_msg;

classes/Visualizer/Render/Layout.php

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,26 @@ public static function _renderDbQuery( $args ) {
9090
<div class='db-wizard-hints'>
9191
<ul>
9292
<li><?php echo __( 'Your database prefix is:', 'visualizer' ); ?> <span class="visualizer-emboss"><?php echo $wpdb->prefix; ?></span></li>
93-
<li><?php echo sprintf( __( 'For examples of queries and links to resources that you can use with this feature, please click %1$shere%2$s', 'visualizer' ), '<a href="' . VISUALIZER_DB_QUERY_DOC_URL . '" target="_blank">', '</a>' ); ?></li>
94-
<li><?php echo sprintf( __( 'Use %1$sShift+Space%2$s for autocompleting keywords or table names.', 'visualizer' ), '<span class="visualizer-emboss">', '</span>' ); ?></li>
93+
<li>
94+
<?php
95+
echo sprintf(
96+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
97+
__( 'For examples of queries and links to resources that you can use with this feature, please click %1$shere%2$s', 'visualizer' ),
98+
'<a href="' . VISUALIZER_DB_QUERY_DOC_URL . '" target="_blank">',
99+
'</a>'
100+
);
101+
?>
102+
</li>
103+
<li>
104+
<?php
105+
echo sprintf(
106+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
107+
__( 'Use %1$sShift+Space%2$s for autocompleting keywords or table names.', 'visualizer' ),
108+
'<span class="visualizer-emboss">',
109+
'</span>'
110+
);
111+
?>
112+
</li>
95113
<?php do_action( 'visualizer_db_query_add_hints', $args ); ?>
96114
</ul>
97115
</div>
@@ -180,7 +198,16 @@ public static function _renderJsonScreen( $args ) {
180198
<form id="json-endpoint-form">
181199
<div class="json-wizard-hints">
182200
<ul class="info">
183-
<li><?php echo sprintf( __( 'If you want to add authentication or headers to the endpoint or change the request in any way, please refer to our document %1$shere%2$s.', 'visualizer' ), '<a href="https://docs.themeisle.com/article/1043-visualizer-how-to-extend-rest-endpoints-with-json-response" target="_blank">', '</a>' ); ?></li>
201+
<li>
202+
<?php
203+
echo sprintf(
204+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
205+
__( 'If you want to add authentication or headers to the endpoint or change the request in any way, please refer to our document %1$shere%2$s.', 'visualizer' ),
206+
'<a href="https://docs.themeisle.com/article/1043-visualizer-how-to-extend-rest-endpoints-with-json-response" target="_blank">',
207+
'</a>'
208+
);
209+
?>
210+
</li>
184211
</ul>
185212
</div>
186213

@@ -662,10 +689,20 @@ public static function _renderTabHelp( $args ) {
662689
<h4><span class="dashicons dashicons-media-code"></span><a href="<?php echo VISUALIZER_CODE_SNIPPETS_URL; ?>" target="_blank"><?php _e( 'Custom code snippets', 'visualizer' ); ?></a></h4>
663690
<?php
664691
Visualizer_Render_Sidebar::_renderSectionEnd();
692+
// translators: %s - the chart type.
665693
Visualizer_Render_Sidebar::_renderSectionStart( sprintf( __( '%s chart', 'visualizer' ), ucwords( $displayType ) ), true );
666694
?>
667695
<h4><span class="dashicons dashicons-video-alt2"></span>&nbsp;<a href="<?php echo str_replace( '#', "$type-chart", VISUALIZER_DEMO_URL ); ?>" target="_blank"><?php _e( 'View demo', 'visualizer' ); ?></a></h4>
668-
<h4><span class="dashicons dashicons-search"></span><a href="<?php echo str_replace( '#', $type, VISUALIZER_DOC_COLLECTION ); ?>" target="_blank"><?php echo sprintf( __( 'Articles containing "%s"', 'visualizer' ), $displayType ); ?></a></h4>
696+
<h4><span class="dashicons dashicons-search"></span><a href="<?php echo str_replace( '#', $type, VISUALIZER_DOC_COLLECTION ); ?>" target="_blank">
697+
<?php
698+
echo sprintf(
699+
// translators: %s - the chart type.
700+
__( 'Articles containing "%s"', 'visualizer' ),
701+
$displayType
702+
);
703+
?>
704+
</a>
705+
</h4>
669706
<?php
670707
Visualizer_Render_Sidebar::_renderSectionEnd();
671708
Visualizer_Render_Sidebar::_renderGroupEnd();
@@ -775,7 +812,17 @@ public static function _renderTabBasic( $args ) {
775812
<div class="viz-group-content">
776813
<div>
777814
<p class="viz-group-description"><?php esc_html_e( 'Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' ); ?></p>
778-
<p class="viz-group-description viz-info-msg"><b><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s. If you are using non-English characters, please make sure you save the file in UTF-8 encoding.', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $type . '.csv" target="_blank">', $type, '.csv</a>' ); ?></b></p>
815+
<p class="viz-group-description viz-info-msg">
816+
<b>
817+
<?php
818+
echo sprintf(
819+
// translators: $s - the chart type with the link attached.
820+
__( 'If you are unsure about how to format your data CSV then please take a look at this sample: %s. If you are using non-English characters, please make sure you save the file in UTF-8 encoding.', 'visualizer' ),
821+
'<a href="' . VISUALIZER_ASURL . 'samples/' . $type . '.csv" target="_blank">' . $type . '.csv</a>'
822+
);
823+
?>
824+
</b>
825+
</p>
779826
<form id="vz-csv-file-form" action="<?php echo $upload_link; ?>" method="post"
780827
target="thehole" enctype="multipart/form-data">
781828
<input type="hidden" id="remote-data" name="remote_data">
@@ -798,8 +845,27 @@ public static function _renderTabBasic( $args ) {
798845
<span class="viz-section-title"><?php _e( 'Import from CSV', 'visualizer' ); ?></span>
799846
<div class="only-pro-anchor">
800847
<div class="viz-section-items section-items">
801-
<p class="viz-group-description"><?php echo sprintf( __( 'You can use this to import data from a remote CSV file or %1$sGoogle Spreadsheet%2$s.', 'visualizer' ), '<a href="https://docs.themeisle.com/article/607-how-can-i-populate-data-from-google-spreadsheet" target="_blank" >', '</a>' ); ?> </p>
802-
<p class="viz-group-description viz-info-msg"><b><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s. If you are using non-English characters, please make sure you save the file in UTF-8 encoding.', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $type . '.csv" target="_blank">', $type, '.csv</a>' ); ?></b></p>
848+
<p class="viz-group-description">
849+
<?php
850+
echo sprintf(
851+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
852+
__( 'You can use this to import data from a remote CSV file or %1$sGoogle Spreadsheet%2$s.', 'visualizer' ),
853+
'<a href="https://docs.themeisle.com/article/607-how-can-i-populate-data-from-google-spreadsheet" target="_blank" >',
854+
'</a>'
855+
);
856+
?>
857+
</p>
858+
<p class="viz-group-description viz-info-msg">
859+
<b>
860+
<?php
861+
echo sprintf(
862+
// translators: %s - the chart type with the link attached.
863+
__( 'If you are unsure about how to format your data CSV then please take a look at this sample: %s. If you are using non-English characters, please make sure you save the file in UTF-8 encoding.', 'visualizer' ),
864+
'<a href="' . VISUALIZER_ABSURL . 'samples/' . $type . '.csv" target="_blank">' . $type . '.csv</a>'
865+
);
866+
?>
867+
</b>
868+
</p>
803869
<form id="vz-one-time-import" action="<?php echo $upload_link; ?>" method="post"
804870
target="thehole" enctype="multipart/form-data">
805871
<div class="remote-file-section">

classes/Visualizer/Render/Library.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ private function _renderMessages() {
6161
if ( ! filter_var( ini_get( 'allow_url_fopen' ), FILTER_VALIDATE_BOOLEAN ) ) {
6262
echo '<div class="updated error">';
6363
echo '<p>';
64-
printf( esc_html__( '%s option is disabled in your php.ini config. Please, enable it by change its value to 1. This option increases the speed of remote CSV uploading.', 'visualizer' ), '<b>allow_url_fopen</b>' );
64+
printf(
65+
// translators: %s - the name of the option.
66+
esc_html__( '%s option is disabled in your php.ini config. Please, enable it by change its value to 1. This option increases the speed of remote CSV uploading.', 'visualizer' ),
67+
'<b>allow_url_fopen</b>'
68+
);
6569
echo '</p>';
6670
echo '</div>';
6771
}

classes/Visualizer/Render/Sidebar.php

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ protected function _renderChartTitleSettings() {
125125
esc_html__( 'Chart Description', 'visualizer' ),
126126
'description',
127127
$this->description,
128-
sprintf( esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ), '<a href="https://developers.google.com/search/docs/data-types/dataset#dataset" target="_blank">', '</a>' )
128+
sprintf(
129+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
130+
esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ),
131+
'<a href="https://developers.google.com/search/docs/data-types/dataset#dataset" target="_blank">',
132+
'</a>'
133+
)
129134
);
130135
}
131136

@@ -134,7 +139,15 @@ protected function _renderChartTitleSettings() {
134139
*/
135140
protected function _renderManualConfigDescription() {
136141
self::_renderSectionStart();
137-
self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the graph by providing configuration variables right from the %1$sGoogle Visualization API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/?#configuration-options" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', '</a>' ) . '</span>' );
142+
self::_renderSectionDescription(
143+
'<span class="viz-gvlink">' . sprintf(
144+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag, %3$s - HTML link tag, %4$s - HTML closing link tag.
145+
__( 'Configure the graph by providing configuration variables right from the %1$sGoogle Visualization API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/?#configuration-options" target="_blank">',
146+
'</a>',
147+
'<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">',
148+
'</a>'
149+
) . '</span>'
150+
);
138151
}
139152

140153
/**
@@ -185,6 +198,7 @@ protected function _renderAdvancedSettings() {
185198
'manual',
186199
$this->manual,
187200
sprintf(
201+
// translators: %s - the format.
188202
esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ),
189203
'<br><code>' . $this->_renderManualConfigExample() . '</code>'
190204
),
@@ -461,7 +475,12 @@ protected function _renderFormatField( $index = 0 ) {
461475
esc_html__( 'Number Format', 'visualizer' ),
462476
'series[' . $index . '][format]',
463477
isset( $this->series[ $index ]['format'] ) ? $this->series[ $index ]['format'] : '',
464-
sprintf( esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU pattern set%2$s. Use something like #,### to get 1,234 as output, or $# to add dollar sign before digits. Pay attention that if you use &#37; percentage format then your values will be multiplied by 100.', 'visualizer' ), '<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">', '</a>' ),
478+
sprintf(
479+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
480+
esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU pattern set%2$s. Use something like #,### to get 1,234 as output, or $# to add dollar sign before digits. Pay attention that if you use &#37; percentage format then your values will be multiplied by 100.', 'visualizer' ),
481+
'<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">',
482+
'</a>'
483+
),
465484
'#,###.##'
466485
);
467486
break;
@@ -472,7 +491,12 @@ protected function _renderFormatField( $index = 0 ) {
472491
esc_html__( 'Date Format', 'visualizer' ),
473492
'series[' . $index . '][format]',
474493
isset( $this->series[ $index ]['format'] ) ? $this->series[ $index ]['format'] : '',
475-
sprintf( esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU date and time format%2$s.', 'visualizer' ), '<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">', '</a>' ),
494+
sprintf(
495+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
496+
esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU date and time format%2$s.', 'visualizer' ),
497+
'<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">',
498+
'</a>'
499+
),
476500
'eeee, dd LLLL yyyy'
477501
);
478502
break;
@@ -588,7 +612,14 @@ protected function _renderChartControlsGroup() {
588612
echo '<div style="position: relative">';
589613
}
590614
self::_renderSectionStart();
591-
self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the data filter controls by providing configuration variables right from the %1$sChart Controls API%2$s. ', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/controls#controls-gallery" target="_blank">', '</a>' ) . '</span>' );
615+
self::_renderSectionDescription(
616+
'<span class="viz-gvlink">' . sprintf(
617+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
618+
__( 'Configure the data filter controls by providing configuration variables right from the %1$sChart Controls API%2$s. ', 'visualizer' ),
619+
'<a href="https://developers.google.com/chart/interactive/docs/gallery/controls#controls-gallery" target="_blank">',
620+
'</a>'
621+
) . '</span>'
622+
);
592623
self::_renderSectionEnd();
593624
$this->_renderChartControlsSettings();
594625
if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) {
@@ -632,7 +663,12 @@ protected function _renderChartControlsSettings() {
632663
$column_type = isset( $column['type'] ) ? $column['type'] : '';
633664
$label = isset( $column['label'] ) ? $column['label'] : '';
634665
$column_label[ $label ] = $label;
635-
$column_index[ $key ] = sprintf( __( '%1$d — Column Type: %2$s ', 'visualizer' ), $key, ucfirst( $column_type ) );
666+
$column_index[ $key ] = sprintf(
667+
// translators: %1$d - the column key, %2$s - the column type.
668+
__( '%1$d — Column Type: %2$s ', 'visualizer' ),
669+
$key,
670+
ucfirst( $column_type )
671+
);
636672
}
637673
}
638674

classes/Visualizer/Render/Sidebar/ChartJS.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ protected function _renderChartTitleSettings() {
180180
esc_html__( 'Chart Description', 'visualizer' ),
181181
'description',
182182
$this->description,
183-
sprintf( esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ), '<a href="https://developers.google.com/search/docs/data-types/dataset#dataset" target="_blank">', '</a>' )
183+
sprintf(
184+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
185+
esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ),
186+
'<a href="https://developers.google.com/search/docs/data-types/dataset#dataset" target="_blank">',
187+
'</a>'
188+
)
184189
);
185190

186191
}
@@ -387,7 +392,16 @@ protected function _renderTooltipSettigns() {
387392
*/
388393
protected function _renderManualConfigDescription() {
389394
self::_renderSectionStart();
390-
self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the graph by providing configuration variables right from the %1$sChartJS API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://www.chartjs.org/docs/latest/configuration/" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', '</a>' ) . '</span>' );
395+
self::_renderSectionDescription(
396+
'<span class="viz-gvlink">' . sprintf(
397+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag, %3$s - HTML link tag, %4$s - HTML closing link tag.
398+
__( 'Configure the graph by providing configuration variables right from the %1$sChartJS API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ),
399+
'<a href="https://www.chartjs.org/docs/latest/configuration/" target="_blank">',
400+
'</a>',
401+
'<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">',
402+
'</a>'
403+
) . '</span>'
404+
);
391405
}
392406

393407
/**

classes/Visualizer/Render/Sidebar/Google.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,14 @@ protected function _renderRoleField( $index ) {
152152
'tooltip' => esc_html__( 'Tooltip', 'visualizer' ),
153153
'interval' => esc_html__( 'Interval', 'visualizer' ),
154154
),
155-
sprintf( esc_html__( 'Determines whether the series has to be used for a special role as mentioned in %1$shere%2$s. You can view a few examples %3$shere%4$s.', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/roles#what-roles-are-available" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/1160-roles-for-series-visualizer" target="_blank">', '</a>' )
155+
sprintf(
156+
// translators: %1$s - HTML link tag, %2$s - HTML closing link tag, %3$s - HTML link tag, %4$s - HTML closing link tag
157+
esc_html__( 'Determines whether the series has to be used for a special role as mentioned in %1$shere%2$s. You can view a few examples %3$shere%4$s.', 'visualizer' ),
158+
'<a href="https://developers.google.com/chart/interactive/docs/roles#what-roles-are-available" target="_blank">',
159+
'</a>',
160+
'<a href="https://docs.themeisle.com/article/1160-roles-for-series-visualizer" target="_blank">',
161+
'</a>'
162+
)
156163
);
157164
}
158165

0 commit comments

Comments
 (0)