Skip to content

Commit

Permalink
feature #20231 [String] Document the Spanish inflector (javiereguiluz)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
OskarStark committed Sep 19, 2024
2 parents 42837b5 + b0a91ce commit 67f2000
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 @@ -654,11 +654,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 67f2000

Please sign in to comment.