Snippets

Дејан Стјепановић Replace text in HTML (l10n)

Created by Дејан Стјепановић

File snippet.markdown Added

  • Ignore whitespace
  • Hide word diff
+Regex:
+
+```
+([^-|^\?|^=])>\s*([^<|\n]*\w+[^<|\n]*)\s*<
+```
+
+Replace with:
+
+```
+$1><?php echo \$this->translate('$2'); ?><
+```
+
+--------------------
+
+Original:
+
+```
+<a href="#" class="quick-view">
+    <b><span class="icon"></span> Quick view</b>
+</a>
+```
+
+After replace:
+
+```
+<a href="#" class="quick-view">
+    <b><span class="icon"></span><?php echo $this->translate('Quick view'); ?></b>
+</a>
+```
+--------------------
+
+*Tested in PhpStorm*
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.