Creating and Editing Alternate-Language Templates within eeSiteKit
eeSiteKit installs three language templates in a template group called “kit_language”. The three language templates include one “Host-Language” (english_usa) and two “Alternate-Language” (german and spanish) templates. All templates may be found here:
Site Name › Templates › Template Management
Alternate-Language Template: The alternate-language templates represent working examples for your website’s alternate-languages. If your website will use more than one language, you’ll need one alternate-language template set up for each alternate language. By default, we’ve included examples in German and Spanish.
The alternate-language templates requires the setting of variables for the translation of your websites channel names and ID numbers and the names of a few key functions in your new site like Print, Search, and Share. You’ll want to set these variables after you’ve created all your websites Channels in ExpressionEngine
Creating And Editing A New Alternate-Language Template: We recommend you make a complete copy of the sample “german” template and rename the new template with the name of the language you are adding, then make all your changes in the new template so you always have the old “german” template as a reference.
When looking an alternate language temple, you notice that we’ve divided it up into three sections, “Alternate Language Settings”, “Channel Names and Numbers” and “Language Variables”.
Alternate Language Settings: In the Alternate Language Settings, you will be updating the following variables by replacing the word “german” with the template name of your new host language. Pay very close attention to formatting as accidentally deleting a quote or underscore could break things somewhere in the site.
site_language=‘german’
{german_cat_url_title}=’{category_id}’
heading_{german_cat_url_title}=’{german_cat_name}’
For example, if your new language template is named “dutch” you would update the above variables to look like this:
site_language=‘dutch’
{dutch_cat_url_title}=’{category_id}’
heading_{dutch_cat_url_title}=’{dutch_cat_name}’
If you will want a dynamic link that allows site visitors to be able to switch from this new language to the host-language or another alternate-language, there is one or two more variables in this section you’ll need to update.
The first is for the host-language:
change_{category_url_title}=’{german_cat_url_title}’
For example, if your new language template is named “dutch”, you would update the above variable to look like this:
change_{category_url_title}=’{dutch_cat_url_title}’
The second is for another alternate-language (the example below is to allow switching from “german” to “spanish”:
change_{spanish_cat_url_title}=’{german_cat_url_title}’
If you want visitors to be able to switch from “dutch” to “spanish”, you will want to update the above variable to look like this:
change_{spanish_cat_url_title}=’{dutch_cat_url_title}’
Channel Names and Numbers: In this section you’ll be setting 3 variables for each channel of your site. The example code in the “german” language template is a direct copy of the code used in the “german” language template at:
http://demo.eesitekit.com/mehrsprachig-kanal/mehrsprachige-sender-extended-content/
Before you begin this next step, we recommend you look up the exact “channel_short_names” and “channel_id” number of each channel of your site. You’ll find them in Channel Management:
Site Name › Admin › Channel Administration › Channel Management
All channel name and id number variable groups are set up in an advanced conditional. Please note that the first conditional must start out with just “{if embed:”, all the following conditionals start out with “{if:elseif embed:” and there must be a closing “{/if}” or your variable settings will not work.
You will need to create a trio of variables for each channel of your site. You can try editing the example code, and/or creating your own from scratch following the same pattern.
{if:elseif embed:weblog == ‘new-features’ OR embed:kit_channel_id == ‘17’}
german_channel_name=‘Neuen Funktionen’
german_channel_url=‘neuen-funktionen’
For example, if you were updating the above trio of variable settings for a new “dutch” language temple for a host-language channel_short_name of “new-features” (channel_id of 8), your finished variable settings would look like this:
{if embed:weblog == ‘new-features’ OR embed:kit_channel_id == ‘8’}
german_channel_name=‘Nieuwe functies’
german_channel_url=‘nieuwe-functies’
Language Variables: In the Language Variables section you’ll want to update all the German that is surrounded in single quotes with the appropriate translation in your new language. We’ve formatted each variable as a stacked pair for easier editing. The top row of each pair is the language variable label and the bottom row is the variable content. Do NOT change the top part unless you really know what you are doing as it can make that text disappear some place in your site; leave it in English exactly as you see it. The part you’ll update is the bottom row, in between the single quotes.
lang_edit_this_entry=
‘Bearbeiten Sie diesen Eintrag’
For example, if I were creating a new Dutch language template, I would update the variable like this:
lang_edit_this_entry=
‘Bewerk dit item’
When you encounter a global variable in the part to be translated, leave it as is (to keep it dynamic) or you may replace it with static text. An example would be the use of {site_name} in the phrase “Kontaktaufnahme mit Ihnen aus {site_name}”.
You may also create your own language variables for use within eeSitKit by following this same pattern for variable setting in the language templates. We think you’ll find this a very powerful tool once you get use it.
