intlresource

package
v0.0.0-...-81dc835 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoLanguageMatch = errors.New("template: no language match")

Functions

func Prepare

func Prepare(
	resources []resource.ResourceFile,
	view resource.EffectiveResourceView,
	extractLanguageTag func(resrc resource.ResourceFile) string,
	add func(langTag string, resrc resource.ResourceFile) error,
) error

Prepare is PrepareFallback, followed by PrepareNonFallback. Prepare ensures that the fallback resource is full and complete, by using the builtin one as the base.

func PrepareFallback

func PrepareFallback(
	resources []resource.ResourceFile,
	view resource.EffectiveResourceView,
	extractLanguageTag func(resrc resource.ResourceFile) string,
	add func(langTag string, resrc resource.ResourceFile) error,
) error

PrepareFallback prepares resources in fallback language.

func PrepareNonFallback

func PrepareNonFallback(
	resources []resource.ResourceFile,
	view resource.EffectiveResourceView,
	extractLanguageTag func(resrc resource.ResourceFile) string,
	add func(langTag string, resrc resource.ResourceFile) error,
) error

PrepareNonFallback prepares resources in non-fallback languages.

Types

type LanguageItem

type LanguageItem interface {
	GetLanguageTag() string
}

func Match

func Match(preferred []string, fallback string, items []LanguageItem) (matched LanguageItem, err error)

Match matches items against preferred and fallback.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL