0

I need to insert a language string inside a Custom HTML module on Joomla (1.7).

Like: K2_READ_MORE (and not Read more)

How?

Gabriel Santos
  • 4,934
  • 2
  • 43
  • 74
  • Could you give some more information? Or show us what you have written in the custom module. It might help us to help you. On a different note, this would be a good question for http://area51.stackexchange.com/proposals/34294/joomla-answers – TryHarder Apr 12 '12 at 14:45
  • Thanks, I have never read about Area 51 =D – Gabriel Santos Apr 12 '12 at 17:06

2 Answers2

4

You can do this in this way:

  1. Create folder

/templates/YOUR-TEMPLATE/html/mod_custom

  1. Copy there the following file and edit it:

/modules/mod_custom/tmpl/default.php

  1. At approximately 14th line replace:

    <?php echo $module->content; ?>

with:

<?php
if(!function_exists('convertJText')) {
    function convertJText($str) { return JText::_($str); };
}
echo preg_replace("/\^\^\^([^\^]+)\^\^\^/ie",'convertJText("$1")', $module->content);
?>

Then you will be able to use translatable strings in your Custom HTML modules by using ^^^K2_READ_MORE^^^

WooDzu
  • 4,771
  • 6
  • 31
  • 61
2

Try the Sourcerer plugin:

http://www.nonumber.nl/extensions/sourcerer

Shaz
  • 2,647
  • 2
  • 35
  • 45