Import github.com/Tnze/go-mc/data/lang/en-us by default that the chat.Message.String() will handle Translate Message correctly at any time.
This commit is contained in:
@ -4,8 +4,8 @@
|
|||||||
// or net/packet.Field .
|
// or net/packet.Field .
|
||||||
//
|
//
|
||||||
// It's very recommended that use SetLanguage before using Message.String or Message.ClearString,
|
// It's very recommended that use SetLanguage before using Message.String or Message.ClearString,
|
||||||
// or the translate message will be ignore.
|
// or the `github.com/Tnze/go-mc/data/en-us` will be used.
|
||||||
// Note: The package of data/lang/... will SetLanguage on theirs init() so you don't need do again.
|
// Note: The package of data/lang/... will SetLanguage on theirs init() so you don't need to call by your self.
|
||||||
package chat
|
package chat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -15,6 +15,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
_ "github.com/Tnze/go-mc/data/lang/en-us"
|
||||||
pk "github.com/Tnze/go-mc/net/packet"
|
pk "github.com/Tnze/go-mc/net/packet"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -140,8 +141,8 @@ var colors = map[string]string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// translateMap is the translation table.
|
// translateMap is the translation table.
|
||||||
// By default it's a void map.
|
// By default it's set by data/lang/en-us.
|
||||||
var translateMap = map[string]string{}
|
var translateMap map[string]string
|
||||||
|
|
||||||
// SetLanguage set the translate map to this map.
|
// SetLanguage set the translate map to this map.
|
||||||
func SetLanguage(trans map[string]string) {
|
func SetLanguage(trans map[string]string) {
|
||||||
|
Reference in New Issue
Block a user