makeTranslationReplacement() public method

Replace translation related placeholders in given string
public makeTranslationReplacement ( string $data ) : string
$data string
return string
コード例 #1
0
 public function testMakeTranslationReplacement()
 {
     $helper = new helper_plugin_data();
     $this->assertEquals('en', $helper->makeTranslationReplacement('%lang%'));
     $this->assertEquals('', $helper->makeTranslationReplacement('%trans%'));
     if (plugin_enable('translation')) {
         global $conf;
         global $ID;
         $conf['plugin']['translation']['translations'] = 'de';
         $ID = 'de:somepage';
         $this->assertEquals('en', $helper->makeTranslationReplacement('%lang%'));
         $this->assertEquals('de', $helper->makeTranslationReplacement('%trans%'));
     }
 }
コード例 #2
0
 public function testMakeTranslationReplacement()
 {
     $helper = new helper_plugin_data();
     $this->assertEquals('en', $helper->makeTranslationReplacement('%lang%'));
     $this->assertEquals('', $helper->makeTranslationReplacement('%trans%'));
     $plugininstalled = in_array('translation', plugin_list('helper', $all = true));
     if (!$plugininstalled) {
         $this->markTestSkipped('Pre-condition not satisfied: translation plugin must be installed');
     }
     if ($plugininstalled && plugin_enable('translation')) {
         global $conf;
         global $ID;
         $conf['plugin']['translation']['translations'] = 'de';
         $ID = 'de:somepage';
         $this->assertEquals('en', $helper->makeTranslationReplacement('%lang%'));
         $this->assertEquals('de', $helper->makeTranslationReplacement('%trans%'));
     }
 }