diff options
author | Brion Vibber <brion@pobox.com> | 2010-09-30 19:18:46 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-09-30 19:18:46 -0700 |
commit | 54c88cba571a74a901f2d15e7d8db0d349d896d3 (patch) | |
tree | d4b2ee1116072d8066a2465d7cf7b6e34b04dfa5 /lib/plugin.php | |
parent | 120a117f41e272644eea6c6f0600a720e86fcd14 (diff) |
Add a $config['plugins']['locale_path'] which can be set to override the individual plugins' locale subdirectories.
This will apply to *ALL* plugins in *ALL* languages, so should probably only be used when doing site customization...
You'd probably do:
$config['site']['locale_path'] = '/srv/awesome/data/locale';
$config['plugins']['locale_path'] = '/srv/awesome/data/locale';
with a structure like:
srv/
awesome/
data/
locale/
en/
LC_MESSAGES/
statusnet.po
OpenID.po
AnonymousFave.po
etc, all alongside each other. You could separate plugins from the core if you like.
Where locale files have not already been generated, you can build one for a plugin like so:
php scripts/update_po_templates.php --plugin=MyPlugin
and pull out the template file:
plugins/MyPlugin/locale/MyPlugin.pot
Edit that (make sure you at least set the CHARSET, probably to UTF-8) and save your customized .po
files into the structure as above, and use msgfmt to generate .mo files for final output.
Diffstat (limited to 'lib/plugin.php')
-rw-r--r-- | lib/plugin.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/plugin.php b/lib/plugin.php index ee57f5904..3f84afa27 100644 --- a/lib/plugin.php +++ b/lib/plugin.php @@ -88,7 +88,12 @@ class Plugin $class = get_class($this); if (substr($class, -6) == 'Plugin') { $name = substr($class, 0, -6); - $path = INSTALLDIR . "/plugins/$name/locale"; + $path = common_config('plugins', 'locale_path'); + if (!$path) { + // @fixme this will fail for things installed in local/plugins + // ... but then so will web links so far. + $path = INSTALLDIR . "/plugins/$name/locale"; + } if (file_exists($path) && is_dir($path)) { bindtextdomain($name, $path); bind_textdomain_codeset($name, 'UTF-8'); |