Skip to content

Commit

Permalink
[String] Document the Spanish inflector
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz authored and OskarStark committed Sep 19, 2024
1 parent 8019920 commit b0a91ce
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -820,11 +820,28 @@ class to convert English words from/to singular/plural with confidence::
The value returned by both methods is always an array because sometimes it's not
possible to determine a unique singular/plural form for the given word.

Symfony also provides inflectors for other languages::

use Symfony\Component\String\Inflector\FrenchInflector;

$inflector = new FrenchInflector();
$result = $inflector->singularize('souris'); // ['souris']
$result = $inflector->pluralize('hôpital'); // ['hôpitaux']

use Symfony\Component\String\Inflector\SpanishInflector;

$inflector = new SpanishInflector();
$result = $inflector->singularize('aviones'); // ['avión']
$result = $inflector->pluralize('miércoles'); // ['miércoles']

.. versionadded:: 7.2

The ``SpanishInflector`` class was introduced in Symfony 7.2.

.. note::

Symfony also provides a :class:`Symfony\\Component\\String\\Inflector\\FrenchInflector`
and an :class:`Symfony\\Component\\String\\Inflector\\InflectorInterface` if
you need to implement your own inflector.
Symfony provides a :class:`Symfony\\Component\\String\\Inflector\\InflectorInterface`
in case you need to implement your own inflector.

.. _`ASCII`: https://en.wikipedia.org/wiki/ASCII
.. _`Unicode`: https://en.wikipedia.org/wiki/Unicode
Expand Down

0 comments on commit b0a91ce

Please sign in to comment.