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

Wrong Language on swedish site language and english user profile language #448

Closed
ipajen opened this issue Apr 4, 2023 · 3 comments
Closed

Comments

@ipajen
Copy link

ipajen commented Apr 4, 2023

Feature request/bug description

WordPress: 6.2
PHP: 8.2.3
Server: LiteSpeed
Database: mysqli (Server: 10.4.28-MariaDB / Client: mysqlnd 8.2.3)
Browser: Edge 111.0.1661.62 (Windows 10/11)
Theme: GeneratePress 3.3.0
Health Check & Troubleshooting 1.6.0

Got a issue with languages in Health check

Site Language = English US and User Profile Language = English
Status, Info, Troubleshooting, Tools

Site Language = English US and User Profile Language = Swedish
Status, Info, Felsökning, Verktyg

Site Language = Swedish and User Profile Language = English US
Status, Info, Felsökning, Verktyg

Site Language = Swedish and User Profile Language = Swedish
Status, Info, Felsökning, Verktyg

When site language are Swedish and User Profile Language are English US the wrong language is shown in the Troubleshooting, Tools?

Site Language = English US and User Profile Language = Swedish
The headers are translated but not the text. See pictures

Site Language = Swedish and User Profile Language = Swedish
The headers are translated and text. See pictures

Screenshots

Is this a visual related ticket? If so, please include one or more screenshots to help us better understand what is happening.

Sitelanguage_US_and_Userlanguage_SE
Sitelanguage_SE_and_Userlanguage_SE

@ipajen
Copy link
Author

ipajen commented Apr 6, 2023

IMG_4296
Added picture where translation is showing up incorrectly under plugins - troubleshooting

@Zodiac1978
Copy link
Contributor

Maybe @swissspidy can help here?

@swissspidy
Copy link
Member

swissspidy commented Aug 3, 2023

From what I can see at a glance is that the way the code is loaded in the plugin causes the just-in-time translation logic in WP to trigger before the current user locale is known.

This is because the main plugin file loads a bunch of classes which get immediately instantiated before plugins_loaded, and these classes call __():

// Tools section.
require_once( dirname( __FILE__ ) . '/HealthCheck/Tools/class-health-check-tool.php' );
require_once( dirname( __FILE__ ) . '/HealthCheck/Tools/class-health-check-files-integrity.php' );
require_once( dirname( __FILE__ ) . '/HealthCheck/Tools/class-health-check-mail-check.php' );
require_once( dirname( __FILE__ ) . '/HealthCheck/Tools/class-health-check-debug-log-viewer.php' );
require_once( dirname( __FILE__ ) . '/HealthCheck/Tools/class-health-check-plugin-compatibility.php' );
require_once( dirname( __FILE__ ) . '/HealthCheck/Tools/class-health-check-phpinfo.php' );
require_once( dirname( __FILE__ ) . '/HealthCheck/Tools/class-health-check-htaccess.php' );

$this->label = __( 'File integrity', 'health-check' );
$this->description = __( 'The File Integrity checks all the core files with the <code>checksums</code> provided by the WordPress API to see if they are intact. If there are changes you will be able to make a Diff between the files hosted on WordPress.org and your installation to see what has been changed.', 'health-check' );

new Health_Check_Files_Integrity();

Doing all the main plugin initialization only on plugins_loaded would solve this.


See also https://core.trac.wordpress.org/ticket/58546

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants