WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#6872 closed defect (bug) (fixed)

Always set the language attribute on a WordPress site

Reported by: MarcoZ Owned by: westi
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5.1
Component: I18N Keywords: has-patch
Focuses: Cc:

Description

On a standard WordPress installation that is not localized (e.g. $WPLANG is empty in wp-config.php), WordPress does not set a default lang and xml:lang attribute on the pages when it renders them. I come from Germany, and while my speech synthesizer used to read text to me is capable of speaking English, it does not switch to it automatically when I load my own or many other WordPress sites. If this lang attribute was set to en-us when there's no override, this would allow the speech synthesizer to switch automatically.

Attachments (1)

wp-6872.diff (428 bytes) - added by MarcoZ 6 years ago.
In get_bloginfo, apply the same rule as used in many places in l10n.php. If get_locale returns an empty string, assume en_US (the blog hasn't been localized from its default English language).

Download all attachments as: .zip

Change History (6)

MarcoZ6 years ago

In get_bloginfo, apply the same rule as used in many places in l10n.php. If get_locale returns an empty string, assume en_US (the blog hasn't been localized from its default English language).

comment:1 MarcoZ6 years ago

  • Keywords has-patch added
  • Owner changed from anonymous to MarcoZ
  • Status changed from new to assigned

comment:2 Viper007Bond6 years ago

  • Component changed from Template to i18n
  • Milestone changed from 2.5.2 to 2.6
  • Owner MarcoZ deleted
  • Status changed from assigned to new

Setting to 2.6. It'll be backported to 2.5.x if need be. :)

comment:3 westi6 years ago

  • Owner set to westi
  • Status changed from new to assigned

comment:4 westi6 years ago

This looks like a really good idea.

In face I think we should just make get_locale return en_US instead of '' that way we have less code :-)

comment:5 westi6 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [7885]) Always set the locale to something. Fixes #6872 props MarcoZ.

Note: See TracTickets for help on using tickets.