language

package
v0.0.0-...-2e00310 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package language provides functionality for handling language codes and translations between different language representation formats.

Index

Constants

This section is empty.

Variables

View Source
var ChromiumLanguageList = []string{}/* 109 elements not displayed */

ChromiumLanguageList contains all supported language codes in Chromium

View Source
var GoogleToLnxLangExclusions = map[string]string{
	"zh-CN": "zh-Hans",
	"zh-TW": "zh-Hant",
	"sr":    "sr-Cyrl",
	"iw":    "he",
	"jw":    "jv",
}

GoogleToLnxLangExclusions maps Google language codes to Lingvanex language codes for special cases where they differ

Functions

func MakeGoogleToLnxLangMapping

func MakeGoogleToLnxLangMapping() map[string]string

MakeGoogleToLnxLangMapping creates a mapping from Google language codes to Lingvanex language codes

func MakeLnxToGoogleLangMapping

func MakeLnxToGoogleLangMapping() map[string]string

MakeLnxToGoogleLangMapping creates a mapping from Lingvanex language codes to Google language codes

func ToGoogleLanguageCode

func ToGoogleLanguageCode(lnxLangCode string) (string, error)

ToGoogleLanguageCode converts a Lingvanex language code to a Google language code

func ToLnxLanguageCode

func ToLnxLanguageCode(gLangCode string) (string, error)

ToLnxLanguageCode converts a Google language code to a Lingvanex language code

Types

type GoogleLanguageList

type GoogleLanguageList struct {
	Sl map[string]string `json:"sl"`
	Tl map[string]string `json:"tl"`
}

GoogleLanguageList represents the JSON format for Google language list Example:

{
	"sl":{"auto":"Detect language","af":"Afrikaans"},
	"tl":{"af": "Afrikaans", "sq": "Albanian"}
	"al":{}
}

Note that al is not used in this package since Lingvanex don't have it.

func ToGoogleLanguageList

func ToGoogleLanguageList(body []byte) (*GoogleLanguageList, error)

ToGoogleLanguageList unmarshal a Lnx language list and marshal a corresponding google language list and return it.

type Language

type Language struct {
	IsoCode string `json:"code_alpha_1"`
	Name    string `json:"codeName"`
}

Language represents the format of language in Lingvanex language list Note that nativeName and dir are not used in this package since Google doesn't have them.

Jump to

Keyboard shortcuts

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