From 5ad2c26993cd594ea20b5922f86525616c362cc0 Mon Sep 17 00:00:00 2001 From: Marvin Blum Date: Sun, 2 Jun 2019 02:20:26 +0200 Subject: [PATCH] Added better description and examples to readme. --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 40042f7..8d816cc 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -# iso-639-1 +# ISO 639-1 [![GoDoc](https://godoc.org/github.com/emvi/iso-639-1?status.svg)](https://godoc.org/github.com/emvi/iso-639-1) [![CircleCI](https://circleci.com/gh/emvi/iso-639-1.svg?style=svg)](https://circleci.com/gh/emvi/iso-639-1) [![Go Report Card](https://goreportcard.com/badge/github.com/emvi/iso-639-1)](https://goreportcard.com/report/github.com/emvi/iso-639-1) -List of ISO 639-1 languages and codes. +List of all ISO 639-1 language names, native names and two character codes as well as functions for convenient access. +The lists of all names and codes (`Codes`, `Names`, `NativeNames`, `Languages`) are build in the init function for quick read access. +For full documentation please read the Godocs. ## Installation @@ -14,7 +16,19 @@ go get github.com/emvi/iso-639-1 ## Example -*WIP* +``` +fmt.Println(iso6391.Codes) // print all codes +fmt.Println(iso6391.Names) // print all names +fmt.Println(iso6391.NativeNames) // print all native names +fmt.Println(iso6391.Languages) // print all language objects {Code, Name, NativeName} + +fmt.Println(iso6391.FromCode("en")) // prints {Code: "en", Name: "English", NativeName: "English"} +fmt.Println(iso6391.Name("en")) // prints "English" +fmt.Println(iso6391.NativeName("zh")) // prints "中文" +fmt.Println(iso6391.CodeFromName("English")) // prints "en" +fmt.Println(iso6391.ValidCode("en")) // prints true +// ... see Godoc for more functions +``` ## Contribute