How to get the language name like "english" or "dutch"/

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
pvh123
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Wed Oct 05, 2005 7:25 am
Location: Amsterdam
Contact:

How to get the language name like "english" or "dutch"/

Post by pvh123 » Sun Sep 09, 2007 7:26 pm

In my current module, there is a scriptline to establish and include a language file.
It looks like this:
include("components/com_xemusicfx/language/".$mosConfig_lang.".php");


I thought by replacing it like this

include("components/com_xemusicfx/language/".JDocument::getLanguage().".php");


would get me the correct filename, like: english.php or dutch.php.

No such luck.   

Anybody help me?
Last edited by pvh123 on Tue Sep 11, 2007 4:02 pm, edited 1 time in total.
;) pieter

User avatar
pvh123
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Wed Oct 05, 2005 7:25 am
Location: Amsterdam
Contact:

Re: How to get the language name like "english" or "dutch"/

Post by pvh123 » Tue Sep 11, 2007 8:27 am

@mod

Can you move my post to the Translation forum because I think this is the worng place.

Many thanks
;) pieter

User avatar
pe7er
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 162
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, The Netherlands
Contact:

Re: How to get the language name like "english" or "dutch"/

Post by pe7er » Tue Sep 11, 2007 8:48 am

[Moved to Joomla! Coding 101]
Last edited by pe7er on Tue Sep 11, 2007 8:51 am, edited 1 time in total.
Kind Regards,
Peter Martin (aka pe7er)
db8.nl - Joomla! implementation, programming, template and component development [Dutch]
>> Questions? Get help more easily with JTS-post Assistant: viewtopic.php?f=428&t=272481

User avatar
Pentacle
Joomla! Intern
Joomla! Intern
Posts: 61
Joined: Wed Oct 25, 2006 12:34 pm
Location: Turkey

Re: How to get the language name like "english" or "dutch"/

Post by Pentacle » Tue Sep 11, 2007 10:56 am

Hmm in the xml files there is a tag called

I don't know if there is a new way of doing this. But maybe, you can get it like this:

Code: Select all

$lang = & JFactory::getLanguage();

include("components/com_xemusicfx/language/".$lang->getBackwardLang();.".php");


P.S: I would prefer single quotes for the above line to reduce parsing time. ;)
My Joomla! 1.5 extensions - http://joomla.ercan.us
Progress is made by lazy men looking for easier ways to do things.

User avatar
pvh123
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Wed Oct 05, 2005 7:25 am
Location: Amsterdam
Contact:

Re: How to get the language name like "english" or "dutch"/

Post by pvh123 » Tue Sep 11, 2007 4:02 pm

Thanks very much, that the trick.

I have done a lot of searching and just today started to look in the Framework and wanted to start of with: $lang = Jlanguage::getname();

But I was near , not near enough.
;) pieter

User avatar
matthewhayashida
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 114
Joined: Sat Feb 10, 2007 8:26 pm
Location: Abbotsford, BC
Contact:

Re: How to get the language name like "english" or "dutch"/

Post by matthewhayashida » Wed Sep 12, 2007 3:41 am

MOD NOTE: Moving to Joombie Q/A
-Matt Hayashida


Post Reply