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

CPT: Use translated labels from type object for empty content #5346

Merged
merged 2 commits into from May 26, 2016

Conversation

Projects
None yet
4 participants
@aduth
Copy link
Member

aduth commented May 11, 2016

This pull request seeks to use the exact labels as provided from the post types REST API endpoint when there are no posts to be shown on the custom post types list screen. This is to address localization concerns for languages where the context of the post type as used in the sentence could alter its translation.

Before After
Before After

Open questions:

  • Are there better labels we can use that apply generally to all post types? See drafts as example, "You don't have any drafts." applies to all post types and works well across languages.

Testing instructions:

Verify that post type labels are shown when there is no content to be displayed on the custom post types list screen.

  1. Navigate to the custom post types list screen
  2. Select a site
  3. In the address bar, change add a status after /post where posts do not exist (e.g. /post/pending or /post/private)
  4. Note that the empty content warning is appropriately localized with correct labels

/cc @ockham @mcsf

@mcsf

This comment has been minimized.

Copy link
Member

mcsf commented May 11, 2016

A few things:

  • I believe the before/after screenshots are mixed up :)
  • This seems to be working in general, having tested for pt and de, aside from en
  • For Jetpack sites, the labels will match the site's own locale, which may be different from the WP.com user's locale. For instance, a en Jetpack sandbox with a pt Calypso:

screen shot 2016-05-11 at 22 40 35

This becomes a little stranger (or, at least, inconsistent) when you navigate from any state like private to draft, since draft gets its own string from Calypso:

screen shot 2016-05-11 at 22 40 55

This is something of an edge case, but I guess it's good to be aware of it.

Not a part of the actual change, but still important:

The biggest oddity is the hardcoded line 'Would you like to create one?', which doesn't work well with a lot of languages. A concrete example is gender — nouns like page or post may carry gender, and the pronoun one needs to reflect the gender. In Portuguese:

  • a post is um artigo, masculine; the hardcoded line would be: Quer criar um?
  • a page is uma página, feminine; the hardcoded line would be: Quer criar uma?

German, French and indeed most Indo-European languages will have the same problem.

Also, the current hardcoded phrasing is awkward even in English, if the user is looking at drafts:

  • UI sez: You don't have any drafts. Would you like to create one?
  • User sez: Create what, a draft? Or an actual post/page/…?

(Feel free to ignore this if you want to get this particular PR merged quickly.)

@aduth

This comment has been minimized.

Copy link
Member

aduth commented May 16, 2016

For Jetpack sites, the labels will match the site's own locale, which may be different from the WP.com user's locale. For instance, a en Jetpack sandbox with a pt Calypso:

Hmm, there could be one or two contributing factors here:

  • Localization was not respected for default post types until Jetpack 4.0.3+ (Automattic/jetpack@30428ac, r131176-wpcom)
  • The Jetpack site is aware of the localization parameter, but does not have the language files necessary to translate the string to Portuguese

I do agree this can lead to confusing scenarios where strings are translated differently in Calypso, but I don't see an obvious solution to this problem.

The biggest oddity is the hardcoded line 'Would you like to create one?', which doesn't work well with a lot of languages.

This makes sense to me. Do any alternatives come to mind as improvements on these strings? Perhaps one which doesn't reference the noun, avoiding the gender issue?

"Would you like to start writing?"

This doesn't feel especially applicable to all post types, though, such as a real estate listing custom post type for a Jetpack site.

As an aside, these strings were adopted from existing posts/pages screens, which would similarly be affected by any translation confusion.

/cc @mtias

@mcsf

This comment has been minimized.

Copy link
Member

mcsf commented May 16, 2016

Thanks for the detailed answer.

I do agree this can lead to confusing scenarios where strings are translated differently in Calypso, but I don't see an obvious solution to this problem.

Agreed.

Do any alternatives come to mind as improvements on these strings?

Something like the one you suggested — "Would you like to start writing?" — could work, though I'd also consider the existing l10n'd labels, since AFAIK wp-admin always requires an equivalent to "Add a new post" to be available for any given CPT. Sure, it's less flexible/colloquial and slightly more robotic in the context of that empty-state screen, but it's reliable.

As an aside, these strings were adopted from existing posts/pages screens, which would similarly be affected by any translation confusion.

Indeed. :)

@aduth

This comment has been minimized.

Copy link
Member

aduth commented May 17, 2016

though I'd also consider the existing l10n'd labels, since AFAIK wp-admin always requires an equivalent to "Add a new post" to be available for any given CPT.

We're already using the add_new_item (e.g. "Add New Post") for the action button text. Aside from this one, I don't see a decent alternative label from the built-in set (reference), so maybe it's better to omit the secondary line altogether? Or, we could hard-code some lines for known post types like portfolio and testimonial and omit the line only for custom post types on self-hosted Jetpack sites.

@aduth aduth force-pushed the fix/cpt-empty-content-i18n branch from 20e8ded to ce61054 May 24, 2016

@aduth

This comment has been minimized.

Copy link
Member

aduth commented May 24, 2016

Circling back to this PR, rebased and pushed an update to remove the secondary "Would you like to create one?" line.

I'm fine to iterate on this more in subsequent PRs, but it'd be a good idea to get these strings out of the codebase before they cause too much confusion.

@timmyc

This comment has been minimized.

Copy link
Member

timmyc commented May 25, 2016

LGTM

@aduth aduth force-pushed the fix/cpt-empty-content-i18n branch from ce61054 to 7beab51 May 26, 2016

@aduth aduth merged commit 83e3847 into master May 26, 2016

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@aduth aduth deleted the fix/cpt-empty-content-i18n branch May 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment