Jump to content

[Help]


Ahmed Ly

Recommended Posts

hello guys
how can i make translate. Arabic To English
for Example if i put in memo "ا" translated to "A"
 Code ;


translations =  {
["A"] = "ا" ,
["B"] = "ب" 
} 

        window = guiCreateWindow(262, 164, 590, 357, "", false)
        guiWindowSetSizable(window, false)
guiSetVisible(window,false) 


        English = guiCreateMemo(14, 44, 215, 176, "", false, window)
        Arabic = guiCreateMemo(370, 44, 211, 176, "", false, window)    





addEventHandler("onClientGUIChanged",root,
function () 
if source == Arabic then 
local selectedLanguage = guiGetText(Arabic) 
guiSetText(English, translations[selectedLanguage]['A']) 
end
end 
)

function open () 
if guiGetVisible(window) == false then 
guiSetVisible(window,true) 
showCursor(true)
else
guiSetVisible(window,false) 
showCursor(false)
end
end
bindKey("F6","down",open)

 

Link to comment
  • Scripting Moderators
translations = {
["A"] = "ا" ,
["B"] = "ب"
}
function ArabicToEnglish(str)
  for k,v in pairs(translations) do
    str = str:gsub(v,k)
  end
  return str
end


translations = {
["ا"] = "A" ,
["ب"] = "B" ,
}
function ArabicToEnglish(str)
  str:gsub(".",translations) --I don't know whether this works
  return str
end

 

Edited by thisdp
  • Thanks 1
Link to comment
4 hours ago, thisdp said:

translations = {["A"] = "ا" ,["B"] = "ب"}function ArabicToEnglish(str)  for k,v in pairs(translations) do    str = str:gsub(v,k)  end  return strend

translations = {["ا"] = "A" ,["ب"] = "B" ,}function ArabicToEnglish(str)  str:gsub(".",translations) --I don't know whether this works  return strend

 

thank you bro

Link to comment
  • Scripting Moderators
2 hours ago, Ahmed Ly said:

thank you bro

np :D

2 hours ago, Ahmed Ly said:

thank you bro

I have made a mistake xD

translations = {
["ا"] = "A" ,
["ب"] = "B" ,
}
function ArabicToEnglish(str)
  return str:gsub(".",translations) --I don't know whether this works
end

 

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...