Skip to content

Commit b0a91ce

Browse files
javiereguiluzOskarStark
authored andcommitted
[String] Document the Spanish inflector
1 parent 8019920 commit b0a91ce

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
@@ -820,11 +820,28 @@ class to convert English words from/to singular/plural with confidence::
820820
The value returned by both methods is always an array because sometimes it's not
821821
possible to determine a unique singular/plural form for the given word.
822822

823+
Symfony also provides inflectors for other languages::
824+
825+
use Symfony\Component\String\Inflector\FrenchInflector;
826+
827+
$inflector = new FrenchInflector();
828+
$result = $inflector->singularize('souris'); // ['souris']
829+
$result = $inflector->pluralize('hôpital'); // ['hôpitaux']
830+
831+
use Symfony\Component\String\Inflector\SpanishInflector;
832+
833+
$inflector = new SpanishInflector();
834+
$result = $inflector->singularize('aviones'); // ['avión']
835+
$result = $inflector->pluralize('miércoles'); // ['miércoles']
836+
837+
.. versionadded:: 7.2
838+
839+
The ``SpanishInflector`` class was introduced in Symfony 7.2.
840+
823841
.. note::
824842

825-
Symfony also provides a :class:`Symfony\\Component\\String\\Inflector\\FrenchInflector`
826-
and an :class:`Symfony\\Component\\String\\Inflector\\InflectorInterface` if
827-
you need to implement your own inflector.
843+
Symfony provides a :class:`Symfony\\Component\\String\\Inflector\\InflectorInterface`
844+
in case you need to implement your own inflector.
828845

829846
.. _`ASCII`: https://en.wikipedia.org/wiki/ASCII
830847
.. _`Unicode`: https://en.wikipedia.org/wiki/Unicode

0 commit comments

Comments
 (0)