Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2007
    Thanked 0 Times in 0 Posts

    Preg_replace & Gettext Problem


    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.
    Last edited by Alexey; 09-04-2007 at 03:10 AM.

  • #2
    Registered User
    Join Date
    Oct 2004
    Thanked 1 Time in 1 Post
    You wanna do something like search highlighting function.

    If returned result is hello
    then the desired output is

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


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts