i18n

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type I18n

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

func GetInstance

func GetInstance() *I18n

func (*I18n) Get

func (i *I18n) Get(key string, args ...interface{}) string

Get is a method of the I18n type that allows for dynamic string localization. It retrieves the translation string associated with the provided key. The method also supports pluralization of the translation based on the first argument in args, when it's an integer and different from 1 (which stands for singular form).

Parameters:

- key: The key associated with the translation string in the dictionary.

- args: The optional arguments which can be used for string formatting and pluralization.

Returns:

- The formatted translation string associated with the key if it exists, otherwise "Key not found".

func (*I18n) SetUp

func (i *I18n) SetUp(langs ...string) error

Jump to

Keyboard shortcuts

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