View Full Version : Preg_replace & Gettext Problem

09-04-2007, 03:07 AM

I could not find any info on this so I will ask here, maybe someone has an experience with this.

Ok, so basically i`m taking a whole chunk of code from the database that is generated once in a while. My website has several languages so i want that translated to all languages.

I concatenated all the strings in the database-stored "chunk of code" via <ff> </ff>.

And then I use something like this:


I replaced _() with my tr() translating function and apparently it gets hit, just cant find the translation i guess.

When I use print _('same text'); it shows up correctly. So i`m guessing there's some issue locating the translations while using preg_replace like that.

I`m not looking for alternatives to storing the data, I`m looking for a solution to this problem if you have any.

Thanks for your time.

09-04-2007, 03:39 PM
You wanna do something like search highlighting function.

If returned result is hello
then the desired output is

<span class="highlight">hello</span>

Google :