<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12766] sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-stats.php: Translate: Add the stats for the different translation sources</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/12766">12766</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/12766","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>amieiro</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-08-01 14:58:10 +0000 (Tue, 01 Aug 2023)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Translate: Add the stats for the different translation sources</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggpcustomizationsinccliclassstatsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-stats.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggpcustomizationsinccliclassstatsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-stats.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-stats.php  2023-07-28 15:17:38 UTC (rev 12765)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-stats.php    2023-08-01 14:58:10 UTC (rev 12766)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -120,6 +120,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        private string $header                           = '';
</span><span class="cx" style="display: block; padding: 0 10px">        private string $originals_by_year                = '';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        private string $originals_by_translation_source  = '';
</ins><span class="cx" style="display: block; padding: 0 10px">         private string $translations_translators_by_year = '';
</span><span class="cx" style="display: block; padding: 0 10px">        private string $forum_post_and_replies_by_year   = '';
</span><span class="cx" style="display: block; padding: 0 10px">        private string $wordpress_translation_percentage = '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -145,6 +146,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">        private bool $echo_the_values = false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * The id of the blog where the stats are stored.
+        *
+        * @var int
+        */
+       private const MAKE_POLYGLOTS_BLOG_ID = 19;
+
+       /**
+        * The id of the page where the stats are stored.
+        *
+        * @var int
+        */
+       private const POLYGLOTS_PAGE_ID = 42132;
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Prints the Polyglots stats or stores them on a page.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param bool $echo_the_values Whether it should print the info in the CLI or stores it on a page.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -160,13 +175,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                define( 'MAKE_POLYGLOTS_BLOG_ID', 19 );
-               define( 'POLYGLOTS_PAGE_ID', 42132 );
-
</del><span class="cx" style="display: block; padding: 0 10px">                 $this->echo_the_values = $echo_the_values;
</span><span class="cx" style="display: block; padding: 0 10px">                $this->set_number_of_years_with_data();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->print_header();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->print_stats_comparison( gmdate( 'Y-m-d' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->print_wordpress_translation_percentage();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->print_stats_for_translation_sources();
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->print_packages_generated();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->print_unique_themes_plugins_by_year();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->print_originals_natural_year();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -177,7 +191,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->print_managers_stats();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->print_most_active_translators();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->store_stats();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->print_stats_comparison( gmdate( 'Y-m-d' ) );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->update_page();
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -239,7 +252,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private function get_locale_requests() {
</span><span class="cx" style="display: block; padding: 0 10px">                $locale_requests = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                switch_to_blog( MAKE_POLYGLOTS_BLOG_ID );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         switch_to_blog( self::MAKE_POLYGLOTS_BLOG_ID );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $args                     = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_type'   => 'post',
</span><span class="cx" style="display: block; padding: 0 10px">                        'tag'         => 'locale-requests',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -281,7 +294,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private function get_editor_requests() {
</span><span class="cx" style="display: block; padding: 0 10px">                $editor_requests = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                switch_to_blog( MAKE_POLYGLOTS_BLOG_ID );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         switch_to_blog( self::MAKE_POLYGLOTS_BLOG_ID );
</ins><span class="cx" style="display: block; padding: 0 10px">                 register_taxonomy(
</span><span class="cx" style="display: block; padding: 0 10px">                        'p2_resolved',
</span><span class="cx" style="display: block; padding: 0 10px">                        'post',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -942,14 +955,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $feedback_posts_args = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'posts_per_page' => - 1,
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_status'    => 'publish',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'post_type'      => $this::FEEDBACK_POST_TYPE,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'post_type'      => self::FEEDBACK_POST_TYPE,
</ins><span class="cx" style="display: block; padding: 0 10px">                         'date_query'     => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                array( 'after' => '2022-07-28' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $feedback_posts_count = $wpdb->get_var( $wpdb->prepare(
-                       "SELECT COUNT(*) FROM $wpdb->posts WHERE post_status='publish' AND post_type=%s AND post_date > %s", $this::FEEDBACK_POST_TYPE, '2022-07-28'
-               ));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $feedback_posts_count = $wpdb->get_var(
+                       $wpdb->prepare(
+                               "SELECT COUNT(*) FROM $wpdb->posts WHERE post_status='publish' AND post_type=%s AND post_date > %s",
+                               self::FEEDBACK_POST_TYPE,
+                               '2022-07-28'
+                       )
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $original_strings_with_comments = number_format_i18n( $feedback_posts_count );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Get the total number of comments.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -957,7 +974,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        get_comments(
</span><span class="cx" style="display: block; padding: 0 10px">                                array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'number'     => - 1,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'post_type'  => $this::FEEDBACK_POST_TYPE,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'post_type'  => self::FEEDBACK_POST_TYPE,
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'count'      => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                        'date_query' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                                array( 'after' => '2022-07-28' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -969,9 +986,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Get some info related with the status of the translations who get feedback.
</span><span class="cx" style="display: block; padding: 0 10px">                // First, get the comments related with a translation, because we can get comments related
</span><span class="cx" style="display: block; padding: 0 10px">                // only with the original.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $comment_meta_translation_ids = $wpdb->get_col( $wpdb->prepare(
-                       "SELECT cm.meta_value FROM $wpdb->commentmeta cm, $wpdb->comments c, $wpdb->posts p WHERE p.post_status='publish' AND p.post_type=%s AND p.post_date > %s AND cm.meta_key = 'translation_id' AND c.comment_post_id = p.id AND cm.comment_id = c.comment_id", $this::FEEDBACK_POST_TYPE, '2022-07-28'
-               ));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $comment_meta_translation_ids = $wpdb->get_col(
+                       $wpdb->prepare(
+                               "SELECT cm.meta_value FROM $wpdb->commentmeta cm, $wpdb->comments c, $wpdb->posts p WHERE p.post_status='publish' AND p.post_type=%s AND p.post_date > %s AND cm.meta_key = 'translation_id' AND c.comment_post_id = p.id AND cm.comment_id = c.comment_id",
+                               self::FEEDBACK_POST_TYPE,
+                               '2022-07-28'
+                       )
+               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Check all comments with a related translation.
</span><span class="cx" style="display: block; padding: 0 10px">                foreach ( $comment_meta_translation_ids as $comment_meta_translation_id ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1015,9 +1036,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Get most active commenter's.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $comment_user_ids = $wpdb->get_col( $wpdb->prepare(
-                       "SELECT c.user_id FROM $wpdb->comments c, $wpdb->posts p WHERE p.post_status='publish' AND p.post_type=%s AND p.post_date > %s AND c.comment_post_id = p.id", $this::FEEDBACK_POST_TYPE, '2022-07-28'
-               ));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $comment_user_ids = $wpdb->get_col(
+                       $wpdb->prepare(
+                               "SELECT c.user_id FROM $wpdb->comments c, $wpdb->posts p WHERE p.post_status='publish' AND p.post_type=%s AND p.post_date > %s AND c.comment_post_id = p.id",
+                               self::FEEDBACK_POST_TYPE,
+                               '2022-07-28'
+                       )
+               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $commenters_with_comment_count = array_count_values( $comment_user_ids );
</span><span class="cx" style="display: block; padding: 0 10px">                arsort( $commenters_with_comment_count );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1171,6 +1196,138 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Print the stats for translation sources.
+        *
+        * @return void
+        */
+       private function print_stats_for_translation_sources(): void {
+               global $wpdb;
+               // Source used: frontend, file import, playground
+               $originals = $wpdb->get_results(
+                       "SELECT 
+                       meta_key, 
+                       meta_value, 
+                       count(*) as number_of_strings 
+                       FROM `translate_meta` 
+                       WHERE 
+                           object_type = 'translation' 
+                               AND meta_key = 'source' 
+                           AND meta_value <> '' 
+                       GROUP BY 
+                           meta_key, 
+                           meta_value 
+                       ORDER BY 
+                           `translate_meta`.
+                           `meta_key` ASC, 
+                           count(*) desc
+                       "
+               );
+               if ( ! $this->echo_the_values ) {
+                       $this->originals_by_translation_source = $this->create_gutenberg_heading( 'Number of translations by translation source (starting on 2023-06-30)' );
+               } else {
+                       $this->print_wpcli_heading( 'Number of translations by translation source (starting on 2023-06-30)' );
+               }
+               $code  = "Source \t\t\t\t Number of strings" . PHP_EOL;
+               $code .= '................................................................' . PHP_EOL;
+
+               foreach ( $originals as $original ) {
+                       $code .= str_pad( ucfirst( $original->meta_value ), 15 ) . " \t\t " . str_pad( number_format_i18n( $original->number_of_strings ), 15, ' ', STR_PAD_LEFT ) . PHP_EOL;
+               }
+               $code .= PHP_EOL;
+
+               if ( ! $this->echo_the_values ) {
+                       $this->originals_by_translation_source .= $this->create_gutenberg_code( $code );
+               } else {
+                       WP_CLI::log( $code );
+               }
+
+               // Suggestion used: TM, OpenAI, DeepL, undefined.
+               $suggestions = $wpdb->get_results(
+                       "SELECT 
+                       meta_key, 
+                       meta_value, 
+                       count(*) as number_of_strings 
+                       FROM `translate_meta` 
+                       WHERE 
+                           object_type = 'translation' 
+                               AND meta_key = 'suggestion_used' 
+                           AND 
+                       (meta_value LIKE 'tm%' 
+                     OR meta_value LIKE 'openai%'
+                     OR meta_value LIKE 'deepl%')  
+                       GROUP BY 
+                           meta_key, 
+                           meta_value 
+                       ORDER BY 
+                           `translate_meta`.
+                           `meta_key` ASC, 
+                           count(*) desc
+                       "
+               );
+               if ( ! $this->echo_the_values ) {
+                       $this->originals_by_translation_source .= $this->create_gutenberg_heading( 'Number of translations by suggestion source (starting on 2023-06-30)' );
+               } else {
+                       $this->print_wpcli_heading( 'Number of translations by suggestion source (starting on 2023-06-30)' );
+               }
+               $code  = "Source \t\t\t\t Number of strings" . PHP_EOL;
+               $code .= '................................................................' . PHP_EOL;
+
+               foreach ( $suggestions as $suggestion ) {
+                       $code .= str_pad( $suggestion->meta_value, 15 ) . " \t\t " . str_pad( number_format_i18n( $suggestion->number_of_strings ), 15, ' ', STR_PAD_LEFT ) . PHP_EOL;
+               }
+               $code .= PHP_EOL;
+
+               if ( ! $this->echo_the_values ) {
+                       $this->originals_by_translation_source .= $this->create_gutenberg_code( $code );
+               } else {
+                       WP_CLI::log( $code );
+               }
+
+               // Suggestion from other languages.
+               $suggestions_ol = $wpdb->get_results(
+                       "SELECT 
+                       meta_key, 
+                       meta_value, 
+                       count(*) as number_of_strings 
+                       FROM `translate_meta` 
+                       WHERE 
+                           object_type = 'translation' 
+                               AND meta_key = 'suggestion_used' 
+                           AND 
+                       NOT (meta_value LIKE 'tm%' 
+                     OR meta_value LIKE 'undefined%' 
+                     OR meta_value LIKE 'openai%'
+                     OR meta_value LIKE 'deepl%')  
+                       GROUP BY 
+                           meta_key, 
+                           meta_value 
+                       ORDER BY 
+                           `translate_meta`.
+                           `meta_key` ASC, 
+                           count(*) desc
+                       "
+               );
+               if ( ! $this->echo_the_values ) {
+                       $this->originals_by_translation_source .= $this->create_gutenberg_heading( 'Number of translations suggested from another language (starting on 2023-06-30)' );
+               } else {
+                       $this->print_wpcli_heading( 'Number of translations suggested from another language (starting on 2023-06-30)' );
+               }
+               $code  = "Language \t\t\t\t Number of strings" . PHP_EOL;
+               $code .= '................................................................' . PHP_EOL;
+
+               foreach ( $suggestions_ol as $suggestion ) {
+                       $code .= str_pad( $suggestion->meta_value, 15 ) . " \t\t " . str_pad( number_format_i18n( $suggestion->number_of_strings ), 15, ' ', STR_PAD_LEFT ) . PHP_EOL;
+               }
+               $code .= PHP_EOL;
+
+               if ( ! $this->echo_the_values ) {
+                       $this->originals_by_translation_source .= $this->create_gutenberg_code( $code );
+               } else {
+                       WP_CLI::log( $code );
+               }
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Get the locales at DotOrg.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $locale_slug Locale slug.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1495,7 +1652,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                        'wp_revisions_to_keep',
</span><span class="cx" style="display: block; padding: 0 10px">                        function ( $num, $post ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( POLYGLOTS_PAGE_ID === $post->ID ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( self::POLYGLOTS_PAGE_ID === $post->ID ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $num = 0; // pretend we don't want to keep revisions so that it will not lookup all old revisions.
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1504,11 +1661,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        10,
</span><span class="cx" style="display: block; padding: 0 10px">                        2
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                switch_to_blog( MAKE_POLYGLOTS_BLOG_ID );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         switch_to_blog( self::MAKE_POLYGLOTS_BLOG_ID );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                wp_update_post(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'ID'           => POLYGLOTS_PAGE_ID,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'ID'           => self::POLYGLOTS_PAGE_ID,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'post_type'    => 'page',
</span><span class="cx" style="display: block; padding: 0 10px">                                'post_author'  => 'Amieiro',
</span><span class="cx" style="display: block; padding: 0 10px">                                'post_content' => $this->get_polyglots_stats_page_content(),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1527,6 +1684,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return $this->header .
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->stats_comparison .
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->wordpress_translation_percentage .
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        $this->originals_by_translation_source .
</ins><span class="cx" style="display: block; padding: 0 10px">                         $this->originals_by_year .
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->packages_generated_by_year .
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->themes_plugins_by_year .
</span></span></pre>
</div>
</div>

</body>
</html>