Skip to:
Content

bbPress.org

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2376 closed defect (bug) (worksforme)

Localization problem in dashboard

Reported by: settle's profile settle Owned by:
Milestone: Priority: low
Severity: minor Version: 2.3.2
Component: Locale - i18n/l10n Keywords: needs-testing has-patch
Cc: kaipgis@…

Description

In /wp-admin/ bbPress widget: words like "Forums, Replies, and Topics" stay in english (everything is OK with other words).

It seems it stays in english because these words are used in other places as singular forms.

/includes/admin/metaboxes.php:

<?php
					$num  = $r['reply_count'];
					$text = _n( 'Reply', 'Replies', $r['reply_count'], 'bbpress' );
					if ( current_user_can( 'publish_replies' ) ) {
						$link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), get_admin_url( null, 'edit.php' ) );
						$num  = '<a href="' . $link . '">' . $num  . '</a>';
						$text = '<a href="' . $link . '">' . $text . '</a>';
					}
				?>

in bbpress.php:

			'name'               => __( 'Replies',                   'bbpress' ),
			'menu_name'          => __( 'Replies',                   'bbpress' ),
			'singular_name'      => __( 'Reply',                     'bbpress' ),

Singular form should be separated from plural form. Otherwise plural form stays not translated.

Attachments (5)

Screenshot from 2013-08-01 18:29:19.png (94.3 KB) - added by settle 12 years ago.
Poedit window
2376.diff (3.9 KB) - added by settle 12 years ago.
Patch which fixes the problem. Tested.
poedit.jpg (438.4 KB) - added by alex-ye 12 years ago.
wp-admin.jpg (335.5 KB) - added by alex-ye 12 years ago.
bbpress-ar.zip (20.8 KB) - added by alex-ye 12 years ago.
The test files to generate the screenshots above.

Download all attachments as: .zip

Change History (20)

#1 @alex-ye
12 years ago

It works good for me :)
Are you using the .mo file from translate.wordpress.org ?

#2 follow-up: @settle
12 years ago

I have used .pot file which comes with bbPress to translate it into lithuanian. So I use .mo file generated by Poedit. And it says "Reply" is used twice (see my screenshot).

#3 @johnjamesjacoby
12 years ago

  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to 2.5

Moving to 2.5. This was put into _n() explicitly to solve this problem back in 2.2 I believe, so it needs more testing.

#4 @settle
12 years ago

Shouldn't _nx be used here in such case?

#5 in reply to: ↑ 2 @alex-ye
12 years ago

Replying to settle:

I have used .pot file which comes with bbPress to translate it into lithuanian. So I use .mo file generated by Poedit. And it says "Reply" is used twice (see my screenshot).

You should read this post.
http://www.cssigniter.com/ignite/wordpress-poedit-translation-secrets/

Seems you have some problems in your Poedit configurations.
I will suggest to use GlotPress since it do all the magic :)

#6 @settle
12 years ago

Thank you for your URI but my Poedit is (and was) configured properly. I have translated WP, BP, few dozens of themes and plugins. And I feel _nx should be here.
GlotPress is not as comfortable as Poedit because I can test recently translated strings in my localhost instantly.

#7 @settle
12 years ago

Yes, _nx needs to be here.

I have edited /includes/admin/metaboxes.php

Instead of this:

$text = _n( 'Forum', 'Forums', $r['forum_count'], 'bbpress' );

I wrote:

$text = _nx( 'Forum', 'Forums', $r['forum_count'], 'plural', 'bbpress' );

Used Poedit command "Update form sources", and it worked.

It should be done with all 4 strings.

I will try to make a patch later if nobody else will.

@settle
12 years ago

Patch which fixes the problem. Tested.

#8 @settle
12 years ago

  • Cc kaipgis@… added
  • Keywords has-patch added

@alex-ye
12 years ago

@alex-ye
12 years ago

@alex-ye
12 years ago

The test files to generate the screenshots above.

#9 @alex-ye
12 years ago

@settle you can see that the translation is different from the widget and the post type menu even they refer to the same word 'Replies'.

As I know _n() functions have their own context so no need to use _nx() in this place.

#10 @alex-ye
12 years ago

and if you focus on this:
https://bbpress.trac.wordpress.org/attachment/ticket/2376/poedit.jpg

You can see the context tabs depending on the number, I have used the 'Plural Form' for the Arabic language, adjust it for your language from the Poedit settings.

#11 @settle
12 years ago

Well, I am just translating, my IT knowledge here is pretty low. I just noticed some words stay not translated, and I am asking to fix it. I know using _nx fixes my problem but it can be fixed in any other way you know. I just need it to be fixed. Maybe everything works for you but I have an issue in current version.

_n has domain, not context
http://codex.wordpress.org/Function_Reference/_n
http://codex.wordpress.org/Function_Reference/_nx

Plus one related ticked in WP: http://core.trac.wordpress.org/ticket/16423

EDIT: Yes, I see your file from GlotPress is OK but .pot file which comes with plugin archive is not.

Last edited 12 years ago by settle (previous) (diff)

#12 @alex-ye
12 years ago

I understand you @settle , I just help your to fix your problem without need to wait for bbPress update. Not everything wrong we see is a bbPress bug.

Well, The file I attached here is not from GlotPress it's auto generated from the Poedit, and I am sure if you set the Plural Form correctly this will fix many many problems not only the one in this ticket. It's from the basics to deal with the GetText translations.

The WordPress ticket you mention is different ( Totally Different ) from the one here, It's not wise to use the context functions everywhere for performance and ease-of-use even logical reasons.

We use the context functions when we refer to different things by the same word, like the example in the WordPress ticket 16423, which is the opposite here :)

#13 follow-up: @johnjamesjacoby
12 years ago

What's the verdict here? Seems like _n() should suffice?

#14 in reply to: ↑ 13 @alex-ye
12 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

Replying to johnjamesjacoby:

What's the verdict here? Seems like _n() should suffice?

_n() works fine, there is not a bug here.

#15 @johnjamesjacoby
12 years ago

  • Milestone 2.5 deleted

Thanks!

Note: See TracTickets for help on using tickets.