WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11033 closed defect (bug) (fixed)

Function needed to support l10n for child themes

Reported by: johnjamesjacoby Owned by: westi
Milestone: 2.9 Priority: high
Severity: major Version: 2.9
Component: I18N Keywords: has-patch
Focuses: Cc:

Description

The "load_theme_textdomain" function falls short when there is a parent theme to the currently active child theme style. Because load_theme_textdomain uses get_theme_directory, it will always load the parents textdomain, even if there are text changes included in the child style.

This patch includes a new function "load_style_textdomain" to allow child themes to have their own po/mo's. This would presumably be called in the child themes functions.php, or somewhere relative to it.

This may become more important with BuddyPress 1.1+ as the parent/child theme/style relationships become more popular.

Attachments (1)

load_style_textdomain.patch (899 bytes) - added by johnjamesjacoby 4 years ago.
load_style_textdomain

Download all attachments as: .zip

Change History (9)

johnjamesjacoby4 years ago

load_style_textdomain

comment:1 johnjamesjacoby4 years ago

  • Component changed from General to i18n

Change component to i18n.

comment:2 johnjamesjacoby4 years ago

  • Priority changed from normal to high
  • Severity changed from normal to major

Any chance to have this put to the test for 2.9?

comment:3 westi4 years ago

  • Owner changed from johnjamesjacoby to westi
  • Status changed from new to reviewing

comment:4 nbachiyski4 years ago

It would have been perfect to be able to do it in load_theme_textdomain(), but we don't know the domain of the child theme there. so we can't load the strings to the right place. So, we need this function.

But I think we should call it load_child_theme_textdomain(). It should state what is the effect, not what it does under the hood. Also, I can't imagine why would you want to load the MO file from the stylesheet directory if you are not in a child theme.

comment:5 westi4 years ago

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

(In [12179]) Add load_child_theme_textdomain() to allow child themes to have there own translation files. Fixes #11033 props load_child_theme_textdomain.

comment:6 johnjamesjacoby4 years ago

No where in the WordPress code does the nomenclature "child_theme" appear.

Instead the differences are always referred to as "theme" and "style".

If we're going for effect, almost all of these functions need to be renamed to match the parent/child relationship.

STYLESHEETPATH, get_stylesheet_directory(), etc...

+1 for putting this to core :D
-1 for renaming it in a way that doesn't match the rest :(

comment:7 nbachiyski4 years ago

Do most of theme developers use other theme/style functions? I think most of the functions are used only internally, so it's ok the break the convention.

comment:8 westi4 years ago

I think child is the best way of naming this.

I also think we should review the naming of the other functions.

I have opened a ticket for 3.0 for this - #11215

Note: See TracTickets for help on using tickets.