[RCD] Help with Plugin Translation

Aurélio de Souza Ribeiro Neto netolistas at mpc.com.br
Mon Sep 26 13:33:26 CEST 2016


Hello,

     Someone can help-me?

Aurelio

Em 21/09/2016 22:51, Aurélio de Souza Ribeiro Neto escreveu:
> Hello Brendan,
>
>     Thanks for your answer!
>
>     My function is:
>
> function action_pending(){
>
>     global $color;
>     $rcmail = rcmail::get_instance();
>     //$rcmail->output->show_message('pending');
>
>     $plugin_tmdatools_tmdadir = 
> $rcmail->config->get('plugin_tmdatools_tmdadir');
>     $plugin_tmdatools_tmdasettings = 
> $rcmail->config->get('plugin_tmdatools_tmdasettings');
>     $show_num = $rcmail->config->get('plugin_tmdatools_showPageNum');
>
>
> ...
> ...
> ...
> }
>
>     I want to write a variable content from "lang.inc" on this function.
>
>     I don't know how! :(
>
>     Thanks
>
> Aurelio
>
> Em 21/09/2016 17:33, Brendan escreveu:
>> 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 em lists.roundcube.net
>>> http://lists.roundcube.net/mailman/listinfo/dev
>> _______________________________________________
>> Roundcube Development discussion mailing list
>> dev em lists.roundcube.net
>> http://lists.roundcube.net/mailman/listinfo/dev
>>
>
>
> _______________________________________________
> Roundcube Development discussion mailing list
> dev em lists.roundcube.net
> http://lists.roundcube.net/mailman/listinfo/dev
>




More information about the dev mailing list