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

Automatically copy name to short_name in web app manifest if not greater than 12 characters #212

Merged
merged 5 commits into from
Aug 20, 2019

Conversation

westonruter
Copy link
Collaborator

@westonruter westonruter commented Aug 16, 2019

Lighthouse complains if there is no short_name even when the name is not greater than 12 characters:

Screen Shot 2019-08-16 at 14 34 22

This PR fixes that problem by copying the name as the short_name when it is not longer than 12 characters:

Screen Shot 2019-08-16 at 14 36 44

Site Health

Additionally, checks are added to site health.

Screen Shot 2019-08-16 at 15 19 07

Screen Shot 2019-08-16 at 15 18 51

Screen Shot 2019-08-16 at 15 23 38

@westonruter westonruter added the web-app-manifest Web App Manifests label Aug 16, 2019
@westonruter westonruter added this to the 0.4 milestone Aug 16, 2019
@westonruter
Copy link
Collaborator Author

@swissspidy @schlessera the test environment is failing to initialize all of a sudden. The error is cryptic. Any idea what's going on?

$manifest = $this->get_manifest();

/* translators: %d is the max length as a number */
$description = sprintf( __( 'The <code>short_name</code> is a short version of your website&#8217;s name which is displayed when there is not enough space for the full name, for example with the site icon on a phone&#8217;s homescreen. It should be a maximum of %d characters long.', 'pwa' ), self::SHORT_NAME_MAX_LENGTH );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use a placeholder for short_name. Also, the first sentence is very long. I'd split it up to make translators' lives easier.

/* translators: %d is the max length as a number */
$description = sprintf( __( 'The <code>short_name</code> is a short version of your website&#8217;s name which is displayed when there is not enough space for the full name, for example with the site icon on a phone&#8217;s homescreen. It should be a maximum of %d characters long.', 'pwa' ), self::SHORT_NAME_MAX_LENGTH );

$actions = __( 'You currently may use <code>web_app_manifest</code> filter to set the short name, for example in your theme&#8217;s <code>functions.php</code>.', 'pwa' );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, I'd use placeholders for the filter and file name here.

@swissspidy
Copy link
Collaborator

The error message indicates that MySQL is not running.

Looks like the PWA plugin runs on Travis CI's Xenial build environment, which replaced the Trusty environment late last year.

According to the docs, "to speed up boot time and improve performance we’ve disabled all services, including the ones that are started by default on Trusty. Add any services that you want to start by default to your .travis.yml".

While that would explain the absence of the MySQL service, this would have been a problem already last winter, and not just pop up only now.

But let's try to see if updating the config helps.

@westonruter
Copy link
Collaborator Author

But let's try to see if updating the config helps.

Perfect! Setting to trusty fixed it. Eventually we can use Xenial as you suggested for the AMP plugin (ampproject/amp-wp#3044) since core imminently will require PHP 5.6.

@westonruter westonruter requested a review from swissspidy August 20, 2019 03:40
@swissspidy swissspidy merged commit 4e2b382 into master Aug 20, 2019
@swissspidy swissspidy deleted the add/auto-short-name branch August 20, 2019 19:42
@austintude
Copy link

What 'name' is being copied to the short name? Where do I check to make certain mine is less than 12 characters? I am still receiving this error.

@westonruter
Copy link
Collaborator Author

The name is the Site Title (the blogname).

@austintude
Copy link

austintude commented Sep 9, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web-app-manifest Web App Manifests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants