Zen Follower
- Join Date:
- Mar 2006
- Location:
- Florence, Italy
- Posts:
- 153
- Plugin Contributions:
- 0
A multilingual store
First of all excuse me for my very bad english, and try to understand what I mean.
I'm building a multilingual store (english, italian, french & spanish) and I want to show to the community the problems I met and the solutions I've taken.
1 - Controll the scripts with the define(......) statements
The first thing to do when we have installed a new language is to controll and compare all the scripts that contain the define(......) statements, in the store and in the admin sections. Very often happen that some definitions are not present, and somtimes have different names.
So, taking the english as base-language, we mus controll all other languages.
2 - How detect the actual language
The variable $_SESSION['languages_id']; contains a number that identifies the language. That number is "the order of installation of the languages", and so if I write same new code, I must know it. More, if I want give my code to a friend, he may have problems.
So I've defined a constant (in the store and in the admin section) in this way:
include\languages\english.php --> define('ACTUAL_LANGUAGE', 'en');
include\languages\italian.php --> define('ACTUAL_LANGUAGE', 'it');
include\languages\french.php --> define('ACTUAL_LANGUAGE', 'fr');
include\languages\spanish.php --> define('ACTUAL_LANGUAGE', 'sp');
and when I need, I use the constant ACTUAL_LANGUAGE instead of the $_SESSION['languages_id'].
3 - The function zen_date_long in the store
I had many problems with the statement @setlocale(LC_TIME, .........'); and so I've modified the function zen_date_long for not becoming crazy. You can see that on the file functions_general.php in attachments. Note that I've not use directly the $day, $month, $year indexes, because the two functions mktime and getdate may correct errors (32 dec. becomes 1 jan.)
4 - The function zen_date_long in the admin
As you can see in the attacments, the function zen_date_long in the admin (general.php) is very similar to the function in the store, but there is the parameter $language='no'.
For the moment ignore this parameter (we'll see later, in the next thread) but notice that the function may be called also with only the first parameter, and that the control is made first to the existance of the $language.
5 - Modifying the script include\modules\new_products.php
I've decided that a new product remains "new" for 60 days, an so I want that in the intest of the table is written, for example, "New Products For July-August". You can see in the attachments how this is performed.
6 - Modifying the script include\modules\specials_index.php
The changements in the specials are now very simple to understand See it in the attachments.
In the next thread I'll write on the language problem for the e-mail sent to a costumer when in the section "admin" is changed the status of an order.
Regards to everybody - Giovanni