Index: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-i18n.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-i18n.php	(revision 5266)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-i18n.php	(working copy)
@@ -464,6 +464,78 @@
 			}
 		}
 
+		$locale_sites = $this->get_locale_sites();
+
+		foreach ( $locales as $key => $locale ) {
+			if ( isset( $locale_sites[ $locale->wp_locale ] ) ) {
+				$locale->subdomain = $locale_sites[ $locale->wp_locale ]->subdomain;
+			} else {
+				unset( $locales[ $key ] );
+			}
+		}
+
 		return $locales;
 	}
+
+	/**
+	 * Returns a list of locale sites.
+	 *
+	 * @return array
+	 */
+	public function get_locale_sites() {
+		wp_cache_add_global_groups( array( 'locale-associations' ) );
+
+		if ( false === ( $sites = wp_cache_get( 'local-sites', 'locale-associations' ) ) ) {
+			global $wpdb;
+
+			$sites = $wpdb->get_results( 'SELECT locale, subdomain FROM locales', OBJECT_K );
+			if ( ! $sites ) {
+				return;
+			}
+
+			require_once GLOTPRESS_LOCALES_PATH;
+
+			foreach ( $sites as $site ) {
+				$gp_locale = \GP_Locales::by_field( 'wp_locale', $site->locale );
+				if ( ! $gp_locale ) {
+					unset( $sites[ $site->locale ] );
+					continue;
+				}
+
+				$hreflang = false;
+
+				// Note that Google only supports ISO 639-1 codes.
+				if ( isset( $gp_locale->lang_code_iso_639_1 ) && isset( $gp_locale->country_code ) ) {
+					$hreflang = $gp_locale->lang_code_iso_639_1 . '-' . $gp_locale->country_code;
+				} elseif ( isset( $gp_locale->lang_code_iso_639_1 ) ) {
+					$hreflang = $gp_locale->lang_code_iso_639_1;
+				} elseif ( isset( $gp_locale->lang_code_iso_639_2 ) ) {
+					$hreflang = $gp_locale->lang_code_iso_639_2;
+				} elseif ( isset( $gp_locale->lang_code_iso_639_3 ) ) {
+					$hreflang = $gp_locale->lang_code_iso_639_3;
+				}
+
+				if ( $hreflang && 'art' !== $hreflang ) {
+					$sites[ $site->locale ]->hreflang = strtolower( $hreflang );
+				} else {
+					unset( $sites[ $site->locale ] );
+				}
+			}
+
+			// Add en_US to the list of sites.
+			$sites['en_US'] = (object) array(
+				'locale'    => 'en_US',
+				'hreflang'  => 'en',
+				'subdomain' => ''
+			);
+
+			uasort( $sites, function( $a, $b ) {
+				return strcasecmp( $a->hreflang, $b->hreflang );
+			} );
+
+			wp_cache_set( 'local-sites', $sites, 'locale-associations' );
+		}
+
+		return $sites;
+	}
 }
Index: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-developers.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-developers.php	(revision 5266)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-developers.php	(working copy)
@@ -34,7 +34,7 @@
 
 		if ( ! empty( $locales ) ) {
 			$locales_list = implode( ', ', array_map( function( $locale ) use ( $slug ) {
-				return sprintf( '<a href="%1$s">%2$s</a>', esc_url( "{$locale->locale}.wordpress.org/plugins/{$slug}/" ), $locale->name );
+				return sprintf( '<a href="%1$s">%2$s</a>', esc_url( "https://{$locale->subdomain}.wordpress.org/plugins/{$slug}/" ), $locale->name );
 			}, $locales ) );
 			/* Translators: 1: Plugin name; 2: Number of locales; 3: List of locales; */
 			$output .= sprintf( '%1$s has been translated into these %2$d locales: %3$s.', $title, count( $locales ), $locales_list ) . ' ';
Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php	(revision 5266)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php	(working copy)
@@ -245,57 +245,10 @@
  * @link https://sites.google.com/site/webmasterhelpforum/en/faq-internationalisation FAQ: Internationalisation.
  */
 function hreflang_link_attributes() {
-	wp_cache_add_global_groups( array( 'locale-associations' ) );
-
-	if ( false === ( $sites = wp_cache_get( 'local-sites', 'locale-associations' ) ) ) {
-		global $wpdb;
-
-		$sites = $wpdb->get_results( 'SELECT locale, subdomain FROM locales', OBJECT_K );
-		if ( ! $sites ) {
-			return;
-		}
-
-		require_once GLOTPRESS_LOCALES_PATH;
-
-		foreach ( $sites as $site ) {
-			$gp_locale = \GP_Locales::by_field( 'wp_locale', $site->locale );
-			if ( ! $gp_locale ) {
-				unset( $sites[ $site->locale ] );
-				continue;
-			}
-
-			$hreflang = false;
-
-			// Note that Google only supports ISO 639-1 codes.
-			if ( isset( $gp_locale->lang_code_iso_639_1 ) && isset( $gp_locale->country_code ) ) {
-				$hreflang = $gp_locale->lang_code_iso_639_1 . '-' . $gp_locale->country_code;
-			} elseif ( isset( $gp_locale->lang_code_iso_639_1 ) ) {
-				$hreflang = $gp_locale->lang_code_iso_639_1;
-			} elseif ( isset( $gp_locale->lang_code_iso_639_2 ) ) {
-				$hreflang = $gp_locale->lang_code_iso_639_2;
-			} elseif ( isset( $gp_locale->lang_code_iso_639_3 ) ) {
-				$hreflang = $gp_locale->lang_code_iso_639_3;
-			}
-
-			if ( $hreflang && 'art' !== $hreflang ) {
-				$sites[ $site->locale ]->hreflang = strtolower( $hreflang );
-			} else {
-				unset( $sites[ $site->locale ] );
-			}
-		}
-
-		// Add en_US to the list of sites.
-		$sites['en_US'] = (object) array(
-			'locale'    => 'en_US',
-			'hreflang'  => 'en',
-			'subdomain' => ''
-		);
-
-		uasort( $sites, function( $a, $b ) {
-			return strcasecmp( $a->hreflang, $b->hreflang );
-		} );
-
-		wp_cache_set( 'local-sites', $sites, 'locale-associations' );
+	if ( class_exists( '\WordPressdotorg\Plugin_Directory\Plugin_I18n' ) ) {
+		$sites = \WordPressdotorg\Plugin_Directory\Plugin_I18n::instance()->get_locale_sites();
+	} else {
+		$sites = array();
 	}
 
 	foreach ( $sites as $site ) {
