How to use native wordpress translation domain inside a custom plugin?

How to use native wordpress translation domain inside a custom plugin?

You would use __() without a textdomain, but this won’t work for you because that’s not how post status labels work.

get_post_status doesn’t return the name of the post status, it returns a slug, e.g. pending not Pending. The solution is in the user contributions for the get_post_status documentation:

https://developer.wordpress.org/reference/functions/get_post_status/#comment-5484

echo get_post_status_object( get_post_status( ) )->label;

As for the usage of __:

echo __($statut);

This should never be done, these should always be used with hardcoded strings, never variables. This also means that the way you pass data from the user or database into __ is simple, it is never done.

__ etc are there to translate hardcoded strings in your code, so that things like this: <p>Published date: ... can be translated. It’s not intended for dynamic/generated/database/user data. Translation scanning tools to generate PO and MO files depend on these containing hardcoded strings e.g. _( "Published Date:.... to detect translatable strings.

techhipbettruvabetnorabahisbahis forumuedueduseduedusedusedusedueduseduedus