[wp-trac] [WordPress Trac] #41305: Add lazily evaluated translations

WordPress Trac noreply at wordpress.org
Fri Jul 14 06:18:08 UTC 2017


#41305: Add lazily evaluated translations
-------------------------+------------------------------------
 Reporter:  schlessera   |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  I18N         |     Version:  4.8
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  rest-api, performance
-------------------------+------------------------------------

Comment (by schlessera):

 I don't consider this "too clever", as I specifically introduced new
 methods instead of changing old ones, and they are documented to return a
 proxy object. Using proxy objects is a standard practice, and developers
 are free to not use these new methods if they don't understand what that
 means.

 What you propose means that you split the translation code up into two
 different locations for strings translated in this way. For more complex
 code, you'd basically need to run your strings through a check to make
 sure that translatable strings was indeed translated. I don't understand
 how this would be preferable.

 There are probably use cases where this makes sense, but as a general
 mechanism, I think this makes the code even worse, and introduces lots of
 bugs where we forgot to actually translate a translatable strings. This
 won't even be detected by any of our automated tests. With the proxy
 object above, you at least get an immediate error if you handle it
 incorrectly.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41305#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list