1 hardym Jun 15, 2006 10:55
3 hardym Jun 16, 2006 10:10
Thank you for the links. But this way of localization only works since version 1.8 and I'm using 0.9.2.
Is there a similar method for 0.9.2?
4 personman Jun 16, 2006 14:14
No, not that I know of.
5 blueyed Jun 17, 2006 02:37
Hardym, for private use with 0.9.x I think the best way is to add it to the global locales and use T_() as with the rest of the application.
6 balupton Jul 06, 2006 03:24
by reading the document posted earlier, got a question.
Can i just have:
/my_plugin/locales/_global.php
which contains:
<?php
$trans[ 'fr_FR' ] = array(
'When I was writing this I was listening to:' => 'Something in french',
);
$trans[ 'de_DE' ] = array(
'When I was writing this I was listening to:' => 'Something in german',
);
?>
instead of having lots of directories and files....
And plugins would only need to translate a tiny amount so wouldn't hurt having it all in the one file...
7 blueyed Jul 06, 2006 22:54
Good idea. I've started implementing it and will commit it perhaps tomorrow.
8 balupton Jul 09, 2006 05:18
Just got the latest cvs build and it still wasn't there. Heres how i've done it ( file; _plugin.class.php, line; somewhere in T_ function );
if( ! isset($trans[ $messages ] ) )
{ // Translations for current locale have not yet been loaded:
// echo 'LOADING', $plugins_path.strtolower( get_class($this) ).'/locales/'.$messages.'/_global.php';
@include_once $plugins_path.strtolower( $this->classname ).'/locales/'.$messages.'/_global.php';
@include_once $plugins_path.strtolower( $this->classname ).'/locales/_global.php';
And why was there get_class($this), instead of just $this->classname ..... ?
9 blueyed Jul 11, 2006 01:24
I've committed it.
I guess there was get_class() used, because if you would call Plugin::T_() out of the plugin constructor, it has no classname.
Plugin's constructors are deprecated now for 1.9, you should use PluginInit() instead (for b2evo 1.9).
10 balupton Jul 11, 2006 07:50
Although this may not work due to the changes you made that plugins can be in any directory with the plugins folder, correct?
So it the plugin may not actually be in a folder structure like we plan...
11 blueyed Jul 11, 2006 19:13
They can.
Just for completion: the plugin's "locale dir" is the "locales" dir where the classfile is _or_ /plugins/[plugin_classname]/locales, if the plugin is a single file in /plugins/.
12 balupton Jul 11, 2006 19:16
$plugins_path.strtolower( $this->classname ).'/locales/'
But isn't $plugis_path always referring to /blogs/plugins/ ?
Like with the recent updates, couldn't i have a plugin in the directory /blogs/plugins/my_plugin/anotherfolder/and_another/theplugin.plugin.php ?
13 blueyed Jul 11, 2006 19:19
So think about what you are quoting..
14 balupton Jul 11, 2006 19:39
Yeh so i have the plugin;
/blogs/plugins/my_plugin/anotherfolder/and_another/theplugin.plugin.php
and locales folder here;
/blogs/plugins/my_plugin/anotherfolder/and_another/locales/
But that wouldn't work with the following code;
$plugins_path.strtolower( $this->classname ).'/locales/'
Would it?
15 blueyed Jul 11, 2006 19:49
No, it wouldn't.
So...... where's your quote from?
In CVS HEAD it's:
$locales_dir = dirname($this->classfile_path).'/';
if( $locales_dir == $plugins_path )
{
$locales_dir .= $this->classname.'/';
}
$locales_dir .= 'locales/';
16 balupton Jul 11, 2006 19:52
From my post here;
http://forums.b2evolution.net//viewtopic.php?p=39515#39515
So i'm guessing if i do add plugins manually, like we discussed with Panels (if you remember), the Panels Plugin would also need to add their locales as well, unless the user wants to manually add them...
This should be helpful:
[url=http://manual.b2evolution.net/Localization#Plugins]Manual::Localization::Plugins[/url]
And [url=http://manual.b2evolution.net/Category:Plugins]here[/url] are some more manual pages about Plugins.