I can't change the language of component

General questions regarding the use of languages in Joomla! 3.x.

Moderators: infograf768, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
artonweb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 181
Joined: Mon Oct 24, 2011 5:07 am
Location: Hellas
Contact:

I can't change the language of component

Post by artonweb » Sat Jan 12, 2019 11:42 pm

Hello.
I am trying to changing the language on frontpage of a website which use Jhotelreservation component.
The code is

Code: Select all

	//languages
		$language 		= JFactory::getLanguage();
		$language_tag 	= isset($language->_lang) ? $language->_lang : $language->getTag();
		JRequest::setVar('_lang',$language_tag);
		
		$x = $language->load(
								'com_installer' ,
					dirname(JPATH_ADMINISTRATOR.DS.'language') ,
					$language_tag,
					true
		);
		
		$x = $language->load(
				'com_jhotelreservation' ,
				dirname(JPATH_COMPONENT_ADMINISTRATOR. DS.'language') ,
				$language_tag,
				true
		);
	}
	
	public static function loadSiteLanguage(){
		$language 		= JFactory::getLanguage();
		$language_tag 	= JRequest::getVar( '_lang' );
		if($language_tag==""){
			$language_tag = isset($language->_lang) ? $language->_lang : $language->getTag();
			JRequest::setVar('_lang',$language_tag);
		}
		$x = $language->load(
				'com_jhotelreservation' ,
				dirname(JPATH_ADMINISTRATOR."/components/com_jhotelreservation/language") ,
				$language_tag,
				true
		);
		$x = $language->load(   'com_users' ,
				dirname( JPATH_SITE.DS.'language') ,
				$language_tag,
				true
		);	
		
		JRequest::setVar( 'language_tag',$language_tag);
		
		$language_tag = str_replace("-","_",$language->getTag());
		setlocale(LC_TIME , $language_tag.'.UTF-8');
	}
	
	public static function loadClasses(){
		jimport('joomla.filesystem.file');
		jimport('joomla.filesystem.folder');
Any suggestion will be helpful.
Thank you in advance.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 36306
Joined: Sat Apr 05, 2008 9:58 pm

Re: I can't change the language of component

Post by Webdongle » Mon Jan 14, 2019 3:49 pm

http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

artonweb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 181
Joined: Mon Oct 24, 2011 5:07 am
Location: Hellas
Contact:

Re: I can't change the language of component

Post by artonweb » Mon Jan 14, 2019 4:37 pm

Thank you for your suggestion.
All translations based on Joomla core are working perfect.
My problem is the language of component (hotel presentation) on front end.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 36306
Joined: Sat Apr 05, 2008 9:58 pm

Re: I can't change the language of component

Post by Webdongle » Mon Jan 14, 2019 5:42 pm

Check with the authors of the extension and see if they include language files and if so where. If they don't then any changes that you make could be overwritten with updates.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 36306
Joined: Sat Apr 05, 2008 9:58 pm

Re: I can't change the language of component

Post by Webdongle » Mon Jan 14, 2019 7:48 pm

If the extension has the language files in the correct place then https://docs.joomla.org/J3.x:Language_O ... _in_Joomla should be used to override them !!!
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

User avatar
imanickam
Joomla! Master
Joomla! Master
Posts: 26821
Joined: Wed Aug 13, 2008 2:57 am
Location: Chennai, India

Re: I can't change the language of component

Post by imanickam » Tue Jan 15, 2019 12:52 am

Review of the documentation of the extension at https://www.cmsjunkie.com/docs/jhotelre ... guage.html could be of help.

Observed that the language file/files for this extension is/are located in the directory \administrator\components\com_jhotelreservation\language (ie. within the component's directory) as opposed to the [standard language's] directory \administrator\language\language-code (e.g., \administrator\language\fr-FR).

Please check that the default front-end language has been set to the desired language.
Ilagnayeru (MIG) Manickam | இளஞாயிறு மாணிக்கம்
Global Moderators Team | Translations Coordination Team | Tamil (தமிழ்) Translation Team

Eegan - Support the poor and underprivileged


Post Reply

Return to “Language - Joomla! 3.x”