Skip to content

Commit

Permalink
I forget about this
Browse files Browse the repository at this point in the history
  • Loading branch information
sutnistj committed Sep 19, 2021
1 parent 1b950f5 commit 61607ad
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 234 deletions.
99 changes: 99 additions & 0 deletions projects/transliteration/js/alpha.lib.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
o = require('./alpha.objects')

/**
* @param {string} id
* @returns {string}
*/
function valueOfSelection(id) {
let selObj = document.getElementById(id)
return selObj.options[selObj.selectedIndex].text
}

/**
* @param {string} string
*/
function printResult(string) {
document.getElementById('result').innerHTML = string.replace(/\n\r?/g, '<br />')
}

/**
* @param {string} fromScript script name
* @param {string} toScript script name
* @param {string} value material for transliteration
* @returns {string} result of transliteration
*/
function transliteration(fromScript, toScript, value) {
let params = getConstParams(fromScript, toScript)
for (letter of o.scripts) {
if (typeof letter[fromScript] == 'object') {}


}
}

const rmDup = e => [...new Set(e)].sort().join("");

function simpleChange(from, to) {
}

// function getConstParams(from, to) {
// let softLetters = rmDup(letters([from, to], 'Soft'))

// /**
// * Big Letters
// * Lower Soft Letters
// * Upper Softt Letter
// */
// let params = {
// 'bl': '[-0-9' + rmDup(letters([from, to]).toUpperCase()) + ']',
// 'ls': new RegExp('([' + softLetters + softLetters.toUpperCase() + '])', 'g'),
// 'us': new RegExp('([' + softLetters.toUpperCase() + '])', 'g'),
// }
// return params
// }

// function getVarParams(from, to) {
// /**
// * Full In Before
// * Full In After
// */
// return {
// 'fib': new RegExp('(' + p['bl'] + '{0,})' + from.toUpperCase() + '(' + p['bl'] + '{1,})', g),
// 'fia': new RegExp('(' + p['bl'] + '{1,})' + from.toUpperCase() + '(' + p['bl'] + '{0,})', g)
// }

// // value = value
// // .replace(new RegExp(upCase(from, letter[from], false), 'g'), upCase(to, letter[to], false))
// // .replace(new RegExp(letter[from], 'g'), letter[to])
// }

function letters(calls, param = true) {
let string = ''
if (typeof calls == "string") {
calls = [calls]
}
for (call of calls) {
for (letter of o.scripts) {
let params = {
"boolean": true,
"string": letter['Param'] && letter['Param'].includes(param)
}
if (!params[typeof param]) { continue }
switch (typeof letter[call]) {
case 'string': {
string += letter[call]
break
}
case 'object': {
string += Object.values(letter[call]).join('')
}
}
}
}
return string
}

// console.log(letters(['Cyrillic', 'Latin'],'Soft'))
// console.log(o.scripts)

transliteration('Latin', 'Cyrillic', 'Hello')
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
scripts = [
exports.scripts = [
// Long sounds
{
'Param': [
Expand Down Expand Up @@ -84,52 +84,73 @@ scripts = [
},
{
'Cyrillic': 'є',
'Glagolitic': 'ⰹⰅ',
'Glagolitic': {
'Common': 'ⰹⰅ',
'Soft': 'ⱐⰅ'
},
'Latin': 'je',
'Shavian': '𐑘𐑧',
'Shavian': {
'Common': '𐑘𐑧',
'Soft': '𐑢𐑧'
}
},
{
'Cyrillic': 'ї'.normalize('NFD'),
'Glagolitic': 'ⱑ',
'Latin': 'ji',
'Shavian': '𐑘𐑰',
'Shavian': {
'Common': '𐑘𐑰',
'Soft': '𐑢𐑰'
}
},
{
'Cyrillic': 'ю',
'Glagolitic': 'ⱓ',
'Latin': 'ju',
'Shavian': '𐑘𐑵',
'Shavian': {
'Common': '𐑘𐑵',
'Soft': '𐑢𐑵'
}
},
{
'Cyrillic': 'я',
'Glagolitic': 'ⱔ',
'Latin': 'ja',
'Shavian': '𐑘𐑨',
'Shavian': {
'Common': '𐑘𐑨',
'Soft': '𐑢𐑨'
}
},
{
'Cyrillic': 'йо'.normalize('NFD'),
'Cyrillic': {
'Common': 'йо'.normalize('NFD'),
'Soft': 'ьо'
},
'Glagolitic': 'ⱖ',
'Latin': 'jo',
'Shavian': '𐑘𐑴',
'Shavian': {
'Common': '𐑘𐑴',
'Soft': '𐑢𐑴'
}
},
// Specific
{
'Param': [
'Iota sign',
'Palatal sign',
],
'Cyrillic': 'й'.normalize('NFD'),
'Glagolitic': 'ⰹ',
'Cyrillic': {
'Common': 'й'.normalize('NFD'),
'Soft': 'ь'
},
'Glagolitic': {
'Common': 'ⰹ',
'Soft': 'ⱐ'
},
'Latin': 'j',
'Shavian': '𐑘',
},
{
'Param': [
'Soft sign',
],
'Cyrillic': 'ь',
'Glagolitic': 'ⱐ',
'Latin': 'j',
'Shavian': '𐑢',
'Shavian': {
'Common': '𐑘',
'Soft': '𐑢'
},
},
{
'Cyrillic': 'ґ',
Expand Down
89 changes: 0 additions & 89 deletions projects/transliteration/js/back.lib.js

This file was deleted.

Loading

0 comments on commit 61607ad

Please sign in to comment.