From a4f582c8e62da2c640e07371eab854172f93cfc9 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 25 Sep 2006 02:38:55 +0000 Subject: [PATCH] i18n fixes from nbachiyski. fixes #3109 git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4239 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/import/blogger.php | 44 ++--- wp-admin/import/dotclear.php | 8 +- wp-admin/import/greymatter.php | 313 ++++++++++++++++++++++++++++++++ wp-admin/import/livejournal.php | 2 +- wp-admin/import/mt.php | 34 ++-- wp-admin/import/rss.php | 2 +- wp-admin/import/textpattern.php | 6 +- wp-admin/post.php | 2 +- wp-includes/classes.php | 8 +- 9 files changed, 368 insertions(+), 51 deletions(-) diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index d35f84219c..90c72e7b84 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -135,13 +135,13 @@ class Blogger_Import { curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header); $response = curl_exec ($ch); - + if ($parse) { $response = $this->parse_response($response); $response['url'] = $url; return $response; } - + return $response; } @@ -210,7 +210,7 @@ class Blogger_Import { $this->import['blogs'][$_GET['blog']]['nextstep'] = $step; update_option('import-blogger', $this->import); } - + // Redirects to next step function do_next_step() { wp_redirect("admin.php?import=blogger&noheader=true&blog={$_GET['blog']}"); @@ -224,13 +224,13 @@ class Blogger_Import { if ( ! ( $_POST['user'] && $_POST['pass'] ) ) { $this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:').'

  1. '.__('Back up your Blogger template.').'
  2. '.__('Back up any other Blogger settings you might need later.').'
  3. '.__('Log out of Blogger').'
  4. '.__('Log in here with your Blogger username and password.').'
  5. '.__('On the next screen, click one of your Blogger blogs.').'
  6. '.__('Do not close this window or navigate away until the process is complete.').'
'); } - - // Try logging in. If we get an array of cookies back, we at least connected. + + // Try logging in. If we get an array of cookies back, we at least connected. $this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']); if ( !is_array( $this->import['cookies'] ) ) { $this->login_form(__('Login failed. Please enter your credentials again.')); } - + // Save the password so we can log the browser in when it's time to publish. $this->import['pass'] = $_POST['pass']; $this->import['user'] = $_POST['user']; @@ -341,7 +341,7 @@ class Blogger_Import { $form = "
"; $form.= $body; $form.= "
"; - $output.= '

'.sprintf('%s in progress, please wait...', $blog_opt)."

\n"; + $output.= '

'.sprintf(__('%s in progress, please wait...'), $blog_opt)."

\n"; } else { $output.= "

$blog_opt

\n"; } @@ -395,7 +395,7 @@ class Blogger_Import { update_option('import-blogger', $import); $archive = $this->get_blogger($url); if ( $archive['code'] > 200 ) - continue; + continue; $posts = explode('', $archive['body']); for ($i = 1; $i < count($posts); $i = $i + 1) { $postparts = explode('', $posts[$i]); @@ -409,7 +409,7 @@ class Blogger_Import { $post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3]; $post_author_name = $wpdb->escape(trim($postinfo[1])); $post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org'; - + if ( $this->lump_authors ) { // Ignore Blogger authors. Use the current user_ID for all posts imported. $post_author = $GLOBALS['user_ID']; @@ -420,7 +420,7 @@ class Blogger_Import { $user_email = $wpdb->escape($post_author_email); $user_password = substr(md5(uniqid(microtime())), 0, 6); $result = wp_create_user( $user_login, $user_password, $user_email ); - $status.= sprintf('Registered user %s.', $user_login); + $status.= sprintf(__('Registered user %s.'), $user_login); $this->import['blogs'][$_GET['blog']]['newusers'][] = $user_login; } $userdata = get_userdatabylogin( $post_author_name ); @@ -435,21 +435,21 @@ class Blogger_Import { $posthour = zeroise($post_date_His[0], 2); $postminute = zeroise($post_date_His[1], 2); $postsecond = zeroise($post_date_His[2], 2); - + if (($post_date[2] == 'PM') && ($posthour != '12')) $posthour = $posthour + 12; else if (($post_date[2] == 'AM') && ($posthour == '12')) $posthour = '00'; - + $post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond"; - + $post_content = addslashes($post_content); $post_content = str_replace(array('
','
','
','
','
','
'), "\n", $post_content); // the XHTML touch... ;) - + $post_title = addslashes($post_title); - + $post_status = 'publish'; - + if ( $ID = post_exists($post_title, '', $post_date) ) { $post_array[$i]['ID'] = $ID; $skippedpostcount++; @@ -509,7 +509,7 @@ class Blogger_Import { } } $status = sprintf(__('%s post(s) parsed, %s skipped...'), $postcount, $skippedpostcount).' '. - sprintf(__('%s comment(s) parsed, %s skipped...'), $commentcoun, $skippedcommentcount).' '. + sprintf(__('%s comment(s) parsed, %s skipped...'), $commentcount, $skippedcommentcount).' '. ' '.__('Done').''; $import = $this->import; $import['blogs'][$_GET['blog']]['archives']["$url"] = $status; @@ -546,7 +546,7 @@ class Blogger_Import { $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode={$optary['backup']['publishMode']}", $headers); sleep(2); if ( $response['code'] >= 400 ) - die('

Error restoring publishMode.

Please tell the devs.

' . addslashes(print_r($response, 1)) ); + die('

'.__('Error restoring publishMode').'

'.__('Please tell the devs.').'

' . addslashes(print_r($response, 1)) ); } } if ( $optary['backup'] != $optary['modify'] ) { @@ -597,11 +597,11 @@ class Blogger_Import { if ( $_GET['restart'] == 'true' ) { $this->restart(); } - + if ( isset($_GET['noheader']) ) { header('Content-Type: text/html; charset=utf-8'); - $this->import = get_settings('import-blogger'); + $this->import = get_option('import-blogger'); if ( false === $this->import ) { $step = 0; @@ -649,7 +649,7 @@ class Blogger_Import { break; } die; - + } else { $this->greet(); } @@ -662,6 +662,6 @@ class Blogger_Import { $blogger_import = new Blogger_Import(); -register_importer('blogger', 'Blogger', __('Import posts and comments from a Blogger account'), array ($blogger_import, 'start')); +register_importer('blogger', __('Blogger and Blogspot'), __('Import posts and comments from your Blogger account'), array ($blogger_import, 'start')); ?> diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php index b4f2cd3440..35ccad76f7 100644 --- a/wp-admin/import/dotclear.php +++ b/wp-admin/import/dotclear.php @@ -626,15 +626,15 @@ class Dotclear_Import { echo '

'.__('Preserving Authors').'

'; echo '

'.__('Secondly, we have attempted to preserve post authors. If you are the only author or contributor to your blog, then you are safe. In most cases, we are successful in this preservation endeavor. However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'

'; echo '

'.__('Textile').'

'; - echo '

'.__('Also, since you\'re coming from Dotclear, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing Textile for WordPress. Trust me... You\'ll want it.').'

'; + echo '

'.__('Also, since you\'re coming from Dotclear, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing Textile for WordPress. Trust me... You\'ll want it.').'

'; echo '

'.__('WordPress Resources').'

'; echo '

'.__('Finally, there are numerous WordPress resources around the internet. Some of them are:').'

'; echo ''; - echo '

'.sprintf(__('That\'s it! What are you waiting for? Go login!'), '/wp-login.php').'

'; + echo '

'.sprintf(__('That\'s it! What are you waiting for? Go login!'), '../wp-login.php').'

'; } function db_form() @@ -737,5 +737,5 @@ class Dotclear_Import { } $dc_import = new Dotclear_Import(); -register_importer('dotclear', 'Dotclear', __('Import posts from a Dotclear Blog'), array ($dc_import, 'dispatch')); +register_importer('dotclear', __('Dotclear'), __('Import posts from a Dotclear Blog'), array ($dc_import, 'dispatch')); ?> diff --git a/wp-admin/import/greymatter.php b/wp-admin/import/greymatter.php index e69de29bb2..42ead75af0 100644 --- a/wp-admin/import/greymatter.php +++ b/wp-admin/import/greymatter.php @@ -0,0 +1,313 @@ +'; + echo '

'.__('Import Greymatter').'

'; + } + + function footer() { + echo ''; + } + + function greet() { + $this->header(); +?> +

+

+
    +
  • +
  • If authors are found not to be in gm-authors.cgi, imports them at level 0.') ?>
  • +
  • +
+

+
    +
  • +
  • +
  • +
+

 

+ +
+ + +

+

+ + + + + + + + + + + + + + + +

so you need to enter the number of the last GM post here.
(if you don't know that number, just log into your FTP and look it out
in the entries' folder)") ?>
+

+

+
+

 

+footer(); + } + + + + function gm2autobr($string) { // transforms GM's |*| into b2's
\n + $string = str_replace("|*|","
\n",$string); + return($string); + } + + function import() { + global $wpdb; + + $wpvarstoreset = array('gmpath', 'archivespath', 'lastentry'); + for ($i=0; $iheader(); +?> +

+
    +
    • escape($userdata[0]); + $pass1=$wpdb->escape($userdata[1]); + $user_nickname=$wpdb->escape($userdata[0]); + $user_email=$wpdb->escape($userdata[2]); + $user_url=$wpdb->escape($userdata[3]); + $user_joindate=$wpdb->escape($user_joindate); + + $user_id = username_exists($user_login); + if ($user_id) { + printf('
    • '.__('user %s').''.__('Already exists').'
    • ', "$user_login"); + $this->gmnames[$userdata[0]] = $user_id; + continue; + } + + $user_info = array("user_login"=>"$user_login", "user_pass"=>"$pass1", "user_nickname"=>"$user_nickname", "user_email"=>"$user_email", "user_url"=>"$user_url", "user_ip"=>"$user_ip", "user_domain"=>"$user_domain", "user_browser"=>"$user_browser", "dateYMDhour"=>"$user_joindate", "user_level"=>"1", "user_idmode"=>"nickname"); + $user_id = wp_insert_user($user_info); + $this->gmnames[$userdata[0]] = $user_id; + + printf('
    • '.__('user %s...').' '.__('Done').'
    • ', "$user_login"); + } + +?>
  • +

    • gm2autobr($entry[2]); + $postmorecontent=$this->gm2autobr($entry[3]); + + $post_author=trim($wpdb->escape($postinfo[1])); + + $post_title=$this->gm2autobr($postinfo[2]); + printf('
    • '.__('entry # %s : %s : by %s'), $entryfile, $post_title, $postinfo[1]); + $post_title=$wpdb->escape($post_title); + + $postyear=$postinfo[6]; + $postmonth=zeroise($postinfo[4],2); + $postday=zeroise($postinfo[5],2); + $posthour=zeroise($postinfo[7],2); + $postminute=zeroise($postinfo[8],2); + $postsecond=zeroise($postinfo[9],2); + + if (($postinfo[10]=="PM") && ($posthour!="12")) + $posthour=$posthour+12; + + $post_date="$postyear-$postmonth-$postday $posthour:$postminute:$postsecond"; + + $post_content=$postmaincontent; + if (strlen($postmorecontent)>3) + $post_content .= "

      ".$postmorecontent; + $post_content=$wpdb->escape($post_content); + + $post_karma=$postinfo[12]; + + $post_status = 'publish'; //in greymatter, there are no drafts + $comment_status = 'open'; + $ping_status = 'closed'; + + if ($post_ID = post_exists($post_title, '', $post_date)) { + echo ' '; + _e('(already exists)'); + } else { + //just so that if a post already exists, new users are not created by checkauthor + // we'll check the author is registered, or if it's a deleted author + $user_id = username_exists($post_author); + if (!$user_id) { // if deleted from GM, we register the author as a level 0 user + $user_ip="127.0.0.1"; + $user_domain="localhost"; + $user_browser="server"; + $user_joindate="1979-06-06 00:41:00"; + $user_login=$wpdb->escape($post_author); + $pass1=$wpdb->escape("password"); + $user_nickname=$wpdb->escape($post_author); + $user_email=$wpdb->escape("user@deleted.com"); + $user_url=$wpdb->escape(""); + $user_joindate=$wpdb->escape($user_joindate); + + $user_info = array("user_login"=>$user_login, "user_pass"=>$pass1, "user_nickname"=>$user_nickname, "user_email"=>$user_email, "user_url"=>$user_url, "user_ip"=>$user_ip, "user_domain"=>$user_domain, "user_browser"=>$user_browser, "dateYMDhour"=>$user_joindate, "user_level"=>0, "user_idmode"=>"nickname"); + $user_id = wp_insert_user($user_info); + $this->gmnames[$postinfo[1]] = $user_id; + + echo ': '; + printf(__('registered deleted user %s at level 0 '), "$user_login"); + } + + if (array_key_exists($postinfo[1], $this->gmnames)) { + $post_author = $this->gmnames[$postinfo[1]]; + } else { + $post_author = $user_id; + } + + $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt'); + $post_ID = wp_insert_post($postdata); + } + + $c=count($entry); + if ($c>4) { + $numAddedComments = 0; + $numComments = 0; + for ($j=4;$j<$c;$j++) { + $entry[$j]=$this->gm2autobr($entry[$j]); + $commentinfo=explode("|",$entry[$j]); + $comment_post_ID=$post_ID; + $comment_author=$wpdb->escape($commentinfo[0]); + $comment_author_email=$wpdb->escape($commentinfo[2]); + $comment_author_url=$wpdb->escape($commentinfo[3]); + $comment_author_IP=$wpdb->escape($commentinfo[1]); + + $commentyear=$commentinfo[7]; + $commentmonth=zeroise($commentinfo[5],2); + $commentday=zeroise($commentinfo[6],2); + $commenthour=zeroise($commentinfo[8],2); + $commentminute=zeroise($commentinfo[9],2); + $commentsecond=zeroise($commentinfo[10],2); + if (($commentinfo[11]=="PM") && ($commenthour!="12")) + $commenthour=$commenthour+12; + $comment_date="$commentyear-$commentmonth-$commentday $commenthour:$commentminute:$commentsecond"; + + $comment_content=$wpdb->escape($commentinfo[12]); + + if (!comment_exists($comment_author, $comment_date)) { + $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_approved'); + $commentdata = wp_filter_comment($commentdata); + wp_insert_comment($commentdata); + $numAddedComments++; + } + $numComments++; + } + if ($numAddedComments > 0) { + echo ': '; + printf(__('imported %d comment(s)'), $numAddedComments); + } + $preExisting = $numComments - numAddedComments; + if ($preExisting > 0) { + echo ' '; + printf(__('ignored %d pre-existing comments'), $preExisting); + } + } + echo '... '.__('Done').'
    • '; + } + } + ?> +
+

 

+

+footer(); + } + + function dispatch() { + if (empty ($_GET['step'])) + $step = 0; + else + $step = (int) $_GET['step']; + + switch ($step) { + case 0 : + $this->greet(); + break; + case 1: + $this->import(); + break; + } + } + + function GM_Import() { + // Nothing. + } +} + +$gm_import = new GM_Import(); + +register_importer('greymatter', __('Greymatter'), __('Import posts and comments from your Greymatter blog'), array ($gm_import, 'dispatch')); +?> diff --git a/wp-admin/import/livejournal.php b/wp-admin/import/livejournal.php index e8c48c4ad9..520bb9c2e2 100644 --- a/wp-admin/import/livejournal.php +++ b/wp-admin/import/livejournal.php @@ -167,5 +167,5 @@ class LJ_Import { $livejournal_import = new LJ_Import(); -register_importer('livejournal', 'LiveJournal', __('Import posts from LiveJournal'), array ($livejournal_import, 'dispatch')); +register_importer('livejournal', __('LiveJournal'), __('Import posts from LiveJournal'), array ($livejournal_import, 'dispatch')); ?> diff --git a/wp-admin/import/mt.php b/wp-admin/import/mt.php index e5b6626122..4d608f7f3c 100644 --- a/wp-admin/import/mt.php +++ b/wp-admin/import/mt.php @@ -11,7 +11,7 @@ class MT_Import { function header() { echo '
'; - echo '

'.__('Import Movable Type').'

'; + echo '

'.__('Import Movable Type and Typepad').'

'; } function footer() { @@ -32,7 +32,7 @@ class MT_Import { global $wpdb, $testing; $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID"); ?>'; + echo '
  • '.__('Current author:').' '.$author.'
    '.sprintf(__('Create user %1$s or map to existing'), '
    '); $this->users_form($j); echo '
  • '; } - echo ''.'
    '; + echo ''.'
    '; echo ''; - echo ''; + echo '
    '; - flush(); } function select_authors() { $file = wp_import_handle_upload(); if ( isset($file['error']) ) { - echo $file['error']; + $this->header(); + echo '

    '.__('Sorry, there has been an error').'.

    '; + echo '

    ' . $file['error'] . '

    '; + $this->footer(); return; } $this->file = $file['file']; @@ -174,7 +178,7 @@ class MT_Import { function process_posts() { global $wpdb; $i = -1; - echo "
      "; + echo "
        "; foreach ($this->posts as $post) { if ('' != trim($post)) { ++ $i; @@ -330,7 +334,7 @@ class MT_Import { } } if ( $num_comments ) - printf(__('(%s comments)'), $num_comments); + printf(' '.__('(%s comments)'), $num_comments); // Finally the pings // fix the double newline on the first one @@ -378,22 +382,22 @@ class MT_Import { } } if ( $num_pings ) - printf(__('(%s pings)'), $num_pings); - + printf(' '.__('(%s pings)'), $num_pings); + echo ""; } - flush(); } echo '
      '; wp_import_cleanup($this->id); - echo '

      '.sprintf(__('All done. Have fun!'), get_option('home')).'

      '; + echo '

      '.sprintf(__('All done. Have fun!'), get_option('home')).'

      '; } function import() { $this->id = (int) $_GET['id']; + $this->file = get_attached_file($this->id); $this->get_authors_from_post(); $this->get_entries(); @@ -420,11 +424,11 @@ class MT_Import { } function MT_Import() { - // Nothing. + // Nothing. } } $mt_import = new MT_Import(); -register_importer('mt', 'Movable Type', __('Import posts and comments from your Movable Type blog'), array ($mt_import, 'dispatch')); +register_importer('mt', __('Movable Type and Typepad'), __('Imports posts and comments from your Movable Type or Typepad blog'), array ($mt_import, 'dispatch')); ?> diff --git a/wp-admin/import/rss.php b/wp-admin/import/rss.php index 440d840d52..c695cbd7d6 100644 --- a/wp-admin/import/rss.php +++ b/wp-admin/import/rss.php @@ -168,5 +168,5 @@ class RSS_Import { $rss_import = new RSS_Import(); -register_importer('rss', 'RSS', __('Import posts from an RSS feed'), array ($rss_import, 'dispatch')); +register_importer('rss', __('RSS'), __('Import posts from an RSS feed'), array ($rss_import, 'dispatch')); ?> diff --git a/wp-admin/import/textpattern.php b/wp-admin/import/textpattern.php index 44b0fc3675..31140d5e20 100644 --- a/wp-admin/import/textpattern.php +++ b/wp-admin/import/textpattern.php @@ -555,12 +555,12 @@ class Textpattern_Import { echo '

      '.__('Preserving Authors').'

      '; echo '

      '.__('Secondly, we have attempted to preserve post authors. If you are the only author or contributor to your blog, then you are safe. In most cases, we are successful in this preservation endeavor. However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'

      '; echo '

      '.__('Textile').'

      '; - echo '

      '.__('Also, since you\'re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing Textile for WordPress. Trust me... You\'ll want it.').'

      '; + echo '

      '.__('Also, since you\'re coming from Textpattern, you probably have been using Textile to format your comments and posts. If this is the case, we recommend downloading and installing Textile for WordPress. Trust me... You\'ll want it.').'

      '; echo '

      '.__('WordPress Resources').'

      '; echo '

      '.__('Finally, there are numerous WordPress resources around the internet. Some of them are:').'

      '; echo ''; echo '

      '.sprintf(__('That\'s it! What are you waiting for? Go login!'), '/wp-login.php').'

      '; @@ -659,5 +659,5 @@ class Textpattern_Import { } $txp_import = new Textpattern_Import(); -register_importer('textpattern', 'Textpattern', __('Import posts from a Textpattern Blog'), array ($txp_import, 'dispatch')); +register_importer('textpattern', __('Textpattern'), __('Import posts from a Textpattern Blog'), array ($txp_import, 'dispatch')); ?> diff --git a/wp-admin/post.php b/wp-admin/post.php index a427d321e2..0126b6d2df 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -81,7 +81,7 @@ case 'edit': ?>

      - +

      $cnt comment"; - if ($cnt != 1 ) echo "s"; - echo " moved to the moderation queue.

      \n"; + echo "

      "; + printf(__('%d comment(s) moved to the moderation queue.'), $cnt); + echo "

      \n"; } // End function move_spam function find_spam() { @@ -853,7 +853,7 @@ class retrospam_mgr { $numfound = count($counters[found]); $numqueue = $counters[in_queue]; - $body = '

      ' . sprintf(__('Suspected spam comments: %s'), $numfound) . '

      '; + $body = '

      ' . sprintf(__('Suspected spam comments: %s'), "$numfound") . '

      '; if ( count($counters[found]) > 0 ) { $id_list = implode( ',', $counters[found] );