Forums / Templates, Stylesheets, Page Layout / 1.3.6. Directory Change/ Language Modification

1.3.6. Directory Change/ Language Modification

Locked
Results 1 to 10 of 10
This thread is locked. New replies are disabled.
25 Dec 2006, 21:29
#1
rabbcon avatar

rabbcon

Zen Follower

Join Date:
Dec 2006
Posts:
143
Plugin Contributions:
0

1.3.6. Directory Change/ Language Modification

I have installed Zen Cart locally. I installed the Italian language pack successfully. I have tested it an it works great. However, there are areas in my custom template I need to change.

One of these areas is the tpl_footer.php file. I am just learning Zen Cart's directory structure for customizing templates. However, I'm stuck in modifying the tpl_footer.php file into Italian. I will install more than just Italian so this file should be set up so that I can modify it for each language.

In seaching the archives I came across this fix:
In searching for my answer I found this thread: http://www.zen-cart.com/forum/showthread.php?t=28224&highlight=template+language

This is my answer, however, the structure has changed for 1.3.6. Under includes/modules/ there is no tpl_header.php or tpl_header.php file.

Please point me to the updated directory for the 1.3.6 version and where I should place the tpl_footer_italian.php file. Additionally, I will change other template files so explaining the new structure as it applies to this request would be great.

Thank you.
25 Dec 2006, 22:00
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Posts:
31,500
Plugin Contributions:
4

Re: 1.3.6. Directory Change/ Language Modification

One of these areas is the tpl_footer.php file.
You are looking in the wrong location...

These tpl_ files are in your_template file structure and originals are located in the /includes/templates/template_default/common and /templates folders that you will copy the relavant files to /includes/templates/your_template/common and /templates folders
25 Dec 2006, 23:12
#3
rabbcon avatar

rabbcon

Zen Follower

Join Date:
Dec 2006
Posts:
143
Plugin Contributions:
0

Re: 1.3.6. Directory Change/ Language Modification

Thanks for your assistance Kobra. However, I know which directory the tpl files are under.

Let me explain myself a bit more. I have a custom template I created. This template has a footer. In the footer are hyperlink descriptions in English. I will create a site that will have multiple languages. I have installed the first language pack, Italian. I have tested it and it works fantastic.

However, on my custom footer after the choice of Italian language is selected I still see English hyperlink descriptions in the footer. I need this to be changed to Italian. From this archive: http://www.zen-cart.com/forum/showthread.php?t=28224&highlight=template+language I realize that I need to create footers and headers (for example) for every language I create. This means, if I have Italian and Russian installed and want the footer and header to be different I have to change each file to tpl_footer_russian.php, etc. I understand this completely.

Here is where 1.3.6 changes from what is in the archive. Let me actually paste the post here so no one has to go and look at the post:

 If you want to have completely different headers for each language, you could try this:
make a different tpl_header.php file for each language and save them as tpl_header_english.php, tpl_header_spanish.php etc
Then in includes/modules/header.php, change this line at the end     

Code:
      *require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php'); 

to     
Code:
*require($template->get_template_dir('tpl_header_' . $_SESSION['language'] . '.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header_' . $_SESSION['language'] . '.php'); 


Here is where the directory structure changes in 1.3.6: includes/modules/header.php NO SUCH ANIMAL. Only footer.php exists and there is no require statement in that file.

This is where I am getting stuck. Instead I modified the require statement in tpl_main_page.php file under the common directory and created tpl_footer_italian.php. I got a parsing error.

I need each footer and header to be unique for every language. These directions in the archived forum disscussions are outdated. Does anyone know what the current modification is to this customization?

Thank you.

I hope my post is more understandable.
26 Dec 2006, 22:38
#4
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Posts:
10,475
Plugin Contributions:
9

Re: 1.3.6. Directory Change/ Language Modification

Rabbcon:

I realize that I need to create footers and headers (for example) for every language I create. This means, if I have Italian and Russian installed and want the footer and header to be different I have to change each file to tpl_footer_russian.php, etc. I understand this completely.
This would only be the case if you wanted the header and footer to function differently for each language. If you want them to function in the same way, but in Italian and Russian then you only need ensure that your language files are complete (many of the language packs aren't).

If you could be more specific about the changes that you want to make to the header and footer (ideally with a link to the current state of your site), it would be easier to help you.
27 Dec 2006, 00:15
#5
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Posts:
10,475
Plugin Contributions:
9

Re: 1.3.6. Directory Change/ Language Modification

A quick addition ... if your design really does need differently structured headers and footers for each language, then the file that calls them is common/tpl_main_page.php.
27 Dec 2006, 18:01
#6
rabbcon avatar

rabbcon

Zen Follower

Join Date:
Dec 2006
Posts:
143
Plugin Contributions:
0

Re: 1.3.6. Directory Change/ Language Modification

Thank you. The headers and the footers will not function differently for each language.

My site is local so unfortunately there is not link I can supply. However, I will give you a detailed example:

ENGLISH FOOTER
Privacy Notice (a hyperlink)

FRENCH FOOTER
Notification d'intimité (a hyperlink)


ITALIAN FOOTER
Avviso di segretezza (a hyperlink)

SPANISH FOOTER
Aviso de la aislamiento

GERMAN FOOTER
Privatlebennachricht (a hyperlink)

Each hyperlink that is in the default language of English in my footer and header should change into the corresponding language the user selects. So, when the user opens my site they will see everything in English. They will go to the header and select their language from the CHOOSE LANGUAGE drop down or flag. Once that flag is selected they will then see the page will change into their selected language. This is happening except for the header and the footer. Can you tell me exactly how this change should be made?

Thank you.
27 Dec 2006, 18:29
#7
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Posts:
31,500
Plugin Contributions:
4

Re: 1.3.6. Directory Change/ Language Modification

In the /includes/languages - you should have english.php, french.php, german.php, italian.php, & spanish.php

You then also need folders:
/includes/languages/english
/includes/languages/french
/includes/languages/german
/includes/languages/italian
/includes/languages/spanish

and in these folders, respectively, any files that have been translated i.e.
header.php
create_account.php
and so on

along with language specific custom template folders & contents

If you have a custom template folder in /includes/english/my_template
You need this replicated for each language
27 Dec 2006, 18:30
#8
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Posts:
10,475
Plugin Contributions:
9

Re: 1.3.6. Directory Change/ Language Modification

Ah. A good example. For most text and links in the header and footer you would simply find the English text in the header in the form (for example) HEADER_TITLE_MY_ACCOUNT has define statements in the header.php file for each language define('HEADER_TITLE_MY_ACCOUNT','My Account'); in languages/english/YOUR_TEMPLATE_NAME/header.php and define('HEADER_TITLE_MY_ACCOUNT','Mon Compte'); in languages/french/YOUR_TEMPLATE_NAME/header.php, etc.

Zen Cart will then detect the language that your visitor has chosen and use the appropriate language file.

HOWEVER ... your example is taken from a link generated by Zen Cart's EZ-Pages. These have unfortunately been implemented mono-lingually. But there is an extension available in the downloads section that makes them multi-lingual. You can find it here.
29 Dec 2006, 15:35
#9
rabbcon avatar

rabbcon

Zen Follower

Join Date:
Dec 2006
Posts:
143
Plugin Contributions:
0

Re: 1.3.6. Directory Change/ Language Modification

Thank you for explaining this to me and pointing me in the correct direction for the fix.
29 Dec 2006, 22:24
#10
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Posts:
10,475
Plugin Contributions:
9

Re: 1.3.6. Directory Change/ Language Modification

Glad to be of help. This is important to get right from the beginning when you're building a multi-lingual site. You might find this wiki entry helpful as well.