translit/README.md
2025-12-14 21:48:12 +04:00

41 lines
892 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Транслитерация с кириллицы на английский и обратно (Cyrillic-to-English and English-to-Cyrillic transliterator)
## Установка (Install)
```
luarocks install translit
```
## Использование (Usage)
### Транслитерация с киррилицы на английский (Cyrillic-to-English)
```
local translit = require('translit')
local en_str = translit.en('Русский текст')
```
### Транслитерация с киррилицы на русский (English-to-Cyrillic)
```
local translit = require('translit')
local cy_str = translit.cy('English text')
```
### Использование для URL (slug)
```
local function sluger(title)
local slug = translit.en(title)
slug = string.gsub(slug,'%s','-')
slug = string.gsub(slug,'[^%w-]','')
return string.lower(slug)
end
```