Need a JText string in a plugin for Joomla 1.5?

General questions regarding the use of languages in Joomla! 1.5.

Moderator: General Support Moderators

Locked
User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 921
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Need a JText string in a plugin for Joomla 1.5?

Post by Chacapamac » Tue Oct 18, 2011 12:48 am

I need to be able to translate the text in this plugin...

The line is :

Code: Select all

$lasttext = ($more=='')? " [ … ]": $more;
How can I insert some jtext to replace

Code: Select all

" [ … ]"
I’m not to sure????
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 921
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Re: Need a JText string in a plugin for Joomla 1.5?

Post by Chacapamac » Tue Oct 18, 2011 7:01 pm

I should use the jtext but how and where?
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18881
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Need a JText string in a plugin for Joomla 1.5?

Post by infograf768 » Wed Oct 19, 2011 4:53 am

$lasttext = ($more=='')? JText::_('PLG_MYPLUGIN_WHATEVER') : $more;

And the string:
PLG_MYPLUGIN_WHATEVER=" [ … ]" // if the doublequotes have to show as well as the space
PLG_MYPLUGIN_WHATEVER= [ … ] //if the double quotes are unnecessary

In 1.7, if the double quotes are necessary:
PLG_MYPLUGIN_WHATEVER="&quote; [ … ]&quote;"
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 921
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Re: Need a JText string in a plugin for Joomla 1.5?

Post by Chacapamac » Wed Oct 19, 2011 1:55 pm

You are my Hero — Double Thanks ;D

I want to learn PHP in november/december

I really want something that are really relevant to Joomla — Where should I start — Lynda.com ?

I want to be just like you !


Thanks....
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 921
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Re: Need a JText string in a plugin for Joomla 1.5?

Post by Chacapamac » Wed Oct 19, 2011 6:01 pm

It work if I use an existing string already in en-GB.com_content.ini

In the php plugin file I add :

Code: Select all

$lasttext = ($more=='')? JText::_('READ MORE') : $more;
The string in the en-GB.com_content.ini file —>

Code: Select all

READ MORE=Read more: %s
—————————————————————————————————————————————

I try to make a special .ini file just for this plugin (just for fun) but it didn’t work ....

What I did:

The name of the plugin is :

Code: Select all

<filename plugin="plg_imagesized">plg_imagesized.php</filename>	


1— Add this in the plugin xml file

Code: Select all

<languages>
  		 <language tag="en-GB">language/en-GB/en-GB.plg_content_plg_imagesized.ini</language>
		 <language tag="fr-FR">language/fr-FR/fr-FR.plg_content_plg_imagesized.ini</language>
		</languages>
2— I add this to the plugin PHP file:

Code: Select all

// Load user_profile plugin language
$language = JFactory::getLanguage();
$language->load('plg_imagesized', JPATH_SITE, 'en-GB', true);
$language->load('plg_imagesized', JPATH_SITE, null, true);
3— The string in the same php file is:

Code: Select all

$lasttext = ($more=='')? JText::_('IMAGESIZED_READMORE') : $more;
4— I create a ini file (uft8) in the root language folder (not in administrator) en-GB with the name —> en-GB.plg_content_plg_imagesized.ini

That contain :

Code: Select all

# $Id: en-GB.plg_imagesized.ini
# Joomla! Project
# Copyright (C) Graf All rights reserved.
# Note : All ini files need to be saved as UTF-8 - No BOM

IMAGESIZED_READMORE=Read more..
Don’t work ????

This is for a readmore in a plugin that resized pictures and shorten text in a blog format....
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18881
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Need a JText string in a plugin for Joomla 1.5?

Post by infograf768 » Thu Oct 20, 2011 6:28 am

language tag="en-GB">language/en-GB/en-GB.plg_content_plg_imagesized.ini</language>
is wrong

should be

language tag="en-GB">language/en-GB/en-GB.plg_content_imagesized.ini</language>
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 921
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Re: Need a JText string in a plugin for Joomla 1.5?

Post by Chacapamac » Thu Oct 20, 2011 2:04 pm

I did it — I really have to put the same name of the plugin... plg_imagesized not content_plg_imagesized — I put content because I was thinking it was needed by Joomla?
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18881
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Need a JText string in a plugin for Joomla 1.5?

Post by infograf768 » Thu Oct 20, 2011 2:31 pm

re-read me
You added a plg_
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 921
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Re: Need a JText string in a plugin for Joomla 1.5?

Post by Chacapamac » Thu Oct 20, 2011 5:43 pm

Thanks infograf768

I did have to remove content everywhere (ini,php and all) — and replace with only the xml name of the plugin —>plg_imagesized

Code: Select all

<filename plugin="plg_imagesized">plg_imagesized.php</filename>  
to become

l
anguage tag="en-GB">language/en-GB/en-GB.plg_imagesized.ini</language>
I put content in the first place because I was thinking that that infos was needed by Joomla?
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18881
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Need a JText string in a plugin for Joomla 1.5?

Post by infograf768 » Fri Oct 21, 2011 7:07 am

NO, again, read me:
On the same model as
en-GB.plg_content_pagebreak.ini

yours should be
en-GB.plg_content_imagesized.ini

and the xml on the same model as pagebreak

Code: Select all

<files>
		<filename plugin="pagebreak">pagebreak.php</filename>
		<filename>index.html</filename>
	</files>
In your case

Code: Select all

<files>
		<filename plugin="imagesized">imagesized.php</filename>
		<filename>index.html</filename>
	</files>
I suggest you just have a look at how the content plugins xml and ini files are done in Core.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group


Locked

Return to “Language - Joomla! 1.5”