summaryrefslogtreecommitdiffstats
path: root/tpl/lang
AgeCommit message (Collapse)Author
2021-11-01Fix description of lang.FormatNumberCustomJoe Mooring
It currently refers to itself as a simple alternative, when it should refer to lang.FormatNumber.
2021-09-22Clarify "precision" in currency format functionsPaul Gottschling
The documentation of the FormatAccounting and FormatCurrency functions could be clearer in terms of how the precision param works. This commit makes it more explicit that adding a precision of < 2 will not format the return values to include fewer decimals. Resolves #8858
2021-08-03Fix `lang.FormatPercent` descriptionSalim B
Successor PR for https://github.com/gohugoio/hugoDocs/pull/1504
2021-08-02Reduce binary size vs locale, update to CLDR v36.1Bjørn Erik Pedersen
Test building with `go build -ldflags="-s -w"` Hugo 0.86.2: 46MB Before this commit: 77MB After this commit: 54MB Fixes #8839 Fixes #8841
2021-08-01Fix error handling for the time func aliasBjørn Erik Pedersen
Fixes #8835
2021-07-29tpl/lang: Add new localized versions of lang.FormatNumber etc.Bjørn Erik Pedersen
Fixes #8820
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-09-29langs/i18n: Upgrade to go-i18n v2Bjørn Erik Pedersen
Fixes #5242
2020-06-02tpl: Fix bad rounding in NumFmtSam Smith
strconv.FormatFloat doesn't round properly sometimes, this adds a different method of rounding, fixes #7116
2019-08-12tests: Convert from testify to quicktestBjørn Erik Pedersen
2018-11-30tpl: Add godoc packages commentsCameron Moore
Also fix package name in tpl/templates.
2018-10-02tpl: Add a delimiter parameter to lang.NumFmtCameron Moore
The original implementation of NumFmt did not take into account that the options delimiter (a space) could be a valid option. Adding a delim parameter seems like the simplest, safest, and most flexible way to solve this oversight in a backwards-compatible way. Fixes #5260
2018-09-07tpl: Fix golint godoc issuesCameron Moore
2018-03-16Add a way to merge pages by languageBjørn Erik Pedersen
As an example: ```html {{ $pages := .Site.RegularPages | lang.Merge $frSite.RegularPages | lang.Merge $enSite.RegularPages }} ``` Will "fill in the gaps" in the current site with, from left to right, content from the French site, and lastly the English. Fixes #4463
2017-06-13Run gofmt to get imports in line vs gohugoio/hugoBjørn Erik Pedersen
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-05-20tpl: Make the Namespace func signature explicitBjørn Erik Pedersen
This makes it cleaner and avoids breaking client code, such as the docs helper JSON generator.
2017-05-18tpl/lang: Add NumFmt functionCameron Moore
NumFmt formats a number with a given precision using the requested decimal, grouping, and negative characters. Fixes #1444
2017-05-02tpl: Add basic tests for all namespace init funcsCameron Moore
2017-05-01tpl: Add docshelper for template funcsBjørn Erik Pedersen
And fix some other minor related issues. Updates #3418
2017-05-01tpl: Fix the remaining template funcs namespace issuesBjørn Erik Pedersen
See #3042
2017-05-01tpl: Add TemplateFuncsNamespaceRegistryBjørn Erik Pedersen
As a first step to remove the hard ties between `tplimpl` and the different namespace packages. The `lang` package is used as the first example use case. See #3042
2017-04-30tpl: Add template function namespacesCameron Moore
This commit moves almost all of the template functions into separate packages under tpl/ and adds a namespace framework. All changes should be backward compatible for end users, as all existing function names in the template funcMap are left intact. Seq and DoArithmatic have been moved out of the helpers package and into template namespaces. Most of the tests involved have been refactored, and many new tests have been written. There's still work to do, but this is a big improvement. I got a little overzealous and added some new functions along the way: - strings.Contains - strings.ContainsAny - strings.HasSuffix - strings.TrimPrefix - strings.TrimSuffix Documentation is forthcoming. Fixes #3042