Skip to content
/ uklatn Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions js/uklatn.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
* Transliterates a string of Ukrainian Cyrillic to Latin script.
*
* @param {string} text - the text to transliterate
* @param {string} table - transliteration system, one of:
* @param {string} [table] - transliteration system, one of:
* - "DSTU_9112_A": DSTU 9112:2021 System A
* - "DSTU_9112_B": DSTU 9112:2021 System B
* - "KMU_55": KMU 55:2010
* @returns {string} transliterated text
*/
export function encode(text: string, table: string): string;
export function encode(text: string, table?: string): string;
/**
* Re-transliterates a string of Ukrainian Latin to Cyrillic script.
*
* @param {string} text - the text to transliterate
* @param {string} table - transliteration system, one of:
* @param {string} [table] - transliteration system, one of:
* - "DSTU_9112_A": DSTU 9112:2021 System A
* - "DSTU_9112_B": DSTU 9112:2021 System B
* @returns {string} transliterated text
*/
export function decode(text: string, table: string): string;
export function decode(text: string, table?: string): string;
declare namespace _default {
export { encode };
export { decode };
Expand Down
6 changes: 4 additions & 2 deletions js/uklatn.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,11 @@ const _UklatnTables = new Map([
* Transliterates a string of Ukrainian Cyrillic to Latin script.
*
* @param {string} text - the text to transliterate
* @param {string} table - transliteration system, one of:
* @param {string} [table] - transliteration system, one of:
* - "DSTU_9112_A": DSTU 9112:2021 System A
* - "DSTU_9112_B": DSTU 9112:2021 System B
* - "KMU_55": KMU 55:2010
* @returns {string} transliterated text
*/
export function encode(text, table) {
if (table === undefined) { table = 'DSTU_9112_A'; }
Expand All @@ -240,9 +241,10 @@ export function encode(text, table) {
* Re-transliterates a string of Ukrainian Latin to Cyrillic script.
*
* @param {string} text - the text to transliterate
* @param {string} table - transliteration system, one of:
* @param {string} [table] - transliteration system, one of:
* - "DSTU_9112_A": DSTU 9112:2021 System A
* - "DSTU_9112_B": DSTU 9112:2021 System B
* @returns {string} transliterated text
*/
export function decode(text, table) {
if (table === undefined) { table = 'DSTU_9112_A'; }
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"type": "module",
"main": "js/uklatn.js",
"bin": "js/cli.js",
"files": [],
"files": ["js/*.ts"],
"scripts": {
"postpack": "git checkout readme.md",
"prepack": "cp js/readme.md readme.md",
Expand Down
1 change: 1 addition & 0 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ js:
@$(PYTHON) gentables.py js >> "$(PROJECT_ROOT)/js/uklatn.js"
@echo "/* Generated by gentests.py, do not edit. */\n" > "$(PROJECT_ROOT)/js/testuklatn.js"
@$(PYTHON) gentests.py js >> "$(PROJECT_ROOT)/js/testuklatn.js"
# tsc --declaration "$(PROJECT_ROOT)/js/uklatn.js" --allowJs --emitDeclarationOnly

php:
@$(PYTHON) gentables.py php > "$(PROJECT_ROOT)/php/src/UkrainianLatin.php"
Expand Down
6 changes: 4 additions & 2 deletions tools/gen/gen_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,11 @@ def _entries():
* Transliterates a string of Ukrainian Cyrillic to Latin script.
*
* @param {string} text - the text to transliterate
* @param {string} table - transliteration system, one of:
* @param {string} [table] - transliteration system, one of:
* - "DSTU_9112_A": DSTU 9112:2021 System A
* - "DSTU_9112_B": DSTU 9112:2021 System B
* - "KMU_55": KMU 55:2010
* @returns {string} transliterated text
*/
export function encode(text, table) {
if (table === undefined) { table = &{default_table}; }
Expand All @@ -278,9 +279,10 @@ def _entries():
* Re-transliterates a string of Ukrainian Latin to Cyrillic script.
*
* @param {string} text - the text to transliterate
* @param {string} table - transliteration system, one of:
* @param {string} [table] - transliteration system, one of:
* - "DSTU_9112_A": DSTU 9112:2021 System A
* - "DSTU_9112_B": DSTU 9112:2021 System B
* @returns {string} transliterated text
*/
export function decode(text, table) {
if (table === undefined) { table = &{default_table}; }
Expand Down
Loading