acomputerdood wrote...
it is, of course, nothing i can't handle
it's 99% done.
in the login (chat.cgi) script, you set the language of your nwnserver and database. this will be the language all submitted messages will be translated to, and all displayed messages will be transmitted from.
then, when a player loads the chat page, he selects the language he wants to chat in (only a couple exist now for development). then, all messages typed by that web user will be assumed to be in his chosen language and translated into whatever language the nwnserver/mysql db is set to. then, when the messages are displayed back to the web user, they are translated back into his chosen language.
for example, if your db is set to english, and the web user chooses spanish, then if he types "muy bien" into the web client, the page will translate it to "very well" and insert it into the db (and display it to nwn players). then, the webpage pulls the chat entry "very well" from the db and translates it back to "muy bien" for the web user (and "tres bien" for other web users who selected french).
to cut down on the number of translation transactions the webserver is doing, i'm using a client-side cookie to store the web user's previous translations. so only new messages are translated and then stored with the client. it's not the most elegant solution, but it wasn't feasible to save all of that in javascript GET strings.
so, what did i mean by 99% done? well, the bing translator's API key seems to expire each day, so i need to figure out a way to automatically pull it down.
conversely, you could sign up as a developer with a microsoft live account and get your own API key for the service. the page says you get 2,000,000 characters translated per month for free. it seems like a lot but i have no idea how that would scale out. i've not read the TOS, so i don't know if my webchat would be in violation or not.
so sorry i don't have a demo to show you guys (or haven't released my code yet!). until i can automatically grab whatever api key the web server uses (i'm not likely going to get my own), the demo won't be worth showing.
you'll just all have to trust me that it works! haha





Retour en haut







