Back to godoc.org
github.com/gohugoio/hugo/tpl/lang

package lang

v0.72.0
Latest Go to latest
Published: 4 days ago | License: Apache-2.0 | Module: github.com/gohugoio/hugo

Overview

Package lang provides template functions for content internationalization.

Index

type Namespace

type Namespace struct {
	// contains filtered or unexported fields
}

Namespace provides template functions for the "lang" namespace.

func New

func New(deps *deps.Deps) *Namespace

New returns a new instance of the lang-namespaced template functions.

func (*Namespace) Merge

func (ns *Namespace) Merge(p2, p1 interface{}) (interface{}, error)

Merge creates a union of pages from two languages.

func (*Namespace) NumFmt

func (ns *Namespace) NumFmt(precision, number interface{}, options ...interface{}) (string, error)

NumFmt formats a number with the given precision using the negative, decimal, and grouping options. The `options` parameter is a string consisting of `<negative> <decimal> <grouping>`. The default `options` value is `- . ,`.

Note that numbers are rounded up at 5 or greater. So, with precision set to 0, 1.5 becomes `2`, and 1.4 becomes `1`.

func (*Namespace) Translate

func (ns *Namespace) Translate(id interface{}, args ...interface{}) (string, error)

Translate returns a translated string for id.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier