Opened 15 years ago
Closed 13 years ago
#6132 closed defect (bug) (fixed)
Error message in wp-blog-header.php can't be RTLed even if locale is set
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | minor | Version: | 3.0 |
Component: | I18N | Keywords: | has-patch dev-feedback |
Focuses: | Cc: |
Description
The wp_die function checks for the $text_direction variable to set directionality in error messages, however when there is no wp-config.php file, the error message in wp-blog-header.php is shown - but since there is no wp-config.php file, the locale files don't get loaded and the error message isn't RTLed.
I hope this wasn't too convoluted an explanation, it's a bit of a paradoxical situation that's hard to explain...
Attachments (2)
Change History (18)
#3
@
14 years ago
- Milestone changed from 2.9 to 2.8
Here is a solution, but it will work only for the local package. Since we already change some hardcoded error messages in the files, we can change the text direction, too.
The patch passes another argument to wp_die()
, the text direction. The value is taken from a string will appear in your POT file and will be replaced when the local version is generated.
#8
@
13 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
- Version set to 3.0
This problem still exists as of version 3.0.
To reproduce this bug, you can download the latest version of WordPress Hebrew, from here: http://he.wordpress.org/wordpress-3.0-he_IL.zip
Simply unzip and try to run it in your server. The standard "no wp-config.php file" error message will be displayed, translated to Hebrew, but not be RTLed. This applies to some other wp_die() error messages, but this is the easiest to reproduce.
Since the "no wp-config.php file" error is actually the first stage of the automatic WordPress installer, this reflects poorly on WordPress when used in RTL locales.
This happens because wp_die relies on the language_attributes() function to set the RTL attribute on the HTML tag. Because wp_die() can be called before language_attributes() is loaded (indeed, it can be called the locale is even set), some error messages don't actually get RTLed.
I'm including a patch with a possible fix. It replaces language_attributes() and adds an RTL attribute to the HTML tag when appropriate. It utilizes the same method to determine directionality as proposed by nbachiyski.
This patch was tested on WordPress Hebrew 3.0, which is an RTL language.
#10
in reply to:
↑ 9
@
13 years ago
Replying to nacin:
This is a pretty simple fix - can't this be done for 3.0.1?
#11
@
13 years ago
It's been around since 2.8, so we probably won't rush it into 3.0.1.
Patch feedback: Looks good, but we should probably still rely on language_attributes() if both it and is_rtl() is defined. Thus:
if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) language_attributes(); else echo "dir='$text_direction'";
That look about right?
#13
@
13 years ago
- Severity changed from normal to minor
Don't know why this hasn't occurred to me earlier, but since these messages are in HTML, they can be easily RTLed during the translation. An automatic RTL function would still be appreciated, but it's definitely not urgent. I changed "Severity" to minor.
All open tickets should have a milestone.