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

Hierarchical term selector: don't use variables in translatable strings #13936

Closed
afercia opened this issue Feb 18, 2019 · 0 comments
Closed
Labels
Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Feb 18, 2019

In core, it's a long established, good, practice to avoid post types, taxonomies, etc. variable names for placeholders in translatable strings. It doesn't work due to structural differences in languages: feminine, masculine, various form of plurals, etc.

const filterLabel = sprintf(
_x( 'Search %s', 'term' ),
get(
this.props.taxonomy,
[ 'name' ],
slug === 'category' ? __( 'Categories' ) : __( 'Terms' )
)
);
const groupLabel = sprintf(
_x( 'Available %s', 'term' ),
get(
this.props.taxonomy,
[ 'name' ],
slug === 'category' ? __( 'Categories' ) : __( 'Terms' )
)
);

These strings should be either simplified or use full translatable strings added in core for the taxonomies.

There are also other minor consequences. For example, in Italian (and I guess in many other languages) we don't use title casing. However, the first string placeholder is placed with the taxonomy name so the final result is a title cased string. Unpleasant to see, as all the other strings don't use title casing:

screenshot 2019-02-18 at 22 09 02

The second string is translated as:

aria-label="Disponibile Categorie"

which is wrong, but I can't blame translators as _x( 'Available %s', 'term' ) is difficult to translate and not visible in the interface.

In these cases, I'd recommend to:

  • either simplify the strings and remove placeholders
  • or introduce new taxonomie label in core and use them in the editor
@afercia afercia added [Type] Bug An existing feature does not function as intended Internationalization (i18n) Issues or PRs related to internationalization efforts labels Feb 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant