summaryrefslogtreecommitdiffstats
path: root/langs/i18n
AgeCommit message (Collapse)Author
2021-06-18Split out the puthe path/filepath functions into common/pathsBjørn Erik Pedersen
So they can be used from the config package without cyclic troubles. Updates #8654
2021-06-14Misc config loading fixesBjørn Erik Pedersen
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster: ``` BenchmarkDefaultConfigProvider/Viper-16 252418 4546 ns/op 2720 B/op 30 allocs/op BenchmarkDefaultConfigProvider/Custom-16 450756 2651 ns/op 1008 B/op 6 allocs/op ``` Fixes #8633 Fixes #8618 Fixes #8630 Updates #8591 Closes #6680 Closes #5192
2021-06-07tpl/fmt: Add erroridf template funcBjørn Erik Pedersen
Fixes #8613
2021-05-02langs/i18n: Fix warning regression in i18nBjørn Erik Pedersen
Fix this by 1. Making sure that only numerical values are treated as plural counts 2. Making sure that `i18n.pluralFormNotFoundError` is not logged as a warning if `other` resolved. Note that 2. isn't a new problem, but became visible because of the plural improvements in Hugo `0.83.0`. Fixes #8492
2021-04-30langs/i18n: Fix multiple unknown language codesBjørn Erik Pedersen
This fixes a bug upstream by temporarily using a patched version of go-i18n. Closes #7838
2021-04-25langs/i18n: Improve plural handling of floatsBjørn Erik Pedersen
The go-i18n library expects plural counts with floats to be represented as strings. Fixes #8464
2021-04-23langs/i18n: Revise the plural implementationBjørn Erik Pedersen
There were some issues introduced with the plural counting when we upgraded from v1 to v2 of go-i18n. This commit improves that situation given the following rules: * A single integer argument is used as plural count and passed to the i18n template as a int type with a `.Count` method. The latter is to preserve compability with v1. * Else the plural count is either fetched from the `Count`/`count` field/method/map or from the value itself. * Any data type is accepted, if it can be converted to an integer, that value is used. The above means that you can now do pass a single integer and both of the below will work: ``` {{ . }} minutes to read {{ .Count }} minutes to read ``` Fixes #8454 Closes #7822 See https://github.com/gohugoio/hugoDocs/issues/1410
2021-02-06langs/i18n: Support translation files with suffix *.ymlBjørn Erik Pedersen
Fixes #8212
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-10-22Allow getJSON errors to be ignoredBjørn Erik Pedersen
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing). Fixes #7866
2020-10-09lang/i18n: Fix for language code case issue with pt-br etc.Bjørn Erik Pedersen
Fixes #7804
2020-10-08langs/i18n: Add workaround for known language, but missing plural rule errorBjørn Erik Pedersen
Closes #7798
2020-10-08langs/i18n: Fix for bare TOML keysBjørn Erik Pedersen
Hugo 0.76.0 updated go-i18n from v1 to v2. This allowed us to set the TOML unmarshaler to use, so we set the one we use in other places in Hugo. But that does not support dotted bare keys, which caused some breakage in the wild. This commit fixes that by: * Using go-toml for language files * Updating go-toml to the latest version
2020-10-07langs/i18n: Fix i18n .Count regressionBjørn Erik Pedersen
Fixes #7787
2020-09-29langs/i18n: Upgrade to go-i18n v2Bjørn Erik Pedersen
Fixes #5242
2019-08-12tests: Convert from testify to quicktestBjørn Erik Pedersen
2019-07-29Fix i18n project vs theme orderBjørn Erik Pedersen
Fixes #6134
2019-07-24Add Hugo ModulesBjørn Erik Pedersen
This commit implements Hugo Modules. This is a broad subject, but some keywords include: * A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project. * A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects. * Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running. * Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions. * A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`. All of the above is backed by Go Modules. Fixes #5973 Fixes #5996 Fixes #6010 Fixes #5911 Fixes #5940 Fixes #6074 Fixes #6082 Fixes #6092
2019-05-04i18n: Move the package below /langsBjørn Erik Pedersen
To get fewer top level packages.