Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLanguageList ¶
func GetLanguageList(w http.ResponseWriter, r *http.Request)
GetLanguageList send a request to Lingvanex server and convert the response into google format and reply back to the client.
func ServeStaticFile ¶
func ServeStaticFile(w http.ResponseWriter, r *http.Request)
Types ¶
type LnxEndpointConfiguration ¶
type LnxEndpointConfiguration struct { // A list of endpoint URLs. Endpoints []string // A list of default endpoint weights. DefaultWeights []float64 // A GoogleLanguageList containing source language descriptions and target language descriptions. LanguagePairList language.GoogleLanguageList // A nested map of endpoint weights for a language pair. // The first key represents the source language, the second key represents the target language, the // third key represents the endpoint URL and the value the corresponding weight for that endpoint. LanguagePairWeights map[string]map[string]map[string]float64 }
LnxEndpointConfiguration describes a configuration of lingvanex endpoints, their supported languages and weights.
var ( LnxEndpoint *LnxEndpointConfiguration LnxAPIKey = os.Getenv("LNX_API_KEY") )
func NewLnxEndpointConfiguration ¶
func NewLnxEndpointConfiguration(endpoints []string, weights []float64, languageLists []language.GoogleLanguageList) (*LnxEndpointConfiguration, error)
NewLnxEndpointConfiguration returns a new endpoint configuration based on a list of endpoints, weights and list of supported languages
func (*LnxEndpointConfiguration) GetEndpoint ¶
func (c *LnxEndpointConfiguration) GetEndpoint(from, to string) string
GetEndpoint returns the endpoint which should be used based on the weights and languages supported.
Click to show internal directories.
Click to hide internal directories.