Localizing $sitename?

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

Moderator: 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.
Locked
klabog
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Wed May 03, 2006 3:21 pm

Localizing $sitename?

Post by klabog » Mon May 16, 2011 8:04 pm

Hello all,

after looking around some hours and no hit in searching the forum hopefully I will get an answer here.
I have now successfully localized nearly all of my WEB but don't find a solution to localize the $sitename which is included in the configuration file.
There are a lot of references to the $sitename in a lot of files but nowhere with a reference to the languages.
Anyone can give me a hint?
I'm not really experienced in php therefore I can't realize my ideas how to do it. I think there are some possibilities:
1) Substitute the parameter $sitename in the configuration.php by $sitename_de, $sitename_en and so on. (Not very nice)
2) Put something in the language overrides files. But what?
3) Patch the index.php of your template somewhat like this:

Code: Select all

$app = JFactory::getApplication();
$this->title = $this->title." - (here a php statement case or if looking for current language and echoing "localized sitename");
- same for 1) but fetching localized param $sitename_de, etc.

I would appreciate any help, thanks in advance.

Regards, Klaus

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

Re: Localizing $sitename?

Post by infograf768 » Tue May 17, 2011 4:44 am

The variable $title is included in "<jdoc:include type="head" />" and may or may not include the sitename depending of the setting in Global Configuration.

At this stage, as the variable "$app->getCfg('sitename')" is called in many parts of code, this would require extensive hacking.

The only clean way, if using multilanguage, would be to add the parameter for each content language, as done for meta. This needs a patch and would be a new feature.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

klabog
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Wed May 03, 2006 3:21 pm

Re: Localizing $sitename?

Post by klabog » Tue May 17, 2011 12:11 pm

Thanks for your quick response. I solved my problem with a quick and dirty patch of the template. It works but I'm not sure if its correct style:

Code: Select all

if ($this->language == "de-de") $this->sitename = " - Wohnen am Tempelhofer Feld";
elseif ($this->language == "es-es") $this->sitename = " - Vivir al lado del Parque de Tempelhof";
elseif ($this->language == "en-gb") $this->sitename = " - Stay beside of Tempelhof Field";
else $this->sitename = "";
infograf768 wrote:The only clean way, if using multilanguage, would be to add the parameter for each content language, as done for meta. This needs a patch and would be a new feature.
Do I understand your comment right, that there is a way to have the site meta translated?
I tend to propose a feature request like this:
  • Add a new manager named site manager equivalent to template manager
  • Move all global site relevant stuff there, for example site settings from global configuration as there are:
  • Site Name
  • Offline Message
  • Site Meta Description
  • Site Meta Keywords
  • Content Rights
  • Admin E-Mail
  • Allow copies of this page with language selection in the same way as we do for templates to have these parameters localized
Another way could be simply relate the global site settings page with the selected admin language and give the introduced fields a language parameter which then is used globally.

What is your opinion? Regards, Klaus


Locked

Return to “Language - Joomla! 2.5”