File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -477,6 +477,12 @@ that only includes safe ASCII characters::
477
477
$slug = $slugger->slug('10% or 5€');
478
478
// $slug = '10-percent-or-5-euro'
479
479
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
+
480
486
// for more dynamic substitutions, pass a PHP closure instead of an array
481
487
$slugger = new AsciiSlugger('en', function ($string, $locale) {
482
488
return str_replace('❤️', 'love', $string);
@@ -490,6 +496,10 @@ that only includes safe ASCII characters::
490
496
491
497
The feature to use a PHP closure to define substitutions was introduced in Symfony 5.2.
492
498
499
+ .. versionadded :: 5.3
500
+
501
+ The feature to fallback to the parent locale's symbols map was introduced in Symfony 5.3.
502
+
493
503
The separator between words is a dash (``- ``) by default, but you can define
494
504
another separator as the second argument::
495
505
You can’t perform that action at this time.
0 commit comments