tags:

views:

24

answers:

1

Hello What method is the most efficient when translating bunches of text/web pages including HTML? I want to translate the text, but keep the HTML.

Also, should I keep the words in a database or an array?

+1  A: 

When you say "translating", do you mean from one language to another? If so, you can use regular expressions to capture the data between open and closing tags of your HTML without losing the markup. I'm not sure however why you would want to store your data in a database, unless you were going to retrieve it at a later point?

If this is for a translation on the fly, it will always be faster to store your data in memory -- your Array or simply update the HTML while you loop through the data and eliminate the need for an Array altogether.

George
Yes, it's translating from one language to another. Thanks :)
Terw