Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#31736 closed enhancement (worksforme)

Add locale to get_body_class to enable local WordPress themes/plugins to enable different design for locales

Reported by: shinichin's profile ShinichiN Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch
Focuses: template Cc:

Description

I want to suggest that get_body_class adds locales to the body tag.

Would be very nice if WordPress supports locale-en_US, locale-sv_SE or locale-ja as body classes because non-English speakers can submit themes both for English writers and local languages bloggers.
For users who use child themes to optimize a theme to their languages, it would be easier to send pull requests and patches to the original themes.

For example, this blog post by @nao shows us how to optimize English based themes for Japanese blogs.
http://en.naoko.cc/2015/01/29/optimizing-english-based-wordpress-theme-for-japanese-blog/

One of the basic ideas of this theme "Nu2013" by @nukaga in the WordPress theme repository is that the author wanted to offer Japanese optimized version of TwentyThirteen theme.
https://wordpress.org/themes/nu2013/

Attachments (1)

31736.diff (455 bytes) - added by ShinichiN 10 years ago.

Download all attachments as: .zip

Change History (5)

@ShinichiN
10 years ago

#1 @iseulde
10 years ago

  • Version trunk deleted

#2 @DrewAPicture
9 years ago

  • Component changed from General to I18N
  • Focuses template added
  • Keywords has-patch added

#3 @obenland
9 years ago

If themes use language_attributes() correctly, they could use an attribute selector to make that determination.

#4 @SergeyBiryukov
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Per comment:3, locale-based styling is already possible:

html[lang="en-US"] body {
	background: #fff;
}

html[lang="ja"] body {
	background: #000;
}
Note: See TracTickets for help on using tickets.