Skip to content

wmentor/lang

Repository files navigation

lang

test https://goreportcard.com/report/github.com/wmentor/lang https://pkg.go.dev/github.com/wmentor/lang License: MIT

Simple language detection library written on pure Go.

Summary

  • Require Go version >= 1.18
  • Written on pure Go
  • Supported languages: Armenian (am), German (de), Greek (el), English (en), Spanish (es), French (fr), Italian (it), Georgian (ka), Russian (ru)
  • MIT license

Install

go get github.com/wmentor/lang

Usage

package main

import (
  "strings"

  "github.com/wmentor/lang"
)

func main() {
  println(lang.Detect(strings.NewReader("123 1231232332 12"))) // ??
  println(lang.Detect(strings.NewReader("Hello, world!")))     // en
  println(lang.Detect(strings.NewReader("Привет, мир!")))      // ru
  println(lang.Detect(strings.NewReader("Hallo Welt!")))       // de
  println(lang.Detect(strings.NewReader("Բարեւ աշխարհ!")))     // am
}