[wp-hackers] Re: Plugin Localization

Robert Deaton false.hopes at gmail.com
Fri Jun 24 02:10:05 GMT 2005


Should probably have a bit of testing to see if the file exists
outside the folder just in case, a legacy support thing.

On 6/23/05, Ryan Duff <ryan at ryanduff.net> wrote:
> David Chait wrote:
> > Sounds like the plugins/<plugin sub dir>/ approach would be the best for 
> > the long haul, as anything custom translated for a plugin should stay 
> > WITH the plugin.
> > 
> > I've also gotten requests to put my multi-file plugins into single 
> > folders for easier management, which mirrors the same issue (clutter & 
> > 'packaging').
> > 
> > -d
> > ----- Original Message -----
> > 
> >> It came up in #wordpress this afternoon about the placement of the .mo 
> >> files for plugins. Currently they need to reside in the 
> >> wp-content/plugins/ folder which causes uglyness.
> >>
> >> One option is to allow the plugin authors to keep them in the plugin 
> >> folder. Its pretty much the same as current, but more flexible. In 
> >> this case, the .mo should be located in either wp-content/plugins/ or 
> >> wp-content/plugins/<plugin sub dir>/ As stated before, this can cause 
> >> ugliness unless in the main plugins folder unless the author makes a 
> >> sub-directory for the plugin files.
> 
> Thats my pick of the two. We've begun to throw wp-contact-form into a 
> folder to keep all the files together. Cleaner for the dev and the user. 
> One folder to upload, one folder to delete.
> 
> Maybe something like this for an updated load_plugin_textdomain() 
> function to check if the plugin resides in a sub-folder...
> 
> function load_plugin_textdomain($domain) {
>      $locale = get_locale();
>      $plug_dir = dirname(__FILE__);
> 		
> 		if ($plug_dir != 'plugins') {
> 				$mofile = $plug_dir . "$domain-$locale.mo";
> 		} else {
> 				$mofile = ABSPATH . "wp-content/plugins/$domain-$locale.mo";
> 		}
> 
>      load_textdomain($domain, $mofile);
> }
> 
> 
> rboren: any comments?
> 
> -- 
> Ryan Duff
> http://ryanduff.net
> AIM: ryancduff
> irc.freenode.net #wordpress
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 


-- 
--Robert Deaton
http://somethingunpredictable.com


More information about the wp-hackers mailing list