plural

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: MIT Imports: 0 Imported by: 0

README

plural-ru

Go Reference GitHub release (latest SemVer) GitHub go.mod Go version Go Report Card Coverage Status license

Package Pluralization of russian words for golang with generics for int | int32 | int64 | uint | uint32 | uint64 types

Usage

package main

import (
    "log"

    "github.com/rb-go/plural-ru"
)

func main() {
    log.Println(1, plural.Noun(1, "день", "дня", "дней"))
    log.Println(2, plural.Noun(2, "день", "дня", "дней"))
    log.Println(3, plural.Noun(3, "день", "дня", "дней"))
    log.Println(4, plural.Noun(4, "день", "дня", "дней"))
    log.Println(5, plural.Noun(5, "день", "дня", "дней"))
    log.Println(8, plural.Noun(8, "день", "дня", "дней"))
    log.Println(11, plural.Noun(11, "день", "дня", "дней"))
    log.Println(1111, plural.Noun(1111, "день", "дня", "дней"))
    log.Println(121, plural.Noun(121, "день", "дня", "дней"))

    cnt := 100500
    log.Println(plural.Verb(cnt, "нашелся", "нашлись", "нашлось"), cnt, plural.Noun(cnt, "идея", "идеи", "идей"))
}

will print in console:

2022/10/28 17:27:09 1 день
2022/10/28 17:27:09 2 дня
2022/10/28 17:27:09 3 дня
2022/10/28 17:27:09 4 дня
2022/10/28 17:27:09 5 дней
2022/10/28 17:27:09 8 дней
2022/10/28 17:27:09 11 дней
2022/10/28 17:27:09 1111 дней
2022/10/28 17:27:09 121 день
2022/10/28 17:27:09 нашлось 100500 идей

Documentation

Overview

plural package to make pluralization of russian words

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Noun

func Noun[n Number](num n, oneWord, twoWord, ThreeWord string) string

Noun function to make pluralization for noun

func Verb

func Verb[n Number](num n, oneWord, twoWord, ThreeWord string) string

Verb function to make pluralization for verb

Types

type Number

type Number interface {
	int | int32 | int64 | uint | uint32 | uint64
}

Jump to

Keyboard shortcuts

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