Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation error in "Showing" text box #647

Closed
lacroixca opened this issue Apr 4, 2016 · 2 comments
Closed

Translation error in "Showing" text box #647

lacroixca opened this issue Apr 4, 2016 · 2 comments

Comments

@lacroixca
Copy link

When filtering with -for example- job types in French, the showing text is wrong because of the way it is coded.

What Happens

It shows:

Afficher tous les postes Temps plein & Temps partiel postes

(poste = job, displayed twice)

What I Expected To Happen

It should show:

Afficher tous les postes Temps plein & Temps partiel

Code causing the problem

includes/class-wp-job-manager-ajax.php:178
`$result['showing'][] = $post_type_label;

if ( $search_location ) {
$result['showing'][] = sprintf( __( 'located in “%s”', 'wp-job-manager' ), $search_location );
}

if ( 1 === sizeof( $result['showing'] ) ) {
$result['showing_all'] = true;
}

$result['showing'] = apply_filters( 'job_manager_get_listings_custom_filter_text', sprintf( __( 'Showing all %s', 'wp-job-manager' ), implode( ' ', $result['showing'] ) ) );`

Solution

Do not add the Job label at the end of the text and change the sprintf() text:
`//$result['showing'][] = $post_type_label; //REMOVE THIS LINE

if ( $search_location ) {
$result['showing'][] = sprintf( __( 'located in “%s”', 'wp-job-manager' ), $search_location );
}

if ( 0 === sizeof( $result['showing'] ) ) { //CHANGE HERE
$result['showing_all'] = true;
}

$result['showing'] = apply_filters( 'job_manager_get_listings_custom_filter_text', sprintf( __( 'Showing all %sjobs', 'wp-job-manager' ), implode( ' ', $result['showing'] ) ) ); //ADD THE LABEL IN A TRANSLATABLE STRING`

@donnchawp
Copy link
Contributor

There's a bug in the translation itself, but you're right that the post_type_label should be translated.

The translated string is "Afficher tous les postes %s" where the English string is "Showing all %s".

donnchawp added a commit that referenced this issue Oct 7, 2016
Fixes #647
The original string was translated incorrectly to French but because of the way it was constructed it couldn't be easily translated correctly anyway. Since the search terms are already on the page I modified the string so it would display how many records had been found.
@donnchawp
Copy link
Contributor

I fixed it by rewriting this string in #776. We don't need to show the search terms as they're already displayed on the page. It's more useful to show a summary of the search so it shows the post type (Jobs) and the number of records found.

donnchawp added a commit that referenced this issue Oct 7, 2016
Fixes #647 (again)
My previous patch didn't account for plurals - for multiple records vs 1 record found.
Also dropping the post_type_label in like I did might not work in some languages. Props @akirk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants