Skip to content

Instantly share code, notes, and snippets.

@felipeelia
Created September 18, 2019 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipeelia/f5437e549d29fd81be712ce47f10aadb to your computer and use it in GitHub Desktop.
Save felipeelia/f5437e549d29fd81be712ce47f10aadb to your computer and use it in GitHub Desktop.
List the percentage of usage of WordPress installs per locale
<?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