Aller au contenu

Photo

dood's scripts and stuff


  • Veuillez vous connecter pour répondre
36 réponses à ce sujet

#26
acomputerdood

acomputerdood
  • Members
  • 219 messages

acomputerdood wrote...

it is, of course, nothing i can't handle :D


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

#27
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
I think it's cool you decided to take another crack at it, ACD.  In reading your response, I wasn't sure if by "web client" you really meant a client at a web page or if you were simulating the transaction with curl. I just played around with going through curl using some instructions from here, signing up with Microsoft for the free key and so on.  The signing up for the key seems simple enough (and I'd imagine 2M characters a month is plenty for most servers), but I couldn't pull of grabbing the "temporal access token" he describes in Step 3 and so couldn't really continue.

Man, a lot has changed since the last time I played around with this kind of thing.  A lot more than I would have expected.  :crying:

While this is a less sexy solution, there's always the possibility of moving away from proprietary APIs like Google and Microsoft, and looking at approaches which involve a local dictionary server using open source software/data.  Two that seem somewhat promising are Apertium and Moses, which looks a little more mature.  I have no experience running either of those beyond their demo translation web pages. 

#28
acomputerdood

acomputerdood
  • Members
  • 219 messages
OTR - yeah, by "web client" i meant my little cgi thing i wrote for my webpage. i tend to mix terms a little bit. so to clarify a bit, the cgi stuff is run on the server end, so the server was using curl to access bing's translation API to translate the text before sending it to the webpage of the user.

i may be inspired to take the extra tiny step and get myself an API key as well. perhaps i can get it working. so far i've just been using wireshark and chrome, so we'll see what i can do with that. or maybe if i had some actual instructions :)


and yes, i spent some time looking for offline free translators, but all i came up with would only translate single words. i didn't see any that did phrases like the online ones did.

i (quickly) looked at apertium, and it was very limited in the languages it would translate. moses seems a bit more promising, but i'll have to look at that more.

#29
acomputerdood

acomputerdood
  • Members
  • 219 messages
i got application key and figured out their API. the page of instructions OTR posted had a command that was out of date but i was able to figure out the correct one.

you guys can try out the new webchat translator.

for as long as my 2 million characters holds out each month.

i guess it's good enough to update my vault entry.

Modifié par acomputerdood, 27 juin 2012 - 04:36 .


#30
OldTimeRadio

OldTimeRadio
  • Members
  • 1 400 messages
Dood, you are amazing!  This is awesome!
Image IPB

#31
acomputerdood

acomputerdood
  • Members
  • 219 messages

acomputerdood wrote...

i got application key and figured out their API. the page of instructions OTR posted had a command that was out of date but i was able to figure out the correct one.

you guys can try out the new webchat translate.

for as long as my 2 million characters holds out each month.

i guess it's good enough to update my vault entry.


i've re-worked this (again).  it was bugging me that my "webchat translator" in the post above re-lied on client-side cookies for the translations, so i modified the whole system to save translations into a separate database table on the server.

i now give you webchat2.

(oddly enough, it won't translate the word "apple".  gave me fits trying to find a bug in my code)

Modifié par acomputerdood, 29 juin 2012 - 06:30 .


#32
nwnsmith

nwnsmith
  • Members
  • 67 messages
This is probably beyond the scope of this product but there might be others out here that can use this as well.

Concerning the CGI script in the player tracker I am not that swift in how to implement this into my website. I have used PHP in the past but that usually had tags at the beginning and end of the script to signify what it was. In any event could you link a tutorial to implement this into a site. I am using Rapidweaver which makes me that much more of an outcast but ANY guidance would be helpful.

#33
acomputerdood

acomputerdood
  • Members
  • 219 messages
i really don't know php at all, so i'm not planning to port any of my work into that language.

for CGI scripts, you'll have to set up a ScriptAlias directory and add .cgi to your AddHandler list. for actual help, see:

http://httpd.apache..../howto/cgi.html

#34
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages

<because he refuses...>

 

It's two years later and this subject recently came up and some old-school nwn members had never heard of these things... and when I went to find the things I remembered, I had a devil of a time finding it again :-P

 

Reread this thread from the start ;-) Great stuff!

 

<...to see something fine pass away>


  • Wall3T aime ceci

#35
Wall3T

Wall3T
  • Members
  • 461 messages

great stuff to share indeed, thanks rolo! The Grey Wall3t may have to deploy his seret weapon in effort to capture these old submissions. The links look like they were still on the Old Vault



#36
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages

<being a great admirer...>

 

Yup, those links are :-/

Well, if acomputerdood doesn't jump in and Carcerian doesn't beat me to it, I'll look at uploading these tomorrow.

*sly old wink*

 

<...of the grey fox>


  • Wall3T aime ceci

#37
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages

<pack-ratting...>

 

The projects listed in post #1 are now on the new Vault.

 

<...for all he's worth>