User Tools

Site Tools


Sidebar

admin_menu:languages:changing_languages_client_side

This is an old revision of the document!


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.

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:

http://www.example.com/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.

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.

http://www.example.com/index.php?set_language_cookie=24
 
or 
 
index.php?set_language_cookie=24

and a link html text link would look something like this:

<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>

and a "flag image link would look something like this:

<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>

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.

The above link would direct the client back to the front page of your site. The following smarty code could be used to redirect back to the current page the client is clicking the link from:

<a href="{$smarty.server.request_uri}{if !$smarty.server.query_string}?{else}&{/if}set_language_cookie=24">change to language name</a>

<a href="{$smarty.server.request_uri}{if !$smarty.server.query_string}?{else}&{/if}set_language_cookie=24"><img src="/external/images/country_images/this_country.jpg" alt="link to change site language to language name"></a>
admin_menu/languages/changing_languages_client_side.1371829783.txt.gz · Last modified: 2014/09/25 16:55 (external edit)