You are here

function lingotek_get_source_language_json in Lingotek Translation 7.2

Same name and namespace in other branches
  1. 7.3 lingotek.dashboard.inc \lingotek_get_source_language_json()
  2. 7.4 lingotek.dashboard.inc \lingotek_get_source_language_json()

Outputs the language code with page count in json format. Supplied to the dashboard. Output Format: {'code':'en','docs':'500'}

1 call to lingotek_get_source_language_json()
lingotek_get_dashboard_code in ./lingotek.dashboard.inc
Generates the code for the embedded Javascript dashboard.

File

./lingotek.dashboard.inc, line 382
Lingotek Dashboard.

Code

function lingotek_get_source_language_json() {
  $data = array();
  $source_language = lingotek_get_source_language();
  $data['code'] = Lingotek::convertDrupal2Lingotek($source_language);
  $data['edited'] = lingotek_count_nodes(LINGOTEK_NODE_SYNC_STATUS_EDITED);
  $data['pending'] = lingotek_count_nodes(LINGOTEK_NODE_SYNC_STATUS_PENDING);
  $data['current'] = lingotek_count_nodes(LINGOTEK_NODE_SYNC_STATUS_CURRENT);
  $data['docs'] = $data['edited'] + $data['pending'] + $data['current'];
  return json_encode($data);
}