[RCD] Help with Plugin Translation

Austin Biggs hello at klikdenver.com
Wed Sep 21 23:06:48 CEST 2016


UNSUBSCRIBE.

Thanks!
Austin Biggs 

> On Sep 21, 2016, at 2:33 PM, Brendan <brendan at tucows.com> wrote:
> 
> how is the sub function getting called? you may need to pass $this
> through to it.. here's how that works with register_action:
> 
> function init() {
>  $this->load_config();
>  $this->add_texts('localization/', true);
>  $this->register_action('plugin.thing', array($this, 'thing'));
> }
> 
> function thing($args) {
>  $rcmail = rcube::get_instance();
>  $this->gettext('somelabel_from_my_lang.inc_file')
> }
> 
>> On 16-09-21 01:27 PM, Aurélio de Souza Ribeiro Neto wrote:
>> Hello Everyone,
>> 
>>    I have a plugin, and I want to translate it based on
>> localization/language.inc file.
>> 
>>    In my plugin core PHP file I have this:
>> 
>>    function init()
>>    {
>>        $this->load_config();
>>        $this->add_texts('localization/', true);
>>    }
>> 
>> 
>>    If in a sub function I use
>> 
>>    $this->gettext('somelabel_from_my_lang.inc_file')
>> 
>>    I got this error   PHP Fatal error:  Using $this when not in object
>> context
>> 
>>    What I'm doing wrong?
>> 
>>    Thanks
>> 
>> Aurelio
>> 
>> 
>> _______________________________________________
>> Roundcube Development discussion mailing list
>> dev at lists.roundcube.net
>> http://lists.roundcube.net/mailman/listinfo/dev
> _______________________________________________
> Roundcube Development discussion mailing list
> dev at lists.roundcube.net
> http://lists.roundcube.net/mailman/listinfo/dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.roundcube.net/pipermail/dev/attachments/20160921/75a5010c/attachment.html>


More information about the dev mailing list