User tests: Successful: Unsuccessful:
According to the discussion in #41063 the _ function in the view class should be renamed to text to be more meaningful.
| Category | ⇒ | Administration com_content Libraries Unit Tests |
| Status | New | ⇒ | Pending |
I also thought about t() but it also doesn't say anything what it is doing on, trans is longer and then text and is not a complete word ;-) beside that, as brain mentioned and I also mentioned internally could look like "more work the developer that doesn't like to translate text" (just an opinion).
__ is only 2 characters shorter then text and actually has no meaning, especially for people which are not developer and only want to modify a template override.
So I'm in favor for text().
| Status | Pending | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-06-28 12:21:27 |
| Closed_By | ⇒ | HLeithner | |
| Labels |
Added:
?
PR-4.4-dev
|
||
So it's worth noting that
_is a native PHP Function - which I assume is why it was picked in the first place which is an alias forgettexthttps://www.php.net/gettext (not that we're using this but I assume that people were assumed to be familiar with it)So did some digging around just to compare what people do. Several bigger projects effectively build their own global function which is designed to mimic the PHP API:
Laravel (
__https://laravel.com/docs/10.x/localization)Wordpress (
__https://developer.wordpress.org/apis/internationalization/internationalization-functions/)Things that are more like this proposal:
Drupal https://www.drupal.org/docs/7/api/localization-api/localization-api-overview (a
tfunction)Symfony https://symfony.com/doc/6.2/the-fast-track/en/28-intl.html (via twig has a
transfunction)