Make WordPress Core

Opened 17 years ago

Closed 16 years ago

Last modified 15 years ago

#6951 closed enhancement (fixed)

load_theme_textdomain should allow one to specify directory

Reported by: filosofo's profile filosofo Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: I18N Keywords: load_theme_textdomain l10n i18n has-patch needs-testing
Focuses: Cc:

Description

Currently, you have to put .mo files in the top-most part of the theme directory, which can make things kind of crowded. It would be good to be able to specify another directory, so one could organize them in a sub-directory.

My patch preserves existing behavior by default, but adds an extra argument for load_theme_textdomain for the directory path.

Attachments (1)

theme_l10n_directory.diff (610 bytes) - added by filosofo 17 years ago.

Download all attachments as: .zip

Change History (8)

#1 @Viper007Bond
17 years ago

I think it might be worthwhile to force the translation file to be somewhere inside the theme's folder. That way theme developers with bad habits and practices can't have it be located elsewhere.

I propose $path should be a relative to the current theme's directory.

#2 @filosofo
17 years ago

Viper007Bond, what sort of bad habits and practices do you have in mind? I'm not disagreeing, just unaware. Most of the time it seems like people with bad practices won't use l10n at all.

I also thought it might occasionally be handy to keep l10n files outside the theme directory. Say, for example, that you've standardized the text of all your themes, and you allow users to switch themes.

#3 @Viper007Bond
17 years ago

That's a good point (a global file).

I was trying to avoid theme authors setting the localization directory to like /wp-includes/languages/ or something.

#4 @strider72
17 years ago

It should certainly _default_ to being relative to the theme directory.

+1 on this.

#5 @jacobsantos
16 years ago

  • Component changed from General to i18n
  • Keywords needs testing added
  • Milestone changed from 2.9 to 2.7
  • Type changed from defect to enhancement

The patch should still commit, sending to 2.7 since it would be nice and it has a patch.

#6 @jacobsantos
16 years ago

  • Keywords needs-testing added; needs testing removed

#7 @ryan
16 years ago

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

(In [9212]) Add optional path arg to load_theme_textdomain(). Props filosofo. fixes #6951

Note: See TracTickets for help on using tickets.