I'm writing an extension to our website to publish it into multiple languages. This is a dynamic site with content often provided by users.
The solution we came up with was this:
read the contents of the output buffer in the onRequestEnd.cfm and write it to a file somewhere on the webroot...
call a translation service with cfhttp and point it to that file I just created...
this cfhttp call will return a translated version of that page in the filecontent variable...
reset the content of the page: <cfcontent reset=true>
output the translated code.
The only piece I'm having trouble with is reading in the output stream. I cannot use cfsavecontent to wrap each page because we have thousands of pages, and it would be a pain in the arse to wrap each one. I think the best way to do this is by reading the output stream.
The only close example I've seen of this is on Christian Cantrell's site. This code accesses the stream and writes to it:
<cfscript>
context = getPageContext();
context.setFlushOutput(false);
response = context.getResponse().getResponse();
out = response.getOutputStream();
response.setContentType("image/jpeg");
response.setContentLength(arrayLen(pic));
out.write(pic);
out.flush();
out.close();
</cfscript>
Kind of the opposite of what I want but it proves it can be done. Has anyone done this?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

