Thursday 15 May 2014

Php regex: replacing localization string -


Stakhovrflo user Casmir as at Hiploit had this amazing work to replace me Strings [[some] ] $ this-> local strings. Returning to the _ () function

  $ that = $ this; $ View = preg_replace_callback ( '~ \ [\ [\ K (? & Gt; [^]] ++ |] (?!)) * ~', Function ($ m) use ($ that) {return $ that- & Gt; __ ($ m [0]);}, $ view);   

It does not replace the works except that it brackets so, if I have I18n file "Yes" is ", and my view file I [[Yes]] writes like [[life]]] .

I are spent a few hours and try but unfortunately - nothing. Any ideas? Sorry

, you can replace your patterns: < / P>

  $ that = $ this; $ view = preg_replace_c allback ( ':: [^]] + |] (?!))) * +)]] ~, use function ($ m), or $ (that) {return $ that - & gt; __ ($ m [ 1]);}, $ view);    

No comments:

Post a Comment