Basically trying to convert my whole zend framework website into multilingual. Initially there was no plan for it and view code was written without using a single wrapper function which we could use at the juncture. View code in all of the phtml files in my zf project looks like below:
<div class="contact">
<span class="edit">
<a href="javascript:void(0);">edit</a></span>
<h2>Job Board Info</h2>
<div class="info-grid">
<div class="field">Contact Name: </div>
<div class="field-info">
<?php echo "Good Guy";?>
</div>
</div>
<div class="info-grid">
<div class="field">Description: </div>
<div class="field-info">
<?php echo "He is a very good guy";?>
</div>
</div>
</div>
I want to search all phtml files for the texts like edit, Contact Name, Good Guy, Description, He is avery good guy and replace them with
<? echo translate("edit") ?>
<? echo translate("Contact Name") ?>
translate("Good Guy");
<? echo translate("Description") ?>
translate("He is avery good guy");
I can perform regex search and replace in all phtml files using Zend Studio but I am not sure what would be the right regex pattern in order to achieve this. Above texts are not fixed in all tenmplates but is and example only. The regex should skip all html code and find out texts only and replace them with . if any text being echoed like echo "text" should be replaced with translate("text").
Or please suggest some other way in order to achieve this as fast as possible.