Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

custom plugin language strings
(1 viewing) (1) Guest
Support forum for users using free edition of JoomSEF 4 (Joomla 1.6/1.7/2.5+ compatible). These forums are mainly for mutual help between users.

Please note that due to our capacity limitations, we do not monitor these forums regularly.
  • Page:
  • 1

TOPIC: custom plugin language strings

custom plugin language strings 11 years, 1 month ago #37584

Hello,

I have created a custom component and a plugin for joomfish and all is well, but I would like to be able to add a translatable string to the $title array, in other words:

i have a url /accommodation/property-1.html.

I need to be able to translate the string "accommodation".

I have coded plugins for sh404 before, and to do this I would use these variable:

$sh_LANG['en']['ACCOMMODATION']="accommodation";
$sh_LANG['es']['ACCOMMODATION']="alojamiento";

Is there an equivalent in joomsef?

May thanks

Re: custom plugin language strings 11 years, 1 month ago #37592

  • dajo
  • OFFLINE
  • Posts: 5069
Hi,

No, the texts in the $title array are not automatically translated, you need to manually put already translated text into the $title array.

You could store the translated text in your component's language file and then just use the JText::_() function to translate it to current language before putting it into the $title array.
ARTIO Support Team

Re: custom plugin language strings 11 years, 1 month ago #37593

Perfect! Just what I needed, thanks!!

Re: custom plugin language strings 11 years, 1 month ago #37710

Do I have to load my language file in the plugin?

Currently, I have the following:

$title[]=JText::_('SEF_SLUG')

In my component language file, i have
SEF_SLUG="accommodation"

but my urls show up as site.com/sef_slug

Re: custom plugin language strings 11 years, 1 month ago #37734

  • dajo
  • OFFLINE
  • Posts: 5069
Yes, you should load the language file in the plugin, because Joomla loads language file only for current component, so when the link is created for example on the homepage that uses different component, language file is not loaded automatically.

Just put the following lines to the beginning of the create() function (replace com_something with your component):
$jLang = JFactory::getLanguage();
$jLang->load('com_something');
ARTIO Support Team
  • Page:
  • 1
User Login Empty