makeplural

command module
v0.0.0-...-397833b Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: BSD-2-Clause Imports: 19 Imported by: 0

README

makeplural

make-plural.go translates Unicode CLDR pluralization rules to Go functions. It generates the content of the "makeplural/plural" package.

This package exports only one function:

GetFunc(name string) (func(n interface{}, ordinal bool) string, error)

Update "plural" package

To include any CLDR rules found in plurals.json, just use go run make-plural.go or to include only a subset, use go run make-plural.go -culture=fr,en

then you should run the unit tests to ensure everything went well :

cd plural
go test

Warning about float values

Depending on the country, you should consider providing float values as string or its specific rules may not be successfully applied.

example :

fn, _ := GetFunc("sl")
named_key := fn(x, false)

with x := 0.0, named_key will holds "other" while "few" is expected, but if x := "0.0" everything will be ok!

Todo

  • doc

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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