Index: src/wp-includes/l10n.php
===================================================================
--- src/wp-includes/l10n.php	(revision 30340)
+++ src/wp-includes/l10n.php	(working copy)
@@ -744,26 +744,34 @@
 }
 
 /**
- * Get all available languages based on the presence of *.mo files in a given directory.
+ * Get all available core languages based on the presence of *.mo/*.po files in
+ * a given directory.
  *
  * The default directory is WP_LANG_DIR.
  *
  * @since 3.0.0
  *
+ * @see wp_get_installed_translations()
+ *
  * @param string $dir A directory to search for language files.
  *                    Default WP_LANG_DIR.
- * @return array An array of language codes or an empty array if no languages are present. Language codes are formed by stripping the .mo extension from the language file names.
+ * @return array An array of language codes or an empty array if no languages are present.
+ *               Language codes are formed by stripping the extension from the language file names.
  */
 function get_available_languages( $dir = null ) {
-	$languages = array();
+	$translations = wp_get_installed_translations( 'core', $dir );
 
-	foreach( (array)glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' ) as $lang_file ) {
-		$lang_file = basename($lang_file, '.mo');
-		if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
-			0 !== strpos( $lang_file, 'admin-' ))
-			$languages[] = $lang_file;
+	if ( empty( $translations['default'] ) || empty( $translations['admin'] ) ) {
+		return array();
 	}
 
+	$languages = array();
+	foreach ( $translations['default'] as $language => $data ) {
+		if ( ! empty ( $translations['admin'][ $language ] ) ) {
+			$languages[] = $language;
+		}
+	}
+
 	return $languages;
 }
 
@@ -775,24 +783,29 @@
  *
  * @since 3.7.0
  *
- * @param string $type What to search for. Accepts 'plugins', 'themes', 'core'.
+ * @param string $type     What to search for. Accepts 'plugins', 'themes', 'core'.
+ * @param string $lang_dir A directory to search for language files. Default WP_LANG_DIR.
  * @return array Array of language data.
  */
-function wp_get_installed_translations( $type ) {
+function wp_get_installed_translations( $type, $lang_dir = null ) {
 	if ( $type !== 'themes' && $type !== 'plugins' && $type !== 'core' )
 		return array();
 
+	$lang_dir = is_null( $lang_dir ) ? WP_LANG_DIR : $lang_dir;
 	$dir = 'core' === $type ? '' : "/$type";
 
-	if ( ! is_dir( WP_LANG_DIR ) )
+	if ( ! is_dir( $lang_dir ) ) {
 		return array();
+	}
 
-	if ( $dir && ! is_dir( WP_LANG_DIR . $dir ) )
+	if ( $dir && ! is_dir( $lang_dir . $dir ) ) {
 		return array();
+	}
 
-	$files = scandir( WP_LANG_DIR . $dir );
-	if ( ! $files )
+	$files = scandir( $lang_dir . $dir );
+	if ( ! $files ) {
 		return array();
+	}
 
 	$language_data = array();
 
@@ -814,7 +827,12 @@
 		if ( '' === $textdomain ) {
 			$textdomain = 'default';
 		}
-		$language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "$dir/$file" );
+
+		if ( 'core' === $type && ! in_array( $textdomain, array( 'default', 'admin', 'admin-network', 'continents-cities' ) ) ) {
+			continue;
+		}
+
+		$language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( $lang_dir . "$dir/$file" );
 	}
 	return $language_data;
 }
