This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorials:design_adv:using_language_template_set [2011/03/29 18:44] jonyo fixed reference to wrong method name |
tutorials:design_adv:using_language_template_set [2014/09/25 16:55] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{indexmenu_n> | ||
====== How to Import Language Template Set ====== | ====== How to Import Language Template Set ====== | ||
- | These instructions will walk you through the steps needed to use any of the Language Translations provided in the public downloads on our site. | + | This tutorial has been moved to out [[startup_tutorial_and_checklist:feature_configuration:multi_language_setup:language_template_import|setup and configuration |
- | + | ||
- | - Create a new language in the admin panel for the language you will be importing, if you have not already. | + | |
- | - Download the language translation template set provided in the public downloads on our site to somewhere on your computer, and keep track of where you downloaded it to. You can find that section | + | |
- | - In your admin panel, go to **Design > Template Sets**. | + | |
- | - Click the **Browse** button | + | |
- | - Click the **Upload** button. < | + | |
- | - When it is done uploading, you should see the new template set listed in the list of template sets. Click on the button **Import Text Changes** next to the uploaded template set. When you do, you will see a window that looks similar to below: {{ : | + | |
- | - In the options for what language to import the changes to, select the language that you created back in step 1, then click **Import Text**. | + | |
- | - Once the import is complete, make sure the new template set is active by checking the active box next to the template set, if it is not already. < | + | |
- | + | ||
- | + | ||
- | <tip c n> | + | |
- | + | ||
- | ===== Loading Template Set Based on Language ===== | + | |
- | + | ||
- | If you use a single language on your site, the instructions above are all you need to import and use the language based template set you need. If you have a multiple language website, and want to make it load a different template set for each language, you can do that by following the instructions below. | + | |
- | + | ||
- | + | ||
- | **Skills** | + | |
- | * Comfortable with using FTP (to upload and download files from your site) < | + | |
- | * Basic understanding of how PHP works will help, but not necessary if you have a forum account (to ask for help with the PHP portions in the forums ;-)). < | + | |
- | + | ||
- | **Instructions** | + | |
- | - If you have not already, use the first set of instructions above to create each language and load the template set for that language on your website. < | + | |
- | - Turn off Geo cache, if currently turned on, in your admin at **Site Setup > Cache**. < | + | |
- | - In your admin, at **Design > Template Sets**, ensure that the template set(s) that you want to have active "by default" | + | |
- | - Download and open the file **geo_templates/ | + | |
- | <code php> | + | |
- | <?php | + | |
- | ########################################### | + | |
- | ## Auto-generated file | + | |
- | ## It is not recommended to edit | + | |
- | ## this file directly, but you can | + | |
- | ## if you want. | + | |
- | ## | + | |
- | ## Generated: Oct 5, 2010 17:07:16 | + | |
- | ########################################### | + | |
- | + | ||
- | + | ||
- | /** | + | |
- | * To manually add your own template set, use the syntax: | + | |
- | * | + | |
- | * geoTemplate:: | + | |
- | * | + | |
- | * Where folder_name is the directory name, relative to this current directory. | + | |
- | * NOTE: Default template set is always added by system as the last template set | + | |
- | | + | |
- | * | + | |
- | * If you do not wish manual changes to be overwritten next time admin makes a | + | |
- | * change, be sure to put them in the " | + | |
- | */ | + | |
- | + | ||
- | if (!defined(' | + | |
- | # [CUSTOM SECTION] # | + | |
- | //Anything manually added to this section will be left intact even if changes | + | |
- | //are made in the admin panel. | + | |
- | + | ||
- | //BOO! | + | |
- | + | ||
- | # [/CUSTOM SECTION] # | + | |
- | } | + | |
- | + | ||
- | geoTemplate:: | + | |
- | </ | + | |
- | If you are still only using the default template set, that last line will be replaced by a //PHP Comment// stating that there are no template sets. If that is the case, that means you did not follow step 3 above correctly, follow that step and make sure you have your main template set active. | + | |
- | < | + | |
- | - You will need to create a language ID map to map each language ID to the template set you want to load for that language ID. The language ID will be listed for each language in your admin at **Languages > Languages Home**. | + | |
- | 24 => ' | + | |
- | 25 => ' | + | |
- | );</ | + | |
- | In that example, it maps language ID 24 to the template set // | + | |
- | - Now, in the **t_sets.php** file, directly after the line **# [CUSTOM SECTION] #**, add the PHP you just created for the languages, followed by this:< | + | |
- | $session = geoSession:: | + | |
- | $current_language = $session-> | + | |
- | + | ||
- | if (isset($languages_map[$current_language])) { | + | |
- | geoTemplate:: | + | |
- | } | + | |
- | </ | + | |
- | < | + | |
- | - If your map happened to look like the example we gave, your **t_sets.php** file would now look like this:< | + | |
- | <?php | + | |
- | ########################################### | + | |
- | ## Auto-generated file | + | |
- | ## It is not recommended to edit | + | |
- | ## this file directly, but you can | + | |
- | ## if you want. | + | |
- | ## | + | |
- | ## Generated: Oct 5, 2010 17:07:16 | + | |
- | ########################################### | + | |
- | + | ||
- | + | ||
- | /** | + | |
- | * To manually add your own template set, use the syntax: | + | |
- | * | + | |
- | * geoTemplate:: | + | |
- | * | + | |
- | * Where folder_name is the directory name, relative to this current directory. | + | |
- | * NOTE: Default template set is always added by system as the last template set | + | |
- | | + | |
- | * | + | |
- | * If you do not wish manual changes to be overwritten next time admin makes a | + | |
- | * change, be sure to put them in the " | + | |
- | */ | + | |
- | + | ||
- | if (!defined(' | + | |
- | # [CUSTOM SECTION] # | + | |
- | $languages_map = array ( | + | |
- | 24 => ' | + | |
- | 25 => ' | + | |
- | ); | + | |
- | $session = geoSession:: | + | |
- | $current_language = $session-> | + | |
- | + | ||
- | if (isset($languages_map[$current_language])) { | + | |
- | geoTemplate:: | + | |
- | } | + | |
- | + | ||
- | //Anything manually added to this section will be left intact even if changes | + | |
- | //are made in the admin panel. | + | |
- | + | ||
- | //BOO! | + | |
- | + | ||
- | # [/CUSTOM SECTION] # | + | |
- | } | + | |
- | + | ||
- | geoTemplate:: | + | |
- | </ | + | |
- | < | + | |
- | - Save the changes, and upload the file. < | + | |
- | - View the front page of your site. Does it still display correctly? | + | |
- | - Change your language to each of the different languages you have on your site, and make sure the home page uses the correct template set for each language. | + | |
- | - You are done! Make sure you keep your site cache **turned off**, as it will cache the location of each file. When using a different template set for different languages, this will cause problems with the cache. < | + |