translations

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOrCreateMessage

func GetOrCreateMessage(messages MessageMap, msgRef MessageRef, value string) po.Message

GetOrCreateMessage retrieves the message in messages at the msgRef key. If it does not exist, then it is created with the given value. If value is not empty and the original msg translation is empty, then it is updated with value.

func RegisterFunc

func RegisterFunc(key string, f poUpdateFunc)

RegisterFunc registers the given method for the given key in the poMethods bundle

func RegisterRuleSet

func RegisterRuleSet(key string, rules *RuleSet)

RegisterRuleSet registers the given RuleSet for the given key in the poRuleSet bundle

func UpdatePOFiles

func UpdatePOFiles(config map[string]interface{})

UpdatePOFiles creates or updates PO files of the module in the given dir with the data in the Translation registry. It is meant to be called from a Po updater start file which imports all the project's module.

Types

type MessageMap

type MessageMap map[MessageRef]po.Message

MessageMap is a map with all po-related informations

type MessageRef

type MessageRef struct {
	MsgId string
	// contains filtered or unexported fields
}

A MessageRef identifies unique messages

type RuleSet

type RuleSet struct {
	Inherit []*RuleSet
	Rules   [][]string
}

RuleSet contains the rules defining the files targeted by the custom i18n-Update methods

func GetPoUpdateRuleSet

func GetPoUpdateRuleSet(key string) *RuleSet

GetPoUpdateRuleSet returns the rule set for an usage outside the package

Jump to

Keyboard shortcuts

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