get Joomla sitename in different language - joomla

my Joomla have 3 language and I submit sitename for each language in language manager.
I used this to get sitename
$app = JFactory::getApplication();
$sitename = $app->getCfg('sitename');
but this code only give me sitename submitted on General Configuration.
how to get sitename in that language?

Another possible solution (tho not so elegant is to fetch it from database table #__languages, where sitename is stored):
$lang = JFactory::getLanguage();
$db = JFactory::getDBO();
$query = 'SELECT sitename FROM #__languages WHERE lang_code = "' . $lang->getTag() . '"';
$db->setQuery($query);
$sitename = $db->loadResult();
// If no sitename defined - show default sitename
if (!$sitename){
$app = JFactory::getApplication();
$sitename = $app->getCfg('sitename');
}

Try this,
In your case $sitename = $app->getCfg('sitename'); will not work bcoz you are using multi-language Joomla Site.
This option is only for get the values from global configuration.
You can try this,
You have multiple language files available each have a Proper site name consider the constant is SITE_NAME="Your site name";
Then you can simply get your site name like below.
JText::_('SITE_NAME');
Hope its helps..

This is an old post but I wanted to reply because the same process I will outline below is applicable in Joomla 2.5 as well as Joomla 3.x. It does not require any special editing or extensions.
This can easily be accomplished by using Joomla's built in features in the "Language manager". These steps also assume you already have a Multilingual Joomla site up and running. If you need instructions on how to do this you can refer to this link:
https://www.scribd.com/doc/82768844/Joomla-2-5-multi-language-website-without-using-3rd-extensions-in-10-steps
then use the steps outlined below to give your site a custom site name for each language.
The Link above is for Joomla 2.5 but the same steps outlined there can be applied to a Joomla 3.x site.
1) Log in to the administrator section of the site
2) Click on "Extensions"
3) From the Extensions dropdown menu choose "Language Manager"
4) Once in Language Manager you will see the installed languages and these options:
Installed - Site
Installed - Administrator
Content
Overrides
NOTE:
In Joomla 2.5 they will be listed in a row above the installed languages.
In Joomla 3.x they will be listed in a column to the left of the installed languages.
5) Now click on "Content"
6) The name of each language under the "Title" row will now be clickable. Click on the name of the language you want to set the "Custom Site Name" for.
7) Once you have clicked on the language name look for "Site Name". In Joomla 2.5 this will be on the right hand side. In Joomla 3.x this will be in a row above the options.
8) Once you click on Site Name you will see an option that reads "Custom Site Name". Enter the custom site name for that language and it will take priority, essentially overriding what is entered in the Global Configuration.
Please note also that you only need to enter a custom site name for the language that you want to change it for. Example: if your site's main language is English and you have the English version of your site name listed in the Global Configuration and you also have French, Spanish, and German installed then you only need to enter, if you want, a custom site name for the French, Spanish, and German languages.
Something else to consider is that if you need to add a custom site name for the language(s) you more than likely should consider adding custom Metadata for the language(s) such as the "Meta Keywords" and "Meta Description". To accomplish this follow the steps outlined above up to Step 5. Instead of clicking on Site Name you would click on Metadata and enter the language specific customized information for "Meta Keywords" and "Meta Description".
9) Last but not least, and most importantly, after you're all done with the language customizations, Click on "Save" or "Save & Close" to save all your changes.
This new language specific custom site name will be displayed if the site is offline.
Also, for SEO purposes, you can have your site name displayed either before or after the name of the Menu item which appears in the tabs.
That setting can be changed in the Global Configuration options.
Under SEO Settings look for "Include Site Name in Page Titles" and choose either "After", Before, or "No".

Related

How can I change taxonomy term id to name in Drupal 7

Using the View Option in admin side have changed my website URL from www.123.com/plans/1 to www.123.com/plans/my-plan.
After that my entire View (Page Browser) showing the articles (Associated with My-plans) with the heading and content with read more option. But I need the customized Page layout, I am getting the correct layout for the www.123.com/plans/1/my-plan
But it's not working for www.123.com/plans/my-plan.
If I right understood your problem, you need to install Pathauto module and set up pattern for your taxonomy vocabulary (path to this settings admin/config/search/path/patterns).

Magento language button store view

I've an website in dutch. http://www.domain.com and an german flag button to http://www.domain.com/german.
i have made an store view called german with a local language german.
How do i get to view this store view on the link www.domain.com/german
There are few ways for doing this.
1) Enable store code in the URL.
Magento allows you to add a store code of your store view to the URL. For instance, if your Dutch store view has a code dutch and your German store view has a code german, then Magento will automatically load a correct store. domain.com/dutch will load a Dutch version and domain.com/german will load the German version of your website. The drawback of this solution is a store code added even for the main domain.
The config setting can be found in Admin Panel (aka Back Office, BO) > System > Configuration > Web > Url Options. There you will find "Add Store Code to URLs" option.
2) Edit .htaccess file.
If you want to avoid the drawback of solution 1) you can modify your main .htaccess file. Add an entry that will search for /german suffix and will load the German store code. Here's a small example (I'm not an expert in this matter, but it should be something like this):
SetEnvIf Host .*domain.com/german.* MAGE_RUN_CODE="german"
You can play around with .htaccess more. Search the web if you want to learn more about .htaccess stuff.
3) Modify index.php of the application
This is very similar to the solution 2), but you do this directly in PHP. Find
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
line in index.php and replace it with something like this:
if (!$_SERVER['MAGE_RUN_CODE'] && strpos($_SERVER['HTTP_HOST'], '/german') !== false) {
$mageRunCode = 'german';
} else {
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
}
4) Add a new entry to the Apache vhost.
Create a new virtual host (vhost) for domain domain.com/german and put there SetEnv MAGE_RUN_CODE "german".
In my opinion the best option is the 2). It is the most flexible and you don't have to change any code. For development workstation 4) would be also sufficient.
Please note that these are only examples and they may not work on the first shot. I'm writing this from my memory and I cannot really check them now. Hope this gives you a brief idea how to handle your situation.

title does not change when in Category joomla 2.5

I have created one website using joomla 2.5
I have created one item: shop
I went out the home page, and click on the link categories: shop
the title of this page, the same as the title of the home page: Home
if now I want, page headers categories: shop "shop" What do I do
I'm not sure I understand your question correct. But you may want to have a look at the menu item parameters. On the right side there is a slider named "Page Display Options". This allows to specify a title for the browser tab and the page heading.
There is also a parameter in the Joomla Global Configuration in the "Site" tab in the "SEO Settings" section named "Include Site Name in Page Titles". This allows to specify if the site name should be added to the page title or not.
Hope that helped, otherwise please specify your question.

Joomla: homepage url

Joomla requires that home page was linked with some component.
So, if i link menu item of homepage to some article, i get a url like:
"index.php?option=com_content&view=article&id=68&Itemid=464" on frontend.
How to link homepage to "/" ?
UPD:
Joomla verion 1.7
Maybe, i not accurately explained.
I link home menu item with some article.
When i go to www.mysite.com - all fine, choosen article is shown on homepage.
But then the home menu item on frontend became "index.php?option=com_content&view=article&id=68&Itemid=464", not just '/'
You must use the default Joomla format for setting something as the "home" page. in 2.5 (since you failed to tell us which version you're running) you do this by using 'featured articles'. By default, any featured article is displayed on the homepage.
In older versions (1.5) you must mark it to display on the 'front page'
In doing that when you go to http://www.yoursite.com/ - you will see the articles listed as 'featured' or 'front page' articles. You can adjust how they display by using the front page or featured article manager.
I apologize if I've misunderstood your question - but hope this helps. It also looks like you don't have SEF URL's turned on - you may want to look into that. Regardless your front page will display without any additional URL stuff if you use the methods outlined above.
In your menu manager (backend), create a new entry for 1 article and select it in the list. After that, just define this new menu entry as default (or homepage).
This article will be the default homepage of your website and will be accessible via www.yoursite.com/

Magento: Change default language

I've searched for this for hours again, so here I am!
How do you change the default (English) language to any other language in Magento? Basically, I want all my customer from store B to arrive at the French version of the site first by default, not the English.
Thanks a lot
In the admin menu System > Configuration, the first tab shown should be General and it includes a Locale section. That is where you set a store's language. You can choose which store it applies to with the scope selection in the top left of the page.
Set those variables in .htaccess
SetEnv MAGE_RUN_CODE "here put store_code from BO for french version"
SetEnv MAGE_RUN_TYPE "store" <- this leave as it is
Go to Magento Admin
System > Configuration
Current Configuration Section from left side bar
Go to general block and then go to Local Options and select your default language and click on save config and clear your cache from admin then got to frontend and refresh the page you will see the default language is set to your desired language.
Login to backend then go to System > Manager Stores > Click "Main Website Store" and chose default Store you need.
You can use apache mod_rewrite for this purpose, check following rule :
## Redirect according to user's language
## you can put .htaccess file
RewriteEngine on
# French Users
RewriteCond %{HTTP:Accept-Language} ^fr [NC]
RewriteRule ^$ /fr/ [L,R=301]
# Default Page
RewriteRule ^$ /en/main-page [L,R=301]
Log into your admin System => Manage Stores => Click on the "default store view" in your case English Store (Change the sort order to (1) as this will become additional store view.)
And after click on the French store view Keep the sort order as zero (0) as this will be your default language.
Log in to magento admin => System -> Configuration. Then from the top left in "Current Configuration Scope:" select your stores and then click on Configuration of left side in GENERAL section click on General then click on "Locale Options" then select French from the dropdown in Locale section.
download language files and place them into the right folders (app > local)
Login to admin panel and go to System > Manage stores
Create a new store view
Login to admin panel and go to System > Configuration > General
and select each store view from “Current Configuration Scope” drop down menu at the upper left corner of the window.
Set the corresponding locale for each store view
Clear the cache (System – Cache Management)
In order to set the default language for magento, you must go to System > Manage Stores, click on the “Store Name” and set the default language from there
Beware of the content of your language pack. It must have been tested that it works properly.
Reference: Magento language pack installation
Tried everything that's written here except for changing .htaccess...
Nothing worked but I found another way:
System->Manage Stores
click on Main Website Store
change Default Store View to French
refresh the cache if it's not disabled yet
May be it's version dependent - mine is 1.7.0.2
I am not sure about his code but you could give a try for below code:
Add a language pack In Magento store view:
Creating a store view for a language is not too hard in magento follow the steps given below and you are done with it.
Step 1: Download the language pack you need and then unpack it to your Magento install folder.
It copies two folders: one goes to app\design\frontend\default\default\locale
and the other one to app\locale.
Step 2: Go to System > Configuration in your admin. On the left top corner in Current Configuration Scope dropdown box, you can see Default Config, and Main Store in English store view.
Step 3: Now let’s go and add the French store view. Under the dropdown box, there’s Manage Stores link or you can directly go to System > Manage Stores. Click the Create Store View link on top right, and type these in store view information form:
Store: Main Store
Name: French
Code: french
Status: Enabled
Sort order: 0
Step 4: Save, go back to System > Configuration. In Current Configuration Scope dropdown box, you now see there’s French store view. Click that link.
On Locale options tab on the left, uncheck the ‘use website’ checkbox then change the locale to French (France). Save.
Now you can have your website in French.
If no store is specifically set in MAGE_RUN_CODE, Magento displays the store with the lowest sort_order. Log in to your Magento Admin and go to System -> Manage Stores. Here, select each store and change the Sort Order field until the store you want to use as your default has the lowest sort order
System -> Configuration
1) if you have multiple store then:
Left upper corner (below menu-links) you will see "Current Configuration Scope:" select store from there.
after that continue to step 2
2) if single store then:
left side "General" -> "Default Country"
if "Default Country" not selectable then please uncheck "Use Website" right site to country box
Thanks,
Chirag Nandaniya
Please use this link and installed this extension in your magento store http://www.magentocommerce.com/magento-connect/magento-community-modules-french-france-language-pack.html
and setup/create store view for french
Go to admin->system->configuration and do following steps
and from admin side just setup Country option to France by clicking on General Tab located in left side and also set default Currency by clicking on Currency Setup located in left side
but be careful to select Store view from first before applied above things from Current Configuration Scope: located on left side panel.
let me know if you have still facing any problem :)
The correct method is:
Go to System > Manage Stores. Click your main store name (for example Main Website Store) and in Default Store View field select French (I guess you have already created French as a Store View Name).

Resources