Home › Forums › Feature Requests › Adjustable Textdomains and Textdomains in PHP Export › Reply To: Adjustable Textdomains and Textdomains in PHP Export
It’s an older question, but since I was looking for a solution myself, here is mine:
$textdomain = 'textdomain';
$code = preg_replace( '/\'label\' => (.{3,})\,/', '\'label\' => esc_html_x( $1, \'ACF ' . $field_group['title'] . ' Label\', \'' . $textdomain . '\' ),', $code );
$code = preg_replace( '/\'instructions\' => (.{3,})\,/', '\'instructions\' => esc_html_x( $1, \'ACF ' . $field_group['title'] . ' Instructions\', \'' . $textdomain . '\' ),', $code );
$code = preg_replace( '/\'append\' => (.{3,})\,/', '\'append\' => esc_html_x( $1, \'ACF ' . $field_group['title'] . ' Append\', \'' . $textdomain . '\' ),', $code );
$code = preg_replace( '/\'prepend\' => (.{3,})\,/', '\'prepend\' => esc_html_x( $1, \'ACF ' . $field_group['title'] . ' Prepend\', \'' . $textdomain . '\' ),', $code );
@kokers you can use (.{3,})
instead of (.*)
. Then only matches with 3 or more chars are evaluated.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.