-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b348e45
Showing
4 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Greeklish JS Translator | ||
My implementation to interpet english to greek. Now you can change greeklish words to greek. | ||
|
||
Enjoy! | ||
|
||
### Demo Initialization | ||
```js | ||
greeklishTranslate("Parakalw"); | ||
``` | ||
|
||
### Version | ||
1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* Created by panagiotisvourtsis | ||
*/ | ||
(function(window) { | ||
"use strict"; | ||
|
||
function greeklishTranslate(s) { | ||
var translateMap = { | ||
"ks": "ξ", | ||
"ps": "ψ", | ||
"th": "θ", | ||
"a": "α", | ||
"b": "β", | ||
"c": "σ", | ||
"d": "δ", | ||
"e": "ε", | ||
"f": "φ", | ||
"g": "γ", | ||
"h": "η", | ||
"i": "ι", | ||
"k": "κ", | ||
"l": "λ", | ||
"m": "μ", | ||
"n": "ν", | ||
"o": "ο", | ||
"p": "π", | ||
"q": "", | ||
"r": "ρ", | ||
"s": "σ", | ||
"t": "τ", | ||
"u": "υ", | ||
"v": "β", | ||
"w": "ω", | ||
"x": "χ", | ||
"y": "υ", | ||
"z": "ζ", | ||
"KS": "Ξ", | ||
"PS": "Ψ", | ||
"TH": "Θ", | ||
"A": "Α", | ||
"B": "Β", | ||
"C": "Σ", | ||
"D": "Δ", | ||
"E": "Ε", | ||
"F": "Φ", | ||
"G": "Γ", | ||
"H": "Η", | ||
"I": "Ι", | ||
"K": "Κ", | ||
"L": "Λ", | ||
"M": "Μ", | ||
"N": "Ν", | ||
"O": "Ο", | ||
"P": "Π", | ||
"Q": "", | ||
"R": "Ρ", | ||
"S": "Σ", | ||
"T": "Τ", | ||
"U": "Υ", | ||
"V": "Β", | ||
"W": "Ω", | ||
"X": "Χ", | ||
"Y": "Υ", | ||
"Z": "Ζ" | ||
}; | ||
|
||
var newText = ""; | ||
for (var x = 0; x < s.length; x++) { | ||
if (translateMap[s.charAt(x-1)+ s.charAt(x)] && x > 0) { //special case | ||
newText = newText.substr(0, newText.length - 1); | ||
newText += translateMap[s.charAt(x-1) + s.charAt(x)] || s.charAt(x); | ||
|
||
} else { | ||
newText += translateMap[s.charAt(x)] || s.charAt(x); | ||
} | ||
} | ||
|
||
return newText; | ||
} | ||
|
||
window.greeklishTranslate = greeklishTranslate; | ||
}(window)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head lang="en"> | ||
<meta charset="UTF-8"> | ||
<title>testing greeklish</title> | ||
<script src="greeklishTranslate.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
document.write(greeklishTranslate("Parakalw")); | ||
</script> | ||
</body> | ||
</html> |