Jump to content

Multi-language server.


monumento

Recommended Posts

Hey. I have a question about the multi-language. What would be best for you?

#1:

  
-- some code 
if getElementData(element, "s:lang") == "pl_PL" then 
   outputChatBox("omgwtf POL") 
elseif getElementData(element, "s:lang") == "en_US" then 
   outputChatBox("omgwtf ENG") 
end 
-- somecode 
  

or...

  
function langKey(playah, langKey) 
   if getElementData(element, "s:lang") == "pl_PL" then 
      -- searching for langKey in mysql database 
   elseif getElementData(element, "s:lang") == "en_US" then 
      -- searching for langKey in mysql database 
   end 
   return langKey 
end 
function cmd(player) 
   outputChatBox(langKey(playah, "lang.command.test")) 
end 
-- command handler 

(it's just pseudocode)

Which would be better for you? The second option wouldnt lag me cuz i'd use the PHP requests instead of lagging mysql_query from MTA.

Link to comment

If I understand correctly, you want to have multi-language phrases.

If that's the case, I wouldn't use neither. I'd use just standard files that contain a table of phrases. This way translators are able to edit these quite easily and you can strip it all in PHP to make a web application for translators and generate a new Lua file on each save.

I don't like fetching irrelevant information continuously from the database, especially stuff like translations that could be saved in files for easier accessibility. Many translation programs also allow importing of some specific type of files, including files that consist out of arrays, which contains different nodes for different sub-pages or so, and then within those they have a node for events and common phrases.

And then there's XML and JSON.

P.S.

Doesn't matter where you trigger your MySQL queries, it's the same speed and efficiency everywhere especially if they're all located in a single box and so hosted locally.

And I wouldn't use mysql_query, or that module anyway. Use the standard database functionality built within MTA:SA instead.

Link to comment
If I understand correctly, you want to have multi-language phrases.

If that's the case, I wouldn't use neither. I'd use just standard files that contain a table of phrases. This way translators are able to edit these quite easily and you can strip it all in PHP to make a web application for translators and generate a new Lua file on each save.

I don't like fetching irrelevant information continuously from the database, especially stuff like translations that could be saved in files for easier accessibility. Many translation programs also allow importing of some specific type of files, including files that consist out of arrays, which contains different nodes for different sub-pages or so, and then within those they have a node for events and common phrases.

And then there's XML and JSON.

P.S.

Doesn't matter where you trigger your MySQL queries, it's the same speed and efficiency everywhere especially if they're all located in a single box and so hosted locally.

And I wouldn't use mysql_query, or that module anyway. Use the standard database functionality built within MTA:SA instead.

Isn't a db easier to edit? Or... maybe the better idea would be loading all phrases from DB (i really want to make a PHP interfrace so the MySQL is best for me) when server starts and then just making a table with them. Also good.

P.S:

I just wont to call the query from MTA SERVER because i want maximum speed, the PHP server and callRemote will do their job correctly. (I guess it's faster :D)

P.S2: Is there a possibility to change the callRemote user-agent (if the MTA is acting like a browser(?) when executing a callRemote)?

@Edit: Nevermind P.S2. I found LuaSocket, i'll testi it later. Hope it'll give me exactly what what i expect.

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...