I need to change strings from osCommerce format to phpBB.
I am working on a MOD to phpBB to integrate osCommerce and need all the language strings changed from the osCom format to the phpBB format.
I am wanting to write and expression to do the following but am having problems getting it to work: find code like this:
define('THIS_COULD_BE_ANYTHING', 'again anything');
and replace it with this
$lang['This_could_be_anything'] = 'again anything';
so that the first "T" in
Any pointers as to how to do this would be great - thanks. By the way - this is a great product, I use it at least once a week to update various files - searched through about 1000 files changing a couple of settings - fantastic ... well done.
It's very simple. We have to single out the two strings, the first one right after the opening bracket ending with the comma and the second one after the comma ending with the closing bracket.
define\(\'matches the initial
([^\']+)matches everything up to the first occurrence of a single quote (end of the first string);
\'\,\s+\'matches the ending quote, spaces and the starting quote:
([^\']+)matches everything up to the first occurrence of single quote (end of the second string);
\'\)\;matches the end of the text:
$lang['\u\L\1\E'] = '\2';
\u- tells to make the next symbol uppercase;
\L- forces further output lowercase, but
\2- insert the stored text;
- Type the search expression
define\(\'([^\']+)\'\,\s+\'([^\']+)\'\)\;in the Find What field.
- Type the replacement expression in the Replace With field:
$lang['\u\L\1\E'] = '\2';.
- Check the Regular Expressions box and uncheck the Force search only box.
- Click Replace.