Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#6149 closed defect (bug) (fixed)

i18n strings logical issues

Reported by: slaFFik Owned by:
Priority: normal Milestone: 2.5
Component: I18N Version:
Severity: major Keywords: needs-patch
Cc:

Description

Such things are very bad for i18n - generating translatable strings on a fly.

if ( 'delete-group' == $menu['slug'] ) {
    $title = sprintf( _x( '%s Group', 'Group WP Admin Bar delete link', 'buddypress' ), $menu['name'] );
}

I'm not only talking about this particular example, but the whole attitude.
In German that can be a one word, in Russian - we have tons of forms of words ("удалить группу", "удаление группы" etc - which mean the same but have different suffixes and endings depending on the context), other languages can have the word "Delete" split into several parts, where one should be before "Group", another - after it.

Change History (11)

#1 @boonebgorges
12 years ago

  • Keywords needs-patch added
  • Milestone Awaiting ReviewFuture Release

With directory titles, we solved this in [8090]. See #4631.

In the particular case of 'delete-group', it looks like we should just be able to use a literal string 'Delete Group'.

slaFFik, if you know of other specific cases like this, please do list them here.

#2 @slaFFik
12 years ago

bp-core-component.php

<label class="screen-reader-text" for="bp_components[<?php echo esc_attr( $name ); ?>]"><?php sprintf( __( 'Select %s', 'buddypress' ), esc_html( $labels['title'] ) );  ?></label>

#3 @slaFFik
12 years ago

bp-groups-adminbar.php:

$title = sprintf( _x( 'Edit Group %s', 'Group WP Admin Bar manage links', 'buddypress' ), $menu['name'] );

#4 @slaFFik
12 years ago

That's what I've found. But I may miss some strings, as there are hundreds (literally, like ~400) of such places (translatable strings with variables injections via sprintf() or printf()).

#5 @boonebgorges
12 years ago

  • Milestone Future Release2.3

Thanks very much for the specific examples, @slaFFik.

For the screen-reader-text, we can probably safely remove the translatable string altogether, and replace it with the component name. If someone thinks it's extremely important to have a verb in here, let's use the format 'Select component: %s', which is not terribly elegant, but should decline OK in most languages.

The 'Edit Group' link should either be changed to a string literal 'Edit Group' (with no group name), or a colon should be added 'Edit Group: %s'.

A general rule here is that we should never sprintf part of an English sentence. Nouns decline differently in different languages, verbs conjugate in ways we can't predict, etc. We should only sprintf stuff like URLs, CSS classes, etc. I'm guessing that most of the cases of sprintf() or printf() follow this rule, but there are probably many places where we can improve.

I'm going to move this ticket to 2.3 so that we can handle the specific strings listed here. As you continue to find more, please post them on this ticket.

This ticket was mentioned in Slack in #buddypress by boone. View the logs.


12 years ago

#7 @boonebgorges
11 years ago

In 9670:

Improve localizability of screen reader text on bp-members list tables.

See #6149.

#8 @boonebgorges
11 years ago

  • Milestone 2.32.4

Let's continue this epic journey in 2.4.

#9 @DJPaul
11 years ago

  • Milestone 2.42.5

#10 @DJPaul
11 years ago

  • Resolutionfixed
  • Status newclosed

I'm going to close this epic journey as we've not had any further instances logged in this ticket in 10 months.

#11 @DJPaul
10 years ago

  • Component Locale - i18nI18N
Note: See TracTickets for help on using tickets.