#2376 closed defect (bug) (worksforme)
Localization problem in dashboard
Reported by: |
|
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)
Change History (20)
#2
follow-up:
↓ 5
@
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
@
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.
#5
in reply to:
↑ 2
@
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
@
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
@
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.
#9
@
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
@
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
@
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.
#12
@
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 :)
#14
in reply to:
↑ 13
@
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.
It works good for me :)
Are you using the .mo file from translate.wordpress.org ?