Note that there are some explanatory texts on larger screens.

plurals
  1. POsearch and replace in php template files
    primarykey
    data
    text
    <p>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:</p> <pre><code>&lt;div class="contact"&gt; &lt;span class="edit"&gt; &lt;a href="javascript:void(0);"&gt;edit&lt;/a&gt;&lt;/span&gt; &lt;h2&gt;Job Board Info&lt;/h2&gt; &lt;div class="info-grid"&gt; &lt;div class="field"&gt;Contact Name: &lt;/div&gt; &lt;div class="field-info"&gt; &lt;?php echo "Good Guy";?&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="info-grid"&gt; &lt;div class="field"&gt;Description: &lt;/div&gt; &lt;div class="field-info"&gt; &lt;?php echo "He is a very good guy";?&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I want to search all phtml files for the texts like <strong>edit</strong>, <strong>Contact Name</strong>, <strong>Good Guy</strong>, <strong>Description</strong>, <strong>He is avery good guy</strong> and replace them with</p> <pre><code>&lt;? echo translate("edit") ?&gt; &lt;? echo translate("Contact Name") ?&gt; translate("Good Guy"); &lt;? echo translate("Description") ?&gt; translate("He is avery good guy"); </code></pre> <p>I can perform <em>regex search and replace</em> in all phtml files using <strong>Zend Studio</strong> 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 <em></em>. if any text being echoed like <strong>echo "text"</strong> should be replaced with <strong>translate("text").</strong></p> <p>Or please suggest some other way in order to achieve this as fast as possible.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload