I try to use JLanguage within my app. Please let me know what I'm doing wrong or how to implement multilanguage support correctly.
In the constructor of my JApplicationWeb class I do this: //initialise language files if(is_null($this->language)) { $this->language = JLanguage::getInstance('de-DE',false); $this->language->setDefault('de-DE'); $this->language->setLanguage('de-DE');
}
This correctly loads the ./language/de-DE.ini file. But JText::_() translates it with the en-GB.ini instead - what am I missing?
> I try to use JLanguage within my app. Please let me know what I'm doing wrong or how to implement multilanguage support correctly.
> In the constructor of my JApplicationWeb class I do this:
> //initialise language files
> if(is_null($this->language))
> { > $this->language = JLanguage::getInstance('de-DE',false); > $this->language->setDefault('de-DE'); > $this->language->setLanguage('de-DE'); > }
> This correctly loads the ./language/de-DE.ini file. But JText::_() translates it with the en-GB.ini instead - what am I missing?
Unfortunately I don't know where I should have found that information - are there any docs available? Is this the correct way to implement JLanguage, JSession, etc?
The platform-examples are a good starting point but in case of JSession and now JLanguage I was lost. If you guys let me know what is the correct way to make use of e.g. JLanguage, JSession etc. I'm going to write a more complete platform-example.
Documentation is regarding platform and how to build a webapp is really lacking this information. If I look how the CMS does certain things I still do not know if it is the correct new way of using the platform as they use legacy layer or cms specific solutions.
Is there a "right" way to do this? Should I use JFactory to instantiate JSession or should I use JSession directly. This is really confusing.
Thanks for pointing me the right direction.
Am Donnerstag, 26. Juli 2012 12:09:24 UTC+2 schrieb Rouven Weßling:
> > I try to use JLanguage within my app. Please let me know what I'm doing > wrong or how to implement multilanguage support correctly.
> > In the constructor of my JApplicationWeb class I do this: > > //initialise language files > > if(is_null($this->language)) > > { > > $this->language = JLanguage::getInstance('de-DE',false); > > $this->language->setDefault('de-DE'); > > $this->language->setLanguage('de-DE'); > > }
> > This correctly loads the ./language/de-DE.ini file. But JText::_() > translates it with the en-GB.ini instead - what am I missing?
Hi Andreas,
On 26.07.2012, at 15:47, Andreas Tasch wrote:
> Hi Rouven,
> 1000 thanks, that worked!
> Unfortunately I don't know where I should have found that information - are there any docs available? Is this the correct way to implement JLanguage, JSession, etc?
We've slowly started moving stuff out of JFactory but until we get there it's a good idea to set up the factory with the objects you set up.
In case of JLanguage you could also populate the configuration with the language. The factory will than configure JLanguage with that information and you're good to go.
> The platform-examples are a good starting point but in case of JSession and now JLanguage I was lost. If you guys let me know what is the correct way to make use of e.g. JLanguage, JSession etc. I'm going to write a more complete platform-example.
> Documentation is regarding platform and how to build a webapp is really lacking this information. If I look how the CMS does certain things I still do not know if it is the correct new way of using the platform as they use legacy layer or cms specific solutions.
> Is there a "right" way to do this? Should I use JFactory to instantiate JSession or should I use JSession directly. This is really confusing.
The platform is still in its infancy, we have already deprecated quite a bit of things from JFactory and I'm pretty sure at least the session will follow sooner or later we're just not quite there yet.