Permalink
Browse files

localize JS error strings

  • Loading branch information...
1 parent 93bf354 commit b08111be36ce9ec159e2d559b652684f0e6b10f3 @alexkingorg alexkingorg committed Apr 28, 2012
Showing with 7 additions and 2 deletions.
  1. +2 −2 assets/admin.js
  2. +5 −0 social.php
View
4 assets/admin.js
@@ -32,9 +32,9 @@
$('input[name=source_url]').removeAttr('disabled').val('');
$this.removeAttr('disabled');
if (response == 'protected') {
- $('#social-import-error').html('Protected Tweet').fadeIn();
+ $('#social-import-error').html(socialAdminL10n.protectedTweet).fadeIn();
} else if (response == 'invalid') {
- $('#social-import-error').html('Invalid URL.').fadeIn();
+ $('#social-import-error').html(socialAdminL10n.invalidUrl).fadeIn();
} else {
$('#aggregation_log').hide().html(response).find('.parent:not(:first)').hide().end().fadeIn();
}
View
5 social.php
@@ -427,6 +427,11 @@ public function admin_enqueue_assets() {
if (SOCIAL_ADMIN_JS !== false) {
wp_enqueue_script('social_admin', SOCIAL_ADMIN_JS, array(), Social::$version, true);
+ $data = apply_filters('social_admin_js_strings', array(
+ 'protectedTweet' => __('Protected Tweet', 'social'),
+ 'invalidUrl' => __('Invalid URL', 'social'),
+ ));
+ wp_localize_script('social_admin', 'socialAdminL10n', $data);
}
}

0 comments on commit b08111b

Please sign in to comment.