Hello everyone, first THANX for taking the time to read my inquiry.

I have some experience in PHP but i have to admit this is way beyond my skills. So im calling for any PHP GURU out there to please help me decipher this one.

Heres the background.
Need to translate the strings on a script's php lang file from english to spanish.

Example, taken from actual english.php lang file

$lang['restricted_area'] = 'Restricted area! Please login';

Thing is this is a huge script and there are hundreds of lines to translate (approximatively 2000) so by hand is not an option.

So, decided to embrace the power of PHP came up with a script to automatically translate lang files via google. Everything works fine just need the correct preg_match_all regexp

The code.
All my lang files have this same structure:

$lang['weekly_rate'] = '[COLOR="Green"][B]Weekly rate[/B][/COLOR]';
$lang['weekly'] = '[COLOR="Green"][B]Weekly[/B][/COLOR]';
$lang['week'] = '[COLOR="green"][B]Week[/B][/COLOR]';
$lang['write_a_review'] = '[COLOR="green"][B]Write a review[/B][/COLOR]';
$lang['review_error'] = '[COLOR="green"][B]Write review. Error![/B][/COLOR]';
$lang['review_ok'] = '[COLOR="green"][B]Your review has been submited.[/B][/COLOR]';

So the correct regexp must be able to grab EXACTLY whats being highlighted in GREEN and nothing else 😕

I have read a GREAT tutorial all about the syntax of this regexp, learned what are this for ". * ? $ /b /B /s /S" etc

But its over heating my brain haha cant find the right regexp, thus I respectuflly implore to the gurus of this forum to help a simple mortal from a certain brain overheat-death! :xbones:

Best regards to all, Hope someone is up for the challenge!
Cheers!

    If it's already in PHP why not take advantage of the fact? Include the file and you have an array with all the strings all separated out and ready for you - even to the point of being associated with their array keys so you know which string's which.

      Write a Reply...