Roundcube Community Forum

Release Support => Pending Issues => Topic started by: Makc666 on January 21, 2010, 09:26:14 AM

Title: How to load custom translation / localization strings from plugin to main application
Post by: Makc666 on January 21, 2010, 09:26:14 AM
Story:

./skins/my_theme/templates/login.html

/program/localization/ru_RU/extra.incwith code like:

$labels['l_search'] = 'Search New Text';

?>
/program/localization/ru_RU/labels.incI added the line:
include ('extra.inc');

What I want:

But I don't want to modify the file
/program/localization/ru_RU/labels.incevery time the new release comes out.

I want to move my custom translation string(s) to the plugin's system.

What I did:

I tried and created plugin like this one:


/**
 * Extra Languages
 */
class extra_languages extends rcube_plugin
{

  function init()
  {
    $this->add_hook('startup', array($this, 'startup'));
    $this->add_hook('authenticate', array($this, 'authenticate'));
    $this->add_texts('localization', true);              
  }                                                      
                                                         
  function startup($labels)                              
  {                                                      
    $labels['l_search'] = $this->gettext('l_search');        
    return ??????????;                                  
  }

  function authenticate($args)
  {
    $labels['l_search'] = $this->gettext('l_search');
    return ???????;
  }

}P.S.
Of course I have added the proper "localization" folder for this plugin.
In other words the code in this plugin
  function startup($labels)                              
  {                                                      
    print $this->gettext('l_search');
    exit;
  }works when I enter the index.php page.

The question (problem):

I don't know how to return $this->gettext('l_search'); back to main application so it has been merged with global text strings (labels).

Is there any why to return from this plugin my custom translation strings?
Title: How to load custom translation / localization strings from plugin to main application
Post by: rosali on January 21, 2010, 09:31:06 AM
Check 'lang_sel' plugin bundled with MyRoundcube plugins (see signature). There you see a method how to merge localizations with the default localization.