Make WordPress Core

Opened 3 months ago

Last modified 5 days ago

#58696 new defect (bug)

Installation pages do not have JS translations

Reported by: sabernhardt's profile sabernhardt Owned by:
Milestone: 6.4 Priority: normal
Severity: normal Version: 5.5
Component: I18N Keywords: has-patch needs-testing
Focuses: javascript Cc:

Description

The password toggle buttons on install.php and setup-config.php have translated visible text and aria-label when the page loads, but then the visible text becomes "Show" or "Hide" when I click on the button (the aria-label becomes "Show password" or "Hide password"). The setup-config.php toggle was just added in [56008], but the install.php page apparently has had trouble with those buttons and/or the password strength meter for several releases.

Attachments (6)

install-fr-63b2.webm (406.7 KB) - added by sabernhardt 3 months ago.
installation page in WordPress 6.3 beta 2, choosing French: the password toggle button and password strength meter show English text
install-fr-55.webm (387.0 KB) - added by sabernhardt 3 months ago.
in WordPress 5.5, the installation page password visibility toggle button showed English text with interaction, but password strength meter had French translation
profile-fr-63b2.webm (277.6 KB) - added by sabernhardt 3 months ago.
both the password toggle button and password strength meter show French text on the Profile page in WordPress 6.3
Translated.png (768.9 KB) - added by NekoJonez 8 weeks ago.
Untranslated 5.5.png (356.2 KB) - added by NekoJonez 8 weeks ago.
Untranslated.png (664.5 KB) - added by NekoJonez 8 weeks ago.

Change History (17)

@sabernhardt
3 months ago

installation page in WordPress 6.3 beta 2, choosing French: the password toggle button and password strength meter show English text

@sabernhardt
3 months ago

in WordPress 5.5, the installation page password visibility toggle button showed English text with interaction, but password strength meter had French translation

@sabernhardt
3 months ago

both the password toggle button and password strength meter show French text on the Profile page in WordPress 6.3

#1 @sabernhardt
3 months ago

The password toggle buttons and strength meters work for me on the Login, New User, User Profile and Writing Settings pages. Those use wp_enqueue_script(); Install and Setup Config pages use wp_print_scripts().

script from Install page in WordPress 5.4.2:

/* <![CDATA[ */
var userProfileL10n = {"warn":"Votre nouveau mot de passe n\u2019a pas \u00e9t\u00e9 enregistr\u00e9.","warnWeak":"Confirmer l\u2019utilisation du mot de passe faible","show":"Afficher","hide":"Cacher","cancel":"Annuler","ariaShow":"Afficher le mot de passe","ariaHide":"Cacher le mot de passe"};
/* ]]> */
</script>
<script type='text/javascript' src='http://localhost/wp54/wp-admin/js/user-profile.js?ver=5.4.2'></script>

script from Install page in WordPress 5.5:

<script type='text/javascript' id='user-profile-js-translations'>
( function( domain, translations ) {
	var localeData = translations.locale_data[ domain ] || translations.locale_data.messages;
	localeData[""].domain = domain;
	wp.i18n.setLocaleData( localeData, domain );
} )( "default", { "locale_data": { "messages": { "": {} } } } );
</script>
<script type='text/javascript' src='http://localhost/wp55/wp-admin/js/user-profile.js?ver=5.5' id='user-profile-js'></script>

[52937] removed the empty translations script later

#2 @joedolson
3 months ago

Do you think that this would better belong in the I18n component?

#3 @sabernhardt
3 months ago

  • Component changed from Upgrade/Install to I18N

It can fit both, but yes it's probably better in i18n.

@NekoJonez
8 weeks ago

#4 @NekoJonez
8 weeks ago

I have taken screenshots from @sabernhardt video's since this kept bugging out on VLC and my computer... As a polyglot, I find this kind of things quite important to fix.
Currently, the issue is only showing when you are installing WP and not on other labels.

I also tested this with my locale nl_BE and had the exact same behavior. So, it doesn't look like a problem with the translations themselves.

Since, they are in the pack...

Show: https://translate.wordpress.org/projects/wp/dev/admin/nl-be/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=928&filters%5Btranslation_id%5D=107216845

Hide: https://translate.wordpress.org/projects/wp/dev/admin/nl-be/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=929&filters%5Btranslation_id%5D=75419389

And as in the example:
The labels for the password strength: https://translate.wordpress.org/projects/wp/dev/nl-be/default/?filters%5Bterm%5D=password+strength&filters%5Bterm_scope%5D=scope_context&filters%5Bstatus%5D=current&filters%5Buser_login%5D=&filter=Apply+Filters&sort%5Bby%5D=translation_date_modified&sort%5Bhow%5D=desc

Also, is it me or is the label not in bold during the install and in the UI it is in bold...?

#5 @NekoJonez
8 weeks ago

Possibly related: #59024

This ticket was mentioned in Slack in #core-performance by joemcgill. View the logs.


5 weeks ago

#7 @joemcgill
5 weeks ago

  • Milestone changed from Awaiting Review to 6.4

This is currently blocking #57157, per this comment. Moving into the 6.4 milestone for visibility.

#8 @swissspidy
5 weeks ago

The main culprit for this bug is that all the blocks are registered on init, even when WP is not installed yet.

Because blocks register scripts, that causes WP_Scripts to be initialized very early, triggering script localization of the password meter.

Because of the way wp-admin/install.php loads translations, it's actually too early, and when the script localization happens it still thinks the locale is en_US.

Not registering any blocks would automatically solve this issue.

An alternative solution is to adjust determine_locale() to detect the current locale on the install screen. That's what my PR does.

#9 @swissspidy
5 weeks ago

  • Keywords has-patch needs-testing added

This ticket was mentioned in PR #5121 on WordPress/wordpress-develop by @swissspidy.


5 weeks ago
#10

Works around issues with script localization happening too early because of blocks being registered.

Trac ticket: https://core.trac.wordpress.org/ticket/58696

This ticket was mentioned in Slack in #core-i18n by swissspidy. View the logs.


5 days ago

Note: See TracTickets for help on using tickets.