Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit36a5c1a

Browse files
jontjsjaviereguiluz
authored andcommitted
[String] Feature 39178
Documentation update for [String] Feature 39178 "AsciiSlugger's symbolsMap should apply to all locales for a language".
1 parent9d03c8f commit36a5c1a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎components/string.rst‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,12 @@ that only includes safe ASCII characters::
477477
$slug = $slugger->slug('10% or 5€');
478478
// $slug = '10-percent-or-5-euro'
479479

480+
// if there is no symbols map for your locale (e.g. 'en_GB') then the parent locale's symbols map
481+
// will be used instead (i.e. 'en')
482+
$slugger = new AsciiSlugger('en_GB', ['en' => ['%' => 'percent', '€' => 'euro']]);
483+
$slug = $slugger->slug('10% or 5€');
484+
// $slug = '10-percent-or-5-euro'
485+
480486
// for more dynamic substitutions, pass a PHP closure instead of an array
481487
$slugger = new AsciiSlugger('en', function ($string, $locale) {
482488
return str_replace('❤️', 'love', $string);
@@ -490,6 +496,10 @@ that only includes safe ASCII characters::
490496

491497
The feature to use a PHP closure to define substitutions was introduced in Symfony 5.2.
492498

499+
..versionadded::5.3
500+
501+
The feature to fallback to the parent locale's symbols map was introduced in Symfony 5.3.
502+
493503
The separator between words is a dash (``-``) by default, but you can define
494504
another separator as the second argument::
495505

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp