private static function get_language_plugin_list( $path ) {
		$languages = [];

		// Try to open the given directory.
		$handle = \opendir( $path );
		if ( false === $handle ) {
			// Abort.
			return $languages; // @codeCoverageIgnore
		}

		// Read all files in directory.
		$file = \readdir( $handle );
		while ( $file ) {
			// We only want the JSON files.
			if ( '.json' === \substr( $file, -5 ) ) {
				$file_content = \file_get_contents( $path . $file );
				if ( \preg_match( '/"language"\s*:\s*((".+")|(\'.+\'))\s*,/', $file_content, $matches ) ) {
					$language_name = \substr( $matches[1], 1, -1 );
					$language_code = \substr( $file, 0, -5 );

					$languages[ $language_code ] = $language_name;
				}
			}

			// Read next file.
			$file = \readdir( $handle );
		}
		\closedir( $handle );

		// Sort translated language names according to current locale.
		\asort( $languages );

		return $languages;
	}
private static function get_language_plugin_list( $path ) {
		$languages = [];

		// Try to open the given directory.
		$handle = \opendir( $path );
		if ( false === $handle ) {
			// Abort.
			return $languages; // @codeCoverageIgnore
		}

		// Read all files in directory.
		$file = \readdir( $handle );
		while ( $file ) {
			// We only want the JSON files.
			if ( '.json' === \substr( $file, -5 ) ) {
				$file_content = \file_get_contents( $path . $file );
				if ( \preg_match( '/"language"\s*:\s*((".+")|(\'.+\'))\s*,/', $file_content, $matches ) ) {
					$language_name = \substr( $matches[1], 1, -1 );
					$language_code = \substr( $file, 0, -5 );

					$languages[ $language_code ] = $language_name;
				}
			}

			// Read next file.
			$file = \readdir( $handle );
		}
		\closedir( $handle );

		// Sort translated language names according to current locale.
		\asort( $languages );

		return $languages;
	}
private static function get_language_plugin_list ( $ path ) { $ languages = [ ] ; // Try to open the given directory. $ handle = \ opendir ( $ path ) ; if ( false === $ handle ) { // Abort. return $ languages ; // @codeCoverageIgnore } // Read all files in directory. $ file = \ readdir ( $ handle ) ; while ( $ file ) { // We only want the JSON files. if ( '.json' === \ substr ( $ file , - 5 ) ) { $ file_content = \ file_get_contents ( $ path . $ file ) ; if ( \ preg_match ( '/"language"\s*:\s*((".+")|(\'.+\'))\s*,/' , $ file_content , $ matches ) ) { $ language_name = \ substr ( $ matches [ 1 ] , 1 , - 1 ) ; $ language_code = \ substr ( $ file , 0 , - 5 ) ; $ languages [ $ language_code ] = $ language_name ; } } // Read next file. $ file = \ readdir ( $ handle ) ; } \ closedir ( $ handle ) ; // Sort translated language names according to current locale. \ asort ( $ languages ) ; return $ languages ; }
Retrieves the list of valid language plugins in the given directory.

@param string $path The path in which to look for language plugin files.

@return string[] An array in the form ( $language_code => $language_name ).
Retrieves the list of valid language plugins in the given directory .