Skip to content

Commit 55a6dcb

Browse files
committed
Updates translations to use .org GlotPress
1 parent 59f6369 commit 55a6dcb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+326
-10072
lines changed

README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,6 @@ Currently we have the plugin configured so it can be translated and the followin
8989
* sv_SE - Swedish in Sweden (thanks to [Sebastian Johnsson](http://www.agiley.se/) for contributing)
9090
* tr_TR - Turkish in Turkey (thanks to [Hakan E.](http://kazancexpert.com/) for contributing)
9191

92-
If your language is not listed above, feel free to create a translation. Here are the basic steps:
93-
94-
1. Copy "mailchimp_i18n-en_US.po" to "mailchimp_i18n-LANG_COUNTRY.po" - fill in LANG and COUNTRY with whatever you use for WPLANG in wp-config.php
95-
2. Grab a translation editor. [POedit](http://www.poedit.net/) works for us
96-
3. Translate each line - if you need some context, open up mailchimp.php and search for the line number or text
97-
4. [Fork](http://help.github.com/fork-a-repo/) the [repository on github](https://github.com/mailchimp/wordpress)
98-
5. [Clone](http://help.github.com/remotes/#clone) the _develop_ branch
99-
6. Add the appropriately named files to the /po/ directory and edit the /readme.txt to include how you'd like to be attributed
100-
7. Make a [pull request](http://help.github.com/send-pull-requests/)
101-
10292
## Support Level
10393

10494
**Active:** Mailchimp is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.

includes/blocks/mailchimp/block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"text": true
3636
}
3737
},
38-
"textdomain": "mailchimp_i18n",
38+
"textdomain": "mailchimp",
3939
"editorScript": "file:./index.js",
4040
"render": "file:./markup.php",
4141
"editorStyle": "file:./editor.css"

includes/blocks/mailchimp/edit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export const BlockEdit = ({ isSelected }) => {
3131
{isSelected || isDisallowedThemeSSR ? (
3232
<Placeholder
3333
icon={Icon}
34-
label={__('Mailchimp Block', 'mailchimp_i18n')}
35-
instructions={__('Great work! Your block is ready to go.', 'mailchimp_i18n')}
34+
label={__('Mailchimp Block', 'mailchimp')}
35+
instructions={__('Great work! Your block is ready to go.', 'mailchimp')}
3636
>
3737
<div>
3838
<Button
@@ -42,7 +42,7 @@ export const BlockEdit = ({ isSelected }) => {
4242
>
4343
{__(
4444
"Head over here if you'd like to adjust your settings.",
45-
'mailchimp_i18n',
45+
'mailchimp',
4646
)}
4747
</Button>
4848
</div>

lib/mailchimp/mailchimp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public function __construct( $api_key ) {
5050
throw new Exception(
5151
esc_html(
5252
sprintf(
53-
// translators: placeholder is an api key
54-
__( 'Invalid API Key: %s', 'mailchimp_i18n' ),
53+
/* translators: %s: api key */
54+
__( 'Invalid API Key: %s', 'mailchimp' ),
5555
$api_key
5656
)
5757
)

mailchimp.php

Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Plugin Name: Mailchimp
44
* Plugin URI: https://mailchimp.com/help/connect-or-disconnect-list-subscribe-for-wordpress/
55
* Description: Add a Mailchimp signup form widget to your WordPress site.
6+
* Text Domain: mailchimp
67
* Version: 1.5.8
78
* Requires at least: 6.1
89
* Requires PHP: 7.0
@@ -66,10 +67,6 @@
6667
* @return void
6768
*/
6869
function mailchimp_sf_plugin_init() {
69-
// Internationalize the plugin
70-
$textdomain = 'mailchimp_i18n';
71-
$locale = apply_filters( 'plugin_locale', get_locale(), $textdomain );
72-
load_textdomain( 'mailchimp_i18n', MCSF_LANG_DIR . $textdomain . '-' . $locale . '.mo' );
7370

7471
// Remove Sopresto check. If user does not have API key, make them authenticate.
7572

@@ -91,7 +88,7 @@ function mailchimp_sf_plugin_init() {
9188
*/
9289
function mailchimp_sf_plugin_action_links( $links ) {
9390
$settings_page = add_query_arg( array( 'page' => 'mailchimp_sf_options' ), admin_url( 'admin.php' ) );
94-
$settings_link = '<a href="' . esc_url( $settings_page ) . '">' . esc_html__( 'Settings', 'mailchimp_i18n' ) . '</a>';
91+
$settings_link = '<a href="' . esc_url( $settings_page ) . '">' . esc_html__( 'Settings', 'mailchimp' ) . '</a>';
9592
array_unshift( $links, $settings_link );
9693
return $links;
9794
}
@@ -203,8 +200,8 @@ function mailchimp_sf_main_css() {
203200
function mailchimp_sf_add_pages() {
204201
// Add settings page for users who can edit plugins
205202
add_menu_page(
206-
__( 'Mailchimp Setup', 'mailchimp_i18n' ),
207-
__( 'Mailchimp', 'mailchimp_i18n' ),
203+
__( 'Mailchimp Setup', 'mailchimp' ),
204+
__( 'Mailchimp', 'mailchimp' ),
208205
MCSF_CAP_THRESHOLD,
209206
'mailchimp_sf_options',
210207
'mailchimp_sf_setup_page',
@@ -482,8 +479,8 @@ function mailchimp_sf_global_msg( $msg = null ) {
482479
* @return void
483480
*/
484481
function mailchimp_sf_set_form_defaults( $list_name = '' ) {
485-
update_option( 'mc_header_content', __( 'Sign up for', 'mailchimp_i18n' ) . ' ' . $list_name );
486-
update_option( 'mc_submit_text', __( 'Subscribe', 'mailchimp_i18n' ) );
482+
update_option( 'mc_header_content', __( 'Sign up for', 'mailchimp' ) . ' ' . $list_name );
483+
update_option( 'mc_submit_text', __( 'Subscribe', 'mailchimp' ) );
487484

488485
update_option( 'mc_use_datepicker', 'on' );
489486
update_option( 'mc_custom_style', 'off' );
@@ -511,43 +508,43 @@ function mailchimp_sf_save_general_form_settings() {
511508
// IF NOT DEV MODE
512509
if ( isset( $_POST['mc_use_javascript'] ) ) {
513510
update_option( 'mc_use_javascript', 'on' );
514-
$msg = '<p class="success_msg">' . __( 'Fancy Javascript submission turned On!', 'mailchimp_i18n' ) . '</p>';
511+
$msg = '<p class="success_msg">' . __( 'Fancy Javascript submission turned On!', 'mailchimp' ) . '</p>';
515512
mailchimp_sf_global_msg( $msg );
516513
} elseif ( get_option( 'mc_use_javascript' ) !== 'off' ) {
517514
update_option( 'mc_use_javascript', 'off' );
518-
$msg = '<p class="success_msg">' . __( 'Fancy Javascript submission turned Off!', 'mailchimp_i18n' ) . '</p>';
515+
$msg = '<p class="success_msg">' . __( 'Fancy Javascript submission turned Off!', 'mailchimp' ) . '</p>';
519516
mailchimp_sf_global_msg( $msg );
520517
}
521518

522519
if ( isset( $_POST['mc_use_datepicker'] ) ) {
523520
update_option( 'mc_use_datepicker', 'on' );
524-
$msg = '<p class="success_msg">' . __( 'Datepicker turned On!', 'mailchimp_i18n' ) . '</p>';
521+
$msg = '<p class="success_msg">' . __( 'Datepicker turned On!', 'mailchimp' ) . '</p>';
525522
mailchimp_sf_global_msg( $msg );
526523
} elseif ( get_option( 'mc_use_datepicker' ) !== 'off' ) {
527524
update_option( 'mc_use_datepicker', 'off' );
528-
$msg = '<p class="success_msg">' . __( 'Datepicker turned Off!', 'mailchimp_i18n' ) . '</p>';
525+
$msg = '<p class="success_msg">' . __( 'Datepicker turned Off!', 'mailchimp' ) . '</p>';
529526
mailchimp_sf_global_msg( $msg );
530527
}
531528

532529
/*Enable double optin toggle*/
533530
if ( isset( $_POST['mc_double_optin'] ) ) {
534531
update_option( 'mc_double_optin', true );
535-
$msg = '<p class="success_msg">' . __( 'Double opt-in turned On!', 'mailchimp_i18n' ) . '</p>';
532+
$msg = '<p class="success_msg">' . __( 'Double opt-in turned On!', 'mailchimp' ) . '</p>';
536533
mailchimp_sf_global_msg( $msg );
537534
} elseif ( get_option( 'mc_double_optin' ) !== false ) {
538535
update_option( 'mc_double_optin', false );
539-
$msg = '<p class="success_msg">' . __( 'Double opt-in turned Off!', 'mailchimp_i18n' ) . '</p>';
536+
$msg = '<p class="success_msg">' . __( 'Double opt-in turned Off!', 'mailchimp' ) . '</p>';
540537
mailchimp_sf_global_msg( $msg );
541538
}
542539

543540
/* NUKE the CSS! */
544541
if ( isset( $_POST['mc_nuke_all_styles'] ) ) {
545542
update_option( 'mc_nuke_all_styles', true );
546-
$msg = '<p class="success_msg">' . __( 'Mailchimp CSS turned Off!', 'mailchimp_i18n' ) . '</p>';
543+
$msg = '<p class="success_msg">' . __( 'Mailchimp CSS turned Off!', 'mailchimp' ) . '</p>';
547544
mailchimp_sf_global_msg( $msg );
548545
} elseif ( get_option( 'mc_nuke_all_styles' ) !== false ) {
549546
update_option( 'mc_nuke_all_styles', false );
550-
$msg = '<p class="success_msg">' . __( 'Mailchimp CSS turned On!', 'mailchimp_i18n' ) . '</p>';
547+
$msg = '<p class="success_msg">' . __( 'Mailchimp CSS turned On!', 'mailchimp' ) . '</p>';
551548
mailchimp_sf_global_msg( $msg );
552549
}
553550

@@ -564,11 +561,11 @@ function mailchimp_sf_save_general_form_settings() {
564561

565562
if ( isset( $_POST['mc_use_unsub_link'] ) ) {
566563
update_option( 'mc_use_unsub_link', 'on' );
567-
$msg = '<p class="success_msg">' . __( 'Unsubscribe link turned On!', 'mailchimp_i18n' ) . '</p>';
564+
$msg = '<p class="success_msg">' . __( 'Unsubscribe link turned On!', 'mailchimp' ) . '</p>';
568565
mailchimp_sf_global_msg( $msg );
569566
} elseif ( get_option( 'mc_use_unsub_link' ) !== 'off' ) {
570567
update_option( 'mc_use_unsub_link', 'off' );
571-
$msg = '<p class="success_msg">' . __( 'Unsubscribe link turned Off!', 'mailchimp_i18n' ) . '</p>';
568+
$msg = '<p class="success_msg">' . __( 'Unsubscribe link turned Off!', 'mailchimp' ) . '</p>';
572569
mailchimp_sf_global_msg( $msg );
573570
}
574571

@@ -626,7 +623,7 @@ function mailchimp_sf_save_general_form_settings() {
626623
}
627624
}
628625

629-
$msg = '<p class="success_msg">' . esc_html( __( 'Successfully Updated your List Subscribe Form Settings!', 'mailchimp_i18n' ) ) . '</p>';
626+
$msg = '<p class="success_msg">' . esc_html( __( 'Successfully Updated your List Subscribe Form Settings!', 'mailchimp' ) ) . '</p>';
630627
mailchimp_sf_global_msg( $msg );
631628
}
632629

@@ -684,18 +681,18 @@ function mailchimp_sf_change_list_if_necessary() {
684681

685682
$igs_text = ' ';
686683
if ( is_array( $igs ) ) {
687-
// translators: placeholder is a count (number)
688-
$igs_text .= sprintf( __( 'and %s Sets of Interest Groups', 'mailchimp_i18n' ), count( $igs ) );
684+
/* translators: %s: count (number) */
685+
$igs_text .= sprintf( __( 'and %s Sets of Interest Groups', 'mailchimp' ), count( $igs ) );
689686
}
690687

691688
$msg = '<p class="success_msg">' .
692689
sprintf(
693-
// translators: placeholder is a count (number)
694-
__( '<b>Success!</b> Loaded and saved the info for %d Merge Variables', 'mailchimp_i18n' ) . $igs_text,
690+
/* translators: %s: count (number) */
691+
__( '<b>Success!</b> Loaded and saved the info for %d Merge Variables', 'mailchimp' ) . $igs_text,
695692
count( $mv )
696693
) . ' ' .
697694
__( 'from your list' ) . ' "' . $list_name . '"<br/><br/>' .
698-
__( 'Now you should either Turn On the Mailchimp Widget or change your options below, then turn it on.', 'mailchimp_i18n' ) . '</p>';
695+
__( 'Now you should either Turn On the Mailchimp Widget or change your options below, then turn it on.', 'mailchimp' ) . '</p>';
699696
mailchimp_sf_global_msg( $msg );
700697
}
701698
}
@@ -738,7 +735,7 @@ function mailchimp_sf_get_merge_vars( $list_id, $new_list ) {
738735
function mailchimp_sf_add_email_field( $merge ) {
739736
$email = array(
740737
'tag' => 'EMAIL',
741-
'name' => __( 'Email Address', 'mailchimp_i18n' ),
738+
'name' => __( 'Email Address', 'mailchimp' ),
742739
'type' => 'email',
743740
'required' => true,
744741
'public' => true,
@@ -896,10 +893,10 @@ function mailchimp_sf_signup_submit() {
896893
'<strong class="mc_error_msg">%s</strong>',
897894
wp_kses(
898895
sprintf(
899-
// translators: first placeholder is email address, second is url
896+
/* translators: 1: email address 2: url */
900897
__(
901898
'We encountered a problem adding %1$s to the list. Please <a href="%2$s">sign up here.</a>',
902-
'mailchimp_i18n'
899+
'mailchimp'
903900
),
904901
esc_html( $email ),
905902
esc_url( $url )
@@ -937,10 +934,10 @@ function mailchimp_sf_signup_submit() {
937934
}
938935

939936
if ( 'subscribed' === $retval['status'] ) {
940-
$esc = __( 'Success, you\'ve been signed up.', 'mailchimp_i18n' );
937+
$esc = __( 'Success, you\'ve been signed up.', 'mailchimp' );
941938
$msg = "<strong class='mc_success_msg'>{$esc}</strong>";
942939
} else {
943-
$esc = __( 'Success, you\'ve been signed up! Please look for our confirmation email.', 'mailchimp_i18n' );
940+
$esc = __( 'Success, you\'ve been signed up! Please look for our confirmation email.', 'mailchimp' );
944941
$msg = "<strong class='mc_success_msg'>{$esc}</strong>";
945942
}
946943

@@ -1044,8 +1041,8 @@ function mailchimp_sf_merge_submit( $mv ) {
10441041
}
10451042

10461043
if ( 'Y' === $mv_var['required'] && trim( $opt_val ) === '' ) {
1047-
// translators: placeholder is field name
1048-
$message = sprintf( __( 'You must fill in %s.', 'mailchimp_i18n' ), esc_html( $mv_var['name'] ) );
1044+
/* translators: %s: field name */
1045+
$message = sprintf( __( 'You must fill in %s.', 'mailchimp' ), esc_html( $mv_var['name'] ) );
10491046
$error = new WP_Error( 'missing_required_field', $message );
10501047
return $error;
10511048
} elseif ( 'EMAIL' !== $tag ) {
@@ -1076,8 +1073,8 @@ function mailchimp_sf_merge_validate_phone( $opt_val, $data ) {
10761073
}
10771074

10781075
if ( ! preg_match( '/[0-9]{0,3}-[0-9]{0,3}-[0-9]{0,4}/A', $opt_val ) ) {
1079-
// translators: placeholder is field name
1080-
$message = sprintf( __( '%s must consist of only numbers', 'mailchimp_i18n' ), esc_html( $data['name'] ) );
1076+
/* translators: %s: field name */
1077+
$message = sprintf( __( '%s must consist of only numbers', 'mailchimp' ), esc_html( $data['name'] ) );
10811078
$error = new WP_Error( 'mc_phone_validation', $message );
10821079
return $error;
10831080
}
@@ -1095,8 +1092,8 @@ function mailchimp_sf_merge_validate_phone( $opt_val, $data ) {
10951092
function mailchimp_sf_merge_validate_address( $opt_val, $data ) {
10961093
if ( 'Y' === $data['required'] ) {
10971094
if ( empty( $opt_val['addr1'] ) || empty( $opt_val['city'] ) ) {
1098-
// translators: placeholder is field name
1099-
$message = sprintf( __( 'You must fill in %s.', 'mailchimp_i18n' ), esc_html( $data['name'] ) );
1095+
/* translators: %s: field name */
1096+
$message = sprintf( __( 'You must fill in %s.', 'mailchimp' ), esc_html( $data['name'] ) );
11001097
$error = new WP_Error( 'invalid_address_merge', $message );
11011098
return $error;
11021099
}
@@ -1222,7 +1219,7 @@ function mailchimp_sf_verify_key( $api ) {
12221219
update_option( 'mc_datacenter', $api->datacenter );
12231220

12241221
} else {
1225-
$msg = __( 'API Key must belong to "Owner", "Admin", or "Manager."', 'mailchimp_i18n' );
1222+
$msg = __( 'API Key must belong to "Owner", "Admin", or "Manager."', 'mailchimp' );
12261223
return new WP_Error( 'mc-invalid-role', $msg );
12271224
}
12281225
}
@@ -1315,12 +1312,6 @@ function mailchimp_sf_where_am_i() {
13151312
// Define our complete filesystem path
13161313
define( 'MCSF_DIR', $mscf_dir );
13171314

1318-
/**
1319-
* Lang location needs to be relative *from* ABSPATH,
1320-
* so strip it out of our language dir location
1321-
*/
1322-
define( 'MCSF_LANG_DIR', trailingslashit( MCSF_DIR ) . 'po/' );
1323-
13241315
// Define our complete URL to the plugin folder
13251316
define( 'MCSF_URL', $mscf_url );
13261317
}

0 commit comments

Comments
 (0)