This is a hiragana translater, you can translate text and into hiragana!
Here is an example
local hirigana = require(workspace.Hirigana)
print(hirigana.translationTable) -- prints the translation table
print(hirigana.translate("kawaii neko to inu desu.")) -- a cute cat and dog, should translate into かわいい ねこ と いぬ です。
i might in the future, but i cant rn heres how you can do it your self if you want to.
what you have to do is replace the keys in the translationTable with the english version, then replace the values with the greek version
example:
make a key called “d” and then set the value to Δ
Ok, but I recommend changing the while - <= #text do to for i = 1, #text do
this is the code snippet
function module.translate(text)
local hiraganaText = ""
local i = 1
while i <= #text do
local char = text:sub(i, i)
local twoCharSequence = text:sub(i, i + 1)
if module.translationTable[twoCharSequence] then
hiraganaText = hiraganaText .. module.translationTable[twoCharSequence]
i = i + 2
else
-- If not a valid sequence, check for a single character match
local singleCharSequence = text:sub(i, i)
if module.translationTable[singleCharSequence] then
hiraganaText = hiraganaText .. module.translationTable[singleCharSequence]
else
hiraganaText = hiraganaText .. char
end
i = i + 1
end
end
return hiraganaText
end
and this is my version
function module.translate(text)
local hiraganaText = ""
for i = 1, #text do
local char = text:sub(i, i)
local twoCharSequence = text:sub(i, i + 1)
if module.translationTable[twoCharSequence] then
hiraganaText ..= module.translationTable[twoCharSequence]
i += 2
else
-- If not a valid sequence, check for a single character match
local singleCharSequence = text:sub(i, i)
if module.translationTable[singleCharSequence] then
hiraganaText ..= module.translationTable[singleCharSequence]
else
hiraganaText ..= char
end
i += 1
end
end
return hiraganaText
end