Skip to content

Commit 67f2000

Browse files
committed
feature #20231 [String] Document the Spanish inflector (javiereguiluz)
This PR was squashed before being merged into the 7.2 branch. Discussion ---------- [String] Document the Spanish inflector Fixes #20227. Commits ------- b0a91ce [String] Document the Spanish inflector
2 parents 42837b5 + b0a91ce commit 67f2000

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

string.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,28 @@ class to convert English words from/to singular/plural with confidence::
654654
The value returned by both methods is always an array because sometimes it's not
655655
possible to determine a unique singular/plural form for the given word.
656656

657+
Symfony also provides inflectors for other languages::
658+
659+
use Symfony\Component\String\Inflector\FrenchInflector;
660+
661+
$inflector = new FrenchInflector();
662+
$result = $inflector->singularize('souris'); // ['souris']
663+
$result = $inflector->pluralize('hôpital'); // ['hôpitaux']
664+
665+
use Symfony\Component\String\Inflector\SpanishInflector;
666+
667+
$inflector = new SpanishInflector();
668+
$result = $inflector->singularize('aviones'); // ['avión']
669+
$result = $inflector->pluralize('miércoles'); // ['miércoles']
670+
671+
.. versionadded:: 7.2
672+
673+
The ``SpanishInflector`` class was introduced in Symfony 7.2.
674+
657675
.. note::
658676

659-
Symfony also provides a :class:`Symfony\\Component\\String\\Inflector\\FrenchInflector`
660-
and an :class:`Symfony\\Component\\String\\Inflector\\InflectorInterface` if
661-
you need to implement your own inflector.
677+
Symfony provides a :class:`Symfony\\Component\\String\\Inflector\\InflectorInterface`
678+
in case you need to implement your own inflector.
662679

663680
.. _`ASCII`: https://en.wikipedia.org/wiki/ASCII
664681
.. _`Unicode`: https://en.wikipedia.org/wiki/Unicode

0 commit comments

Comments
 (0)