Created
February 7, 2014 12:44
-
-
Save mikejolley/8862027 to your computer and use it in GitHub Desktop.
Get a list of Transifex contributors from WordPress for a project
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
$project_name = 'woocommerce-core'; | |
$your_username = 'YOURUSERNAME'; | |
$your_password = 'YOURPASSWORD'; // Don't include this in open source projects for obvious reasons :) | |
$response = wp_remote_post( 'http://www.transifex.com/api/2/project/' . $project_name . '/languages/', array( | |
'method' => 'GET', | |
'headers' => array( | |
'Authorization' => 'Basic ' . base64_encode( $your_username . ':' . $your_password ) | |
) | |
) ); | |
$result = (array) json_decode( $response['body'] ); | |
$translators = array(); | |
if ( $result ) { | |
foreach ( $result as $lang ) { | |
$translators = array_merge( $translators, $lang->coordinators ); | |
$translators = array_merge( $translators, $lang->translators ); | |
$translators = array_merge( $translators, $lang->reviewers ); | |
} | |
} | |
$translators = array_unique( array_filter( $translators ) ); | |
$translators_html = '<h1>' . $project_name . ' Transifex Contributors</h1><ul>'; | |
foreach ( $translators as $translator ) { | |
$translators_html .= '<li><a href="https://www.transifex.com/accounts/profile/' . $translator . '">' . $translator . '</a></li>'; | |
} | |
$translators_html .= '</ul>'; | |
echo $translators_html; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mikejolley what about merging this into WooCommerce. Translation contributuors list is unmanged and is long so perform this action soon.