Ticket #6951 (new defect)

Opened 2 months ago

Last modified 3 weeks ago

load_theme_textdomain should allow one to specify directory

Reported by: filosofo Assigned to: anonymous
Priority: normal Milestone: 2.6
Component: General Version:
Severity: normal Keywords: load_theme_textdomain l10n i18n has-patch
Cc: filosofo

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

theme_l10n_directory.diff (0.6 kB) - added by filosofo on 05/09/08 20:26:00.

Change History

05/09/08 20:26:00 changed by filosofo

  • attachment theme_l10n_directory.diff added.

05/10/08 02:18:09 changed by Viper007Bond

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.

05/10/08 07:19:42 changed by filosofo

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.

05/10/08 11:43:55 changed by Viper007Bond

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.

06/17/08 14:03:03 changed by strider72

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

+1 on this.