Skip to content

Commit

Permalink
Add UTF-8 slug without explicit language code (#26329)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirMasoud authored and taylorotwell committed Oct 31, 2018
1 parent 0060d98 commit 96e4743
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,12 @@ public static function singular($value)
*
* @param string $title
* @param string $separator
* @param string $language
* @param string|null $language
* @return string
*/
public static function slug($title, $separator = '-', $language = 'en')
{
$title = static::ascii($title, $language);
$title = $language ? static::ascii($title, $language) : $title;

// Convert all dashes/underscores into separator
$flip = $separator === '-' ? '_' : '-';
Expand Down
1 change: 1 addition & 0 deletions tests/Support/SupportStrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public function testSlug()
$this->assertEquals('hello-world', Str::slug('hello_world'));
$this->assertEquals('hello_world', Str::slug('hello_world', '_'));
$this->assertEquals('user-at-host', Str::slug('user@host'));
$this->assertEquals('سلام-دنیا', Str::slug('سلام دنیا', '-', null));
}

public function testFinish()
Expand Down

0 comments on commit 96e4743

Please sign in to comment.