i18n

package module
v0.0.0-...-def4582 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2014 License: BSD-2-Clause Imports: 8 Imported by: 1

README

i18n

基于 Martini, 为国际化翻译提供接口支持.

Import

import "github.com/typepress/i18n"

Usage

See also - github.com/typepress/server

License

BSD-2-Clause

Documentation

Index

Constants

View Source
const (
	NameOfCookieToUseLanguage = "lang"
)

Variables

This section is empty.

Functions

func Register

func Register(source, destination string, trs Translator)
  Register an Translator for translate from source to destination language.
  source means abstract language.
  destination means http request head "Accept-Language". See also:
	http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
	http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.10
  e.g
	Register("en","zh",yourtrs)
	Register("en.mysql","zh-cn",yourtrs)

func Translate

func Translate(source string) martini.Handler

Types

type Translator

type Translator interface {
	Sprint(...interface{}) string
	Sprintf(string, ...interface{}) string
}

Jump to

Keyboard shortcuts

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