May 2005 - Posts
I just finished stage 1 of a project that's long been overdue on my other site: jnadal.com --
Based on your naturalization settings, the site will translate the posts into whatever language you have as your preferred language (within the confines of English, Spanish, French, Italian, German, and Portuguese).
You can also try it out for now via a querystring:
English | Spanish | German | Italian | Portuguese | French
I used my translation engine at http://translate.jnadal.com and cache the results. Performance is fairly quick (new dedicated server), and the cache helps a ton! Now I just need to start putting more content up over there!
I just discovered overloads for webmethods cannot have the same name. Don't other platforms have the concept of differing method signatures with the same name?
Here's the fix to change the name of one or both methods via an alias:
[WebMethod(MessageName="MethodAlias")]
public ReturnType MethodName(string param1)
{
return MethodName(param1,"HardParam2");
}
[WebMethod(MessageName="MethodAliasPlain")]
public ReturnType MethodName(string param1, string param2)
{
//actual service code here.
}
After way too much time away, I have finally gotten around to refactoring my free translation web service, after a move to a new host (more on that later).
The service, which has been housed at:
http://www.restlessdelusions.com/projects/services/translate/translate.asmx
has had a bug with certain characters for quite a while. An English to Spanish translation of "This is mine." resulted in the garbled "?ste es el m?o", due to some encoding error I never had the time to fix. Well here's the answer: you can encode a StreamReader with a codepage based on the client's machine. To solve the problem, I created an enum based on microsoft's typography docs and created an overload which defaulted to Latin2 (Codepage 1250). There's also an overload if anyone using the service wants to choose a custom codepage.
You can try out the service via the asmx above, or use my Winform Sample
Enjoy!
More Posts