Skip to content

Commit

Permalink
Temporary fix for pluralization of units
Browse files Browse the repository at this point in the history
  • Loading branch information
hgrecco committed Jan 22, 2024
1 parent a9ad7e8 commit 3cc2d36
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/getting/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ If Babel_ is installed you can translate unit names to any language
.. doctest::

>>> ureg.formatter.format_quantity(accel, locale='fr_FR')
'1,3 mètres/seconde²'
'1,3 mètres/secondes²'

You can also specify the format locale at the registry level either at creation:

Expand All @@ -449,11 +449,11 @@ and by doing that, string formatting is now localized:
>>> ureg.default_format = 'P'
>>> accel = 1.3 * ureg.parse_units('meter/second**2')
>>> str(accel)
'1,3 mètres/seconde²'
'1,3 mètres/secondes²'
>>> "%s" % accel
'1,3 mètres/seconde²'
'1,3 mètres/secondes²'
>>> "{}".format(accel)
'1,3 mètres/seconde²'
'1,3 mètres/secondes²'

If you want to customize string formatting, take a look at :ref:`formatting`.

Expand Down

0 comments on commit 3cc2d36

Please sign in to comment.