Jump to content

Translate US English to UK English Dynamically


pmgosling

Recommended Posts

I have a US website that needs recreating for the UK market. All of the content is the same so I'm thinking there must be a way I can do a big find and replace as the page loads. That way I dont have to duplicate all of the files.It is built in ASP. Any ideas how this could be achieved? I have googled for solutions but nothing really fits what I want.Thanks

Link to comment
Share on other sites

how much of it is really going to have to be different? Are you going to add u's to words like color? :)

Link to comment
Share on other sites

how much of it is really going to have to be different? Are you going to add u's to words like color? :)
You mean putting them back to how they're supposed to be? :) :)Jokes aside..if you use american english (the wrong one) on a site aimed at the UK, then we will notice, take great offence and leave the site.:)
Link to comment
Share on other sites

that's because you take everything way too seriously to begin with. :) Anyway, all funny business aside, just space the site out with appropriate Black Adder and Monty Python jokes and they'll be happy.

Link to comment
Share on other sites

Although I'd love the site to be full of Monty Python, they might not...Basically I am thinking I will just have a list of all the words that change, like color > colour and optimize > optimise etc and as the page loads do a find replace on all of the words found.I cant think of a better way of doing it and not duplicating the code. Is there a way of doing such a find replace? I know how to do it on a string, but I want to do the whole page except html tags...

Link to comment
Share on other sites

There is a way in PHP, but no idea in ASP.If theres something like in PHP where you have an array of all the words you want to change, and another array with the changed values, then do a replace on all content thats outputted to the page, presuming all the content is dynamically generated by a database and not just hand coded into the HTML.Such as this in PHP taken from php.net

// Provides: You should eat pizza, beer, and ice cream every day$phrase  = "You should eat fruits, vegetables, and fiber every day.";$healthy = array("fruits", "vegetables", "fiber");$yummy   = array("pizza", "beer", "ice cream");$newphrase = str_replace($healthy, $yummy, $phrase);

Link to comment
Share on other sites

You can't really do anything if it's hard-coded. I suppose you could write an output filter for the web server to translate everything, but that seems like a lot of trouble to go to for this. It would be easier to rewrite the site dynamically and either look up content from a database or get it with text files, and just write the appropriate content to the pages.

Link to comment
Share on other sites

Thanks for the input,I am a Brit living in US so have this debate all the time. End of the day it's called English so what ever is used in England should reign supreme. But life isnt that simple.American is usually simpler, spell it how it sounds type approach which makes sense. But is still wrong

Link to comment
Share on other sites

Kind'a offtopic, but I should jump in to hopefully settle the US vs. UK debate:My father knows pretty much nothing from the English language, and from his pespective, regardless of whether we're talking about US or UK English, English speaking people talk too softly, and rarely spell what they say... and I must say he's right. Unfortunatly, Bulgarian isn't very different in that regard either. Russian (which he knows well) is also problematic. He says German is basically the only language where almost always people say what they write... I don't know any German, so I don't know for sure. Either way, you have to admit that in English, consonants can be pronouced very differently, depending on their position in the syllable and/or word. Not to mention that vowels can also sometimes be pronouced differently - "o" can also be pronouced like "u", and "a" can be pronouced as "e" in some cases.On topic:You could use a single "gateway" script that all requests will be redirected/rewritten to. This file can then fetch the static content, and replace the words if it must. You may need the IIS7 RewriteModule for this though.

Link to comment
Share on other sites

Jonas - I love Eddie Izzard!!

You could use a single "gateway" script that all requests will be redirected/rewritten to. This file can then fetch the static content, and replace the words if it must. You may need the IIS7 RewriteModule for this though.
Boen_robot, any ideas where I can find a little more info on this suggestion? I have never done anything like that before so would require further reading. Thanks !
Link to comment
Share on other sites

On IIS's web site of course. The kind of expression you need is for everyone not matching
^((images|style)\/)*

(i.e. anything that isn't a CSS file, an image, etc.)rewrite the URL to

replacer.aspx?file={SCRIPT_NAME}&

or something similar (and also append the query string btw)Personally, I place all of my files in folders prefixed with "_", and I match that. I then know for sure that if a URL doesn't start with "_", URL rewriting must have occured. In your case, this may mean rewriting all image and CSS references, so you can instead use the approach above.Btw, "course"... one more word that's very fancy, phonetically wise that is. If you spelled it the way it's pronounced, it would probably be spelled as "kors". But nooo... we must all cheat at scrabble :) .

Link to comment
Share on other sites

I'll have to agree with you boen_robot that the English language (US or UK) is one of the most challenging to learn to write. A lot of words are spelled really wonky. And there's exceptions to all the rules. The word weird for example breaks the "i before e except after c" rule. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...