Skip to content

Instantly share code, notes, and snippets.

@idokd
Created May 16, 2023 12:23
Show Gist options
  • Select an option

  • Save idokd/76fec96e518dd144359674a6fe49bae0 to your computer and use it in GitHub Desktop.

Select an option

Save idokd/76fec96e518dd144359674a6fe49bae0 to your computer and use it in GitHub Desktop.
acfe - autosync php file with text domain for i10n
<?php
// acf-extended/includes/modules/autosync.php: line 450, in function save_file
if ( $l10n_textdomain = apply_filters( 'acfe/settings/php/l10n_textdomain', $l10n_textdomain ) ) {
$keys = apply_filters( 'acfe/settings/php/i10n_keys', [
'title',
'label',
'instructions',
'message',
'button_label',
'placeholder',
'prepend',
'append',
'message',
'default_value',
'acfe_display_title',
'description'
] );
$code = preg_replace('/(\\\'(?:' . join( '|', $keys ) . ')\\\').*(\\\'.*\\\')/', '$1 => __( $2, \'' . $l10n_textdomain . '\' )', $code );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment