User Tools

Site Tools


admin_menu:languages:changing_languages_client_side

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
admin_menu:languages:changing_languages_client_side [2013/07/19 17:33]
geomatt [Create Links to Change Languages]
admin_menu:languages:changing_languages_client_side [2014/09/25 16:55] (current)
Line 1: Line 1:
 ====== Changing Languages on the client side ====== ====== Changing Languages on the client side ======
  
-There is never a need to change any php file to be able to change languages.  There is a built in language choice form that you can use and get to using the link described in the first section below. Or you can create your own links you can place in your html design where you wish that will change the languages for you and explained in the second section below.  Neither require php code changes or file changes.  You only need to create links in your html either to the form or placing language change links in your html. +This tutorial has been moved to our [[startup_tutorial_and_checklist:feature_configuration:multi_language_setup:changing_languages_on_client_side|configuration and setup section here]]
- +
-===== Getting to the Language Choice Form ===== +
- +
-The built in language choice page rests at **index.php?a=21**.  If the url of your site happened to be www.example.com and the Geodesic software was installed in the base directory of that domain the url to the language choice form would be: +
- +
- <nowiki>http://www.example.com/</nowiki>**index.php?a=21** +
- +
- +
-You will see the language choice form allowing the client to choose the language they wish to see the site in.  This page will show all current "live" languages within the dropdown as a choice.  You can set a language "live" within the languages admin tool.  When the client comes to this page their currently chosen language will NOT be automatically selected in the language choice dropdown displayed on that page. +
- +
-===== Create Links to Change Languages ===== +
- +
-You can also create links that will change the language for you instead of pushing the client through the language choice form. These links can be placed directly in your html design where you need them to be.  Find the id of the language you wish to change to within the language admin tool.  The language id can be found in a column next to the language name in the languages admin tool.  The default language that comes with your installation is "1" and cannot be removed from the site. All other languages added after that obtain their own id. For example if the url to your domain were "www.example.com" and the Geodesic software were installed in the base directory of that domain then to change to a language with the id of 24 you would use a url like that below. +
- +
-<code html> +
-http://www.example.com/index.php?set_language_cookie=24 +
- +
-or  +
- +
-index.php?set_language_cookie=24 +
-</code> +
- +
-and a link html text link would look something like this: +
- +
-<code> +
-<a href="http://www.example.com/index.php?set_language_cookie=24">change to language name</a> +
-or +
-<a href="index.php?set_language_cookie=24">change to language name</a> +
-</code> +
- +
-and a "flag image" link would look something like this: +
- +
-<code> +
-<a href="http://www.example.com/index.php?set_language_cookie=24"><img src="/external/images/country_images/this_country.jpg" alt="link to change site language to language name"></a> +
-or +
-<a href="index.php?set_language_cookie=24"><img src="/external/images/country_images/this_country.jpg" alt="link to change site language to language name"></a> +
-</code> +
- +
-Of course change the url to your own domain.  Also change the "24" to the language id of the language you wish to change to and you should be able to use this as a "language choice" link within your templates (enterprise only) or html to change the language the site is displayed in with one click. +
- +
-====Dynamic Links==== +
- +
-The above links would result in the user ending up on the front page of your site. If you want language selection to persist whatever other page a user might be viewing, it is possible, but requires template code that's a little fancier. Note that this code is provided for reference only and may require modifications to adapt to your use case. +
- +
-<code html> +
-{$lang = 24} +
-<a href="{$smarty.server.SCRIPT_NAME}?switchLang=yes{foreach $smarty.get as $key => $value}&{if $key === 'set_language_cookie'}{$key}={$lang}{else}{$key}={$value}{/if}{/foreach}{if !$smarty.get.set_language_cookie}&set_language_cookie={$lang}{/if}">Change to language 24</a> +
-</code>+
admin_menu/languages/changing_languages_client_side.1374255190.txt.gz · Last modified: 2014/09/25 16:55 (external edit)