Skip to content

Commit

Permalink
Added language options for dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Matousek committed Oct 29, 2015
1 parent 1c43b74 commit e4ebf73
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Kdyby/Google/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class Configuration extends Object
* @var array
*/
public $scopes;

/**
* @var string
*/
public $language;

/**
* @var array
Expand Down
19 changes: 18 additions & 1 deletion src/Kdyby/Google/Dialog/LoginDialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*/
class LoginDialog extends AbstractDialog
{
/** @var string */
private $language;

/**
* Checks, if there is a user in storage and if not, it redirects to login dialog.
Expand Down Expand Up @@ -49,7 +51,22 @@ public function getUrl()
$this->session->establishCSRFTokenState();
$auth->setState($this->session->state);

return new UrlScript($this->google->client->createAuthUrl());
$url = new UrlScript($this->google->client->createAuthUrl());

if($this->language){
$url->appendQuery(['hl' => $this->language]);
}

return $url;
}


/**
* @param string $language (cs, en, etc...)
*/
public function setLanguage($language)
{
$this->language = $language;
}

}

0 comments on commit e4ebf73

Please sign in to comment.