HUGO
Menu
GitHub 88319 stars Mastodon

lang.FormatPercent

Returns a percentage representation of a number with the given precision for the current language and region.

Syntax

lang.FormatPercent PRECISION NUMBER

Returns

string
{{ 512.5032 | lang.FormatPercent 2 }} → 512.50%

Localization of dates, currencies, numbers, and percentages is performed by the bep/golocales package. Hugo determines the locale using the locale configuration setting, falling back to the language key itself. The resolved value must be a locale supported by the package.