私はちょうど完了しました、あなたの助けが役に立ちました! :-)
ここに興味のある人のための私の醜いコードです。 beautifuly符号化されないが、そう一日あたり10000回...
<?php
// define a plain text document to see what appen on test
header('Content-Type: text/plain; charset=UTF-8');
$dossier = 'pages/'; // folder to scan
$array_exclude = array('.', '..', '.DS_Store'); // system files to exclude
$array_sentences_list = array();
if(is_dir($dossier)) // verify if is a folder
{
if($dh = opendir($dossier)) // open folder
{
while(($file = readdir($dh)) !== false) // scan all files in the folder
{
if(!in_array($file, $array_exclude)) // exclude system files previously listed in array
{
echo "\n".'######## ' . strtoupper($file) . ' ##########'."\n";
$file1 = file('pages/'.$file); // path to the current file
foreach($file1 AS $fileline)
{
// regex : not start with a to z characters or a (
// then catch sentences into l(' and ')
// and put results in a $matchs array
preg_match_all("#[^a-z\(]l\('(.+)'\)#U", $fileline, $matchs);
// fetch the associative array
foreach($matchs AS $match_this)
{
foreach($match_this AS $line)
{
// technique of "I do not want to break my head"
if(substr($line, 0, 3) != "l('" AND substr($line, 0, 4) != " l('" AND substr($line, 0, 4) != ".l('")
{
// check if the sentence is not already listed
if(!in_array($line, $array_sentences_list))
{
// if not, add it to the sentences list array and write it for fun !
$array_sentences_list[] = $line;
echo $line . "\n";
}
}
}
}
}
}
}
closedir($dh);
}
}
?>
小型精密にロードされるようになされていない: - > CSS:私のように様々なケースをエスケープしなければならないの背景:URL( 'イメージ。 jpg '); と - > jQuery:$(this).html( 'bla bla'); 正規表現が[^ a-z(] :-)で始まる理由はここにあります。
これはとてもうまく動作します!後でmysqlテーブルにエントリを記録して終了し、サイトに変更があったときにいつでもスクリプトを読み込めるようにする必要があります。既存の翻訳をそのまま残し、既存のファイルを上書きします。それ。
ありがとう、このウェブサイトは本当に役立ちます! :-)
こんにちはアンドリュー、 私の正規表現は( 'と')の間のコンテンツを検索する必要がありますか?私はこれを試しなければならない、もしそれが仕事なら、答えとして質問をマークします、ありがとう! :-) –
Yeh。私はそれをl( 'と')の間で検索させます。 /l\\(((**?)\\\)/smiのようなもの –