mirror of https://github.com/BOINC/boinc.git
Handle JSON responses from translation file URLs
(DBOINCP-141)
This commit is contained in:
parent
c2d27a1ac5
commit
32ec9f1ee9
|
@ -85,6 +85,13 @@ function boinctranslate_refresh_translations() {
|
|||
}
|
||||
$result = drupal_http_request($url, array(), 'GET', NULL, 1, 30);
|
||||
if ($result AND $result->code != '404' AND $result->data) {
|
||||
if ($result->data[0] == '{') {
|
||||
// Process as JSON
|
||||
$json_data = json_decode($result->data, TRUE);
|
||||
if (!empty($json_data['content'])) {
|
||||
$result->data = $json_data['content'];
|
||||
}
|
||||
}
|
||||
// Get the language code from the file and add if not yet supported
|
||||
$langcode = substr(strstr($result->data, 'Language: '), 10, 2);
|
||||
if (!$langcode) {
|
||||
|
|
Loading…
Reference in New Issue