yatranslit

module
v0.0.0-...-35e8894 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: MIT

README

Yandex-standard russian-english transliteration

Golang adaptation of https://github.com/denismitr/translit

Usage

    translit := translit_yandex.NewTranslit()
    var out string = translit.Transform("Строка для транслитерации, по правилам Яндекс!")
	// out == "stroka-dlya-transliteracii-po-pravilam-yandeksa"

To define max length of the output do:

    translit := translit_yandex.NewTranslit()
	translit.SetMaxLenght(10)
    slug := translit.transform("очень длинный текст...");
    // slug == "ochen-dlin"

You can provide your own translit implementation as long as it implements the Translater interface and inject it into the Translit class constructor, this way it will override the default behavior like so:

    CustomTranslit := NewTranslit()
	CustomTranslit.SetStrategy(NewYourTranslitStrategyImpl())

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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