Created
September 18, 2019 22:44
-
-
Save felipeelia/f5437e549d29fd81be712ce47f10aadb to your computer and use it in GitHub Desktop.
List the percentage of usage of WordPress installs per locale
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$locales = file_get_contents( 'https://api.wordpress.org/stats/locale/1.0/' ); | |
$locales = json_decode( $locales, true ); | |
arsort( $locales ); | |
$others = ''; | |
$index = 1; | |
foreach ( $locales as $locale => $value ) { | |
if ( 'Others' === $locale ) { | |
$others = $value; | |
continue; | |
} | |
echo $index++ . " - {$locale}: {$value}%\n"; | |
} | |
if ( ! empty( $others ) ) { | |
echo "\nOthers: {$others}%"; | |
} | |
echo "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment