Wordpress - Hook
    
Simone
    
    
      
    
  - wordpress
 
Hi,
nach langer Zeit brauche ich mal wieder etwas Hilfe.
Ok,
Ich benötige einen (Übersetzungs-) Hook
siehe -> https://plugins.trac.wordpress.org/browser/job-postings/tags/2.5.10/class-job-postings.php#L133
aus:
120	                                'position_employment_type' => array(
121	                                        'type'  => 'checkboxes',
122	                                        'name'  => _x('Employment Type', 'jobs-field', 'job-postings'),
123	                                        'need'  => 2,
124	                                        'key'   => 'position_employment_type',
125	                                        'placeholder' => _x('Start typing or double click to open suggestions', 'jobs-field', 'job-postings'),
126	                                        'sort'  => 'sort-right',
127	                                        'options' => array(
128	                                                "FULL_TIME" => __('Full-time', 'job-postings'),
129	                                                "PART_TIME" => __('Part-time', 'job-postings'),
130	                                                "CONTRACTOR" => __('Contractor', 'job-postings'),
131	                                                "TEMPORARY" => __('Temporary', 'job-postings'),
132	                                                "INTERN" => __('Intern', 'job-postings'),
133	                                                "VOLUNTEER" => __('Volunteer', 'job-postings'),
134	                                                "PER_DIEM" => __('Per diem', 'job-postings'),
135	                                                "OTHER" => __('Other', 'job-postings'),
136	                                        )
137	                               
138	                                        ),
soll das werden:
				'position_employment_type' => array(
					'type' 	=> 'checkboxes',
					'name' 	=> _x('Employment Type', 'jobs-field', 'job-postings'),
					'need'  => 2,
					'key'	=> 'position_employment_type',
					'placeholder' => _x('Start typing or double click to open suggestions', 'jobs-field', 'job-postings'),
					'sort' 	=> 'sort-right',
					'options' => array(
						"FULL_TIME" => __('Vollzeit', 'job-postings'),
						"PART_TIME" => __('Teilzeit', 'job-postings'),
						"CONTRACTOR" => __('Auftragnehmer', 'job-postings'),
						"TEMPORARY" => __('Temporär', 'job-postings'),
						"INTERN" => __('Praktikum', 'job-postings'),
						"VOLUNTEER" => __('Freiwillige', 'job-postings'),
						"PER_DIEM" => __('Pro Tag', 'job-postings'),
						"OTHER" => __('Other', 'job-postings'),
					)
				
					), 
Vielen, vielen Dank für Euer Feedback / Hilfe ;o)
Beste Grüße Simone
Liebe Simone,
122 'name' => _x('Employment Type', 'jobs-field', 'job-postings'), [...] 128 "FULL_TIME" => __('Full-time', 'job-postings'),
was genau tun die Methoden _x(...) und __(...)? Hast Du darauf Zugriff? Dort müsste man wohl jetzt ansetzen, um den jeweils ersten Parameter mit einer Übersetzungsfunktion zu erweitern.
Liebe Grüße
Felix Riesterer
Hallo Felix,
https://developer.wordpress.org/reference/functions/_x/
https://developer.wordpress.org/reference/functions/__/
Hm, hier ist eine Aussage vom Entwickler zu finden
https://wordpress.org/support/topic/translate-employement-type/
Demnach sollte es mit dem add_Filter Hook möglich sein... habe jedoch keinen Plan wie ich das umsetze
add_filter( 'gettext', 'theme_change_comment_field_names', 20, 3 );
function theme_change_comment_field_names( $translated_text, $text, $domain ) {
 
        switch ( $translated_text ) {
            case 'Name' :
                $translated_text = __( 'First Name', 'theme_text_domain' );
                break;
 
            case 'Email' :
                $translated_text = __( 'Email Address', 'theme_text_domain' );
                break;
        }
    
    return $translated_text;
}
Grüße Simone