[wp-trac] [WordPress Trac] #52696: __() avoiding default language fallback

WordPress Trac noreply at wordpress.org
Fri Jun 9 08:23:06 UTC 2023


#52696: __() avoiding default language fallback
--------------------------------------+-----------------------------
 Reporter:  drzraf                    |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  I18N                      |     Version:
 Severity:  minor                     |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:
--------------------------------------+-----------------------------

Comment (by ckanitz):

 Thanks for the feedback! I got the idea of your recommendation and agree,
 that `has_translation()` should be part of the `Translate()` (and
 `NOOP_Translate()`) class in `translations.php` and a wrapper in
 `l10n.php`.

 But that's just for the helper functions, which is nice to have, but
 wouldn't be quiet "elegant" if you'd have to loop over a bunch of strings
 instead of just calling the known translation functions with an extra
 parameter tweaking the returned value.

 We've started with an own function but since it was just a copy of `__` we
 dropped it and thought about a more DRY approach with a new optional
 nonbreaking parameter.

 If it's a real "no-go" to update the existing functions I'd propose for a
 new function after all but could need some help to find a better name
 instead of `__i18n_exists`.

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


More information about the wp-trac mailing list