locale

package
v1.5.129 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Linguas = map[Lingua]struct{}{}

Linguas is the set of current languages that are translated "enough".

Functions

func ActiveFitsHeight added in v1.5.6

func ActiveFitsHeight() bool

ActiveFitsHeight returns whether height auditing will be performed.

This is only accessible for the active locale so it can later be defined by the language file itself.

func ActiveFont added in v1.5.6

func ActiveFont() string

ActiveFont returns the font this locale uses.

This is only accessible for the active locale so it can later be defined by the language file itself.

func ActiveShape added in v1.5.6

func ActiveShape(s string) string

ActiveShape performs glyph shaping on a given string.

This is only accessible for the active locale so it can later be defined by the language file itself.

func ActiveUsesArabicShaping added in v1.5.6

func ActiveUsesArabicShaping() bool

ActiveUsesArabicShaping returns whether Arabic shaping will be performed.

This is only accessible for the active locale so it can later be defined by the language file itself.

func Audit added in v1.3.103

func Audit() error

func CharSet added in v1.3.343

func CharSet(base string, baseWeight, maxCount int) []rune

func Errorf added in v1.3.103

func Errorf(format string, args ...interface{})

func InitCurrent

func InitCurrent()

InitCurrent identifies the system locale. Requires Linguas to have been set.

func ResetLanguage added in v1.3.103

func ResetLanguage()

ResetLanguage makes everything English again.

Types

type IType

type IType = gotext.Translator

IType is the type of a locale translator interface.

var GI IType

GI is the translation of the game but as an interface. Used to work around go vet as it can't figure out that G.Get isn't a printf-like function if it gets only one arg. See https://github.com/golang/go/issues/57288

type Lingua

type Lingua string

Lingua identifies a language.

const Builtin Lingua = ""

Builtin is a reserved language name for the included language.

const UserProvided Lingua = "."

UserProvided is a reserved language name for language packs.

var Active Lingua

Active is the name of the current language.

var Current Lingua

Current returns the preferred system locale, intersected with available locales.

func LinguasSorted

func LinguasSorted() []Lingua

LinguasSorted returns the languages sorted by humanly expected ordering.

func (Lingua) Canonical added in v1.3.263

func (l Lingua) Canonical() Lingua

func (Lingua) Directory added in v1.3.186

func (l Lingua) Directory() string

Directory returns the directory containing the language.

func (Lingua) GroupMembers added in v1.3.263

func (l Lingua) GroupMembers() []Lingua

GroupMembers returns all additional members of a language group. Groups use the same file, but have {{if eq Lang ...}} template commands for minor differences.

func (Lingua) Name

func (l Lingua) Name() string

Name returns the human readable name of a language for the current font.

func (Lingua) SortKey added in v1.4.45

func (l Lingua) SortKey() string

type Type

type Type = *gotext.Po

Type is the type of a locale translator.

var G Type

G is the translation of the game.

var L Type

L is the translation of the levels.

type VerticalTextPreference added in v1.5.6

type VerticalTextPreference int
const (
	NeverPreferVerticalText VerticalTextPreference = iota
	DefaultPreferVerticalText
	AlwaysPreferVerticalText
)

func ActivePrefersVerticalText added in v1.5.6

func ActivePrefersVerticalText() VerticalTextPreference

ActivePrefersVerticalText returns whether this locale prefers vertical text.

This is only accessible for the active locale so it can later be defined by the language file itself.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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