Skip to content

Commit ecdabed

Browse files
author
Cameron James
committed
Support for default language
1 parent bd0d96a commit ecdabed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Client.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ class Client {
88
public $server='api.bigdatacloud.net';
99
public $code;
1010
public $timeout=120;
11+
public $language;
1112

12-
public function __construct($apiKey,$nameSpace='data',$server=null) {
13+
public function __construct($apiKey,$nameSpace='data',$server=null,$language='en') {
1314
if ($server) $this->server=$server;
1415
$this->apiKey=$apiKey;
1516
$this->nameSpace=$nameSpace;
17+
$this->language=$language;
1618
}
1719

1820
public function setIncludeTimer($includeTimer=1) {
@@ -55,6 +57,10 @@ public function communicate(string $endpoint,string $type,$payload=null) {
5557
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
5658
$qs='';
5759
$headers=[];
60+
if (!$payload) $payload=[];
61+
if (!isset($payload['localityLanguage'])) {
62+
$payload['localityLanguage']=$this->language;
63+
}
5864
if (count($payload)) {
5965
switch($type) {
6066
case 'GET':

0 commit comments

Comments
 (0)