Skip to content

Commit a0f4a83

Browse files
committed
fix: reuse the base url to get languages
+ also fixes failing exceptions test
1 parent 4fe5cd1 commit a0f4a83

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/GoogleTranslate.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ public function languages(?string $target = null): array
501501
public function localizedLanguages(string $target): array
502502
{
503503
$menu = 'sl'; // 'tl';
504-
$url = "https://translate.google.com/m?mui=$menu&hl=$target";
504+
$url = parse_url($this->url);
505+
$url = $url['scheme'].'://'.$url['host']."/m?mui=$menu&hl=$target";
505506

506507
try {
507508
$response = $this->client->get($url, $this->options);

0 commit comments

Comments
 (0)