bouvet
Posts: 24
|
| Posted: 07/05/2008, 8:22 AM |
|
Hello,
I have a project who works since some years well in German
I need to add the French language. With the implation of a new language, I am a very Newbie
I already:
- added in Locales & Encodings the French
- make some translations to test
I want to add a listbox with the choice of the language. When I tried to do it, it does not work.
1. How to do it? When I choose the language all the pages will be in the right language. I already checked Forum and Help but I faildes.
2. This project is a Webshop: www.miyabi-japan.de:
Do I have to add new fields for the translation? For example for the description, the title ans son on?
Thanks for your Help.
Philippe
_________________
Webdesign Hildesheim Hannover
http://www.actidesign.com |
 |
 |
Zye
Posts: 56
|
| Posted: 07/05/2008, 8:49 AM |
|
Hi
As it happens my next project requires multi language support also, which I haven't touched on before. So I would like to ask the same questions as Philippe. I know that John & Rick have got it licked. Maybe they could shed some more light, so we don't have to trawl the CCS help files Am I a lazy so & so? 
Cheers
Zye ...
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/05/2008, 9:03 AM |
|
Hi
I am not to clear what your question is. But since I just finished doing something like this, I will try to help.
Check Out : http://webtestinglive.com/
You wiill see the language selection at the top.
The way I made that work was create a record with just one field in it and allow insert and update. (I used the builder). Then removed all the buttons and extra stuff the builder creates except the one control that was changed to a listbox. Named the control locale. This is the cookie name and session name that is used by CCS to control the language. Pointed the list box to a table that had bound, text values that match the locale string requirements. eg: Text=Deutch, Bound value=de. Set the record to preseve both get and post parameters. Set the return page to a page that has the languuage support available. (I used index.php). Then set the controls client onchange event to be supmit form.
Wiola. after changing the value of the language select listbox the submit caused the following post: index.php?locale=de.
After that happens CCS has coded the language support to be controlled by the session value locale.
Another thing you might try, (I did not do it this way) is maybe to a
CCSetSession("locale","de");
before going to another page.
If your question is converting existing pages to language support, That is a little more tricky.
After turning on langiage support you will ba able to translate all the static text by highlighting the text, right click, select 'insert translation'.
To do that for controls and the like, they have to be recreated with the new CCS settings for language. You can either recreate the page from scratch or just create a new control the delete the old one. There are some other tricks you can try here like creating a translation somewhere on the page, after you have named it an provided the translations, take the template text geneated ( {res:transvalue} ) manually change it on the control or object, then remove the original temporary translation object.
I also discovered a problem with how Mysql stores special characters vs how the CSS translations handle them.
For both MySql and CCS to display special characters correctly, each lanugage must use windows-1252 encoding. be sure that is also set at the project level.
If you are converting an existing project you might get a bunch of warning about the HTML metatag does not Match utf-8 etc. To properly convert you need to go into each of your HTML templates and be sure the meta tag for encoding is windows-1252 as CCS will not update pages already created. You have to do that manually.
Finally, if you have set the project char set and encoding to Windows-1252 (Western European) and set the ecoding to that for each language, and checked all the original HTML for thr proper encoding meta tags, You will need to select php 5 as language and encode extention to iconv.
I know that's a lot of info. But it works and you will certainly begin to learn how CCS performs internationalization.
If you need any more info, let me know.
Have Fun.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/05/2008, 9:04 AM |
|
Hey Zye...
Long Time No See.
How did FFMPEG stuff finally come out.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/05/2008, 9:09 AM |
|
BTW..
I have tried to get YES to admit there is a problem with their code when changing to PHP5.
If you look in the Common.php file you will see that the version check stays at checking for version 4. I sort of thing if you change to PHP5 that check should change to check for ver 5.
SO when ever I select version 5 as language I modify that version check manually in Common.php.
For the encode extention iconv to work properly PHP5 or greater is required.
Bye for Now.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
bouvet
Posts: 24
|
| Posted: 07/05/2008, 9:12 AM |
|
Hi,
First I just thank you for your long answer. I have to read and to try all what you wrote. I give you some answers on Monday or Thuesday. But if some others have differents ideas, they are welcome.
Philippe
_________________
Webdesign Hildesheim Hannover
http://www.actidesign.com |
 |
 |
Zye
Posts: 56
|
| Posted: 07/05/2008, 10:17 AM |
|
Hi John
Nice work on your webtestinglive site. Do you have a cookie that remembers which language you have selected previously? When I revisited your site after selecting French previously it was still in French ... which is cool.
FFMPEG is working great. I found out that you have to have PHP 5.2+ to get access to an accurate file upload progress stat. I am using the code below as an indicator that something is happening. I haven't looked into hiding it before an upload commences.
In Submit button HTML put:
onclick="progress_update();"
Under <!-- BEGIN DeleteControl --> HTML
<div style="BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: black 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8pt; PADDING-BOTTOM: 2px; BORDER-LEFT: black 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: black 1px solid">
<span id="progress1"> </span> <span id="progress2"> </span> <span id="progress3"> </span> <span id="progress4"> </span> <span id="progress5"> </span> <span id="progress6"> </span> <span id="progress7"> </span> <span id="progress8"> </span> <span id="progress9"> </span> <span id="progress10"> </span> <span id="progress11"> </span> <span id="progress12"> </span> <span id="progress13"> </span> <span id="progress14"> </span> <span id="progress15"> </span> <span id="progress16"> </span> <span id="progress17"> </span> <span id="progress18"> </span> <span id="progress19"> </span> <span id="progress20"> </span> <span id="progress21"> </span> <span id="progress22"> </span> <span id="progress23"> </span> <span id="progress24"> </span> <span id="progress25"> </span> <span id="progress26"> </span>
</div>
<script language="javascript">
<!-- Begin Script
var progressEnd = 26; // set to number of progress <span>'s.
var progressColor = 'orange'; // set to progress bar color
var progressInterval = 1000; // set to time between updates (milli-seconds)
var progressAt = progressEnd;
var progressTimer;
function progress_clear() {
for (var i = 1; i <= progressEnd; i++) document.getElementById('progress'+i).style.backgroundColor = 'transparent';
progressAt = 0;
}
function progress_update() {
progressAt++;
if (progressAt > progressEnd) progress_clear();
else document.getElementById('progress'+progressAt).style.backgroundColor = progressColor;
progressTimer = setTimeout('progress_update()',progressInterval);
}
function progress_stop() {
clearTimeout(progressTimer);
progress_clear();
}
// End -->
</script>
Thanks alot for the info on iconv PHP5. I have had these options set in my previous project and didn't realize if it was working or not Duh! I will read up and have a go at this languages thing now.
Many thanks for your help yet again 
Cheers
Zye ...
|
 |
 |
Zye
Posts: 56
|
| Posted: 07/05/2008, 10:21 AM |
|
John - Just started reading your post and you mention about cookie/session. I am not very methodical today.
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/05/2008, 11:39 AM |
|
Hi
When you set up for internationalization in setting you will see the advanced button.. Here you can select how the application transfers language data.
I am using the session method and cookie methods.
CCS take care of the details for you.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
wkempees
Posts: 1679
|
| Posted: 07/05/2008, 12:44 PM |
|
Advanced Button:
There is also a nice feature, capturing the language/country setting as promoted by the browser.
Works!
Use it and then in the browser (IE for example) using
Menu->Extra->Internet Options->Languages add a language you support and set it to default. Close browser reopen and it should work.
@John,
The text part of the website, you state, are in :
a: one table with a language indicator per block of text
b: language dependant tables
If a/ did you add a language field and keep it in sync with the language codes used in the Internationalization?
Do you default back to base language if no translation available?
Just curious..........
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/06/2008, 10:17 AM |
|
Hi Walter
I Implemented the language text/content in separate tables for each language. Additionally the content for each page can be different.
Each language table must have a default set of text values. (There are a total of 8 locations to add text/content). All pages will use that text/content for that particular language unless the page has specific content set for it.
All that content is modifyable in the admin section. I will move a copy of this to another location so you can play with it if you would like me to. My client is using this site for tesing.
Let me know
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
wkempees
Posts: 1679
|
| Posted: 07/06/2008, 12:01 PM |
|
Thanks for the offer John.
No need though, I just wanted to know which of the routes you choose.
Know now, thanks.
Good Job.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
bouvet
Posts: 24
|
| Posted: 07/07/2008, 12:18 AM |
|
Quote jjrjr1:
Hi Walter
I Implemented the language text/content in separate tables for each language. Additionally the content for each page can be different.
Each language table must have a default set of text values. (There are a total of 8 locations to add text/content). All pages will use that text/content for that particular language unless the page has specific content set for it.
All that content is modifyable in the admin section. I will move a copy of this to another location so you can play with it if you would like me to. My client is using this site for tesing.
Let me know
Hi,
OK, but is it for the use of everyday very practicable? I f every day you have to update a product, I think It is more easy to have it in the same table and just ad a field for a new language.
For example:
- price_en
- price_fr
- price_de
But I don´t know how to implent those fields. How does it work when the language change? I tell it because my webshop www.miyabi-japan is "live" and get some orders every day. Of course it was developed with CCS2. I make a new directory, convert the site to CCS4: http://www.miyabi-japan.de/origami-ikebana-sushi/index.php with a test database.
So I will work on the test Website, but after I have to change from old website to the new one. It means, while the shop is changing every day, I have to copy the "live" website to the new one without loosing some orders.
That's why before beginning, I have to check the best solution.
Thanks
Philippe
Thanks
Philippe
_________________
Webdesign Hildesheim Hannover
http://www.actidesign.com |
 |
 |
ReneS
Posts: 225
|
| Posted: 07/07/2008, 6:36 AM |
|
Hi Philippe,
I also use different languages at a product site. What I did was use the same tables and added a language field.
So table product looks like:
Product_ID - Product_Name - Product_Locale
Then use the session from the language (locale) to get the right records in the right language.
Rene
|
 |
 |
bouvet
Posts: 24
|
| Posted: 07/07/2008, 6:42 AM |
|
HI Rene,
So it means if I just have German and French, I will have a table with
Product:ID
Product_DE
Product_FR
?
Philippe
_________________
Webdesign Hildesheim Hannover
http://www.actidesign.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/07/2008, 7:36 AM |
|
Philippe
No.. WHat he is saying is have a field in the table called language or something. In the field place the $locale value into that field to indicate the language thet record is in. Then when you query that table and are say using german select the fields where language == de.
Does that make sense?
I chose not to do that for several reasons. One reason I used separate tables was to ensure MySql would not have to do more intensive queries having to select for language and page. This is the case since after language is selected in my implementation I open a table that only has that language in it.
eg: tableen would be english where tablede would be german and so on.
That was just on reason I did it this way. The main reason was it was easier for me to clone language tables to create new languages as I did not have to manually enter strings for each language into the database and keep track of what I was doing. I was able to initialize a language table using SQL files.
Anyway,
Either way will work.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
bouvet
Posts: 24
|
| Posted: 07/07/2008, 8:23 AM |
|
Hi John,
Ok, it makes sense.
But I feel a bit loose. I try to resume what I did until nowI
already:
- added in Locales & Encodings the French
- make some translations to test for the "fixed" test
- I use {res:key} in the listbox's settings, for example:
DataSource Type: ListOfValues
DataSource: en;{res:English};es;{res:Spanish};de;{res:German};fr;{res:French} etc.
Default Value: $_SESSION["lang"]
But I don't know how to pass the right url. In this case I feel me like a newbie .-(
PS:
Just aside, you write in your http://webtestinglive.com/index.php 2 languages wrong:
Deutsch
Français
is right
_________________
Webdesign Hildesheim Hannover
http://www.actidesign.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/07/2008, 9:42 AM |
|
Hi Philipe
Thanks for the spelling fix. I will fix that immediaitly.
If i think I understand what you are asking is how to get the language to work using the URL.
First in the CCS settings for locales & Encodings. click on advanced.
Here you will see the names of the variables used to control the locale setting. You can change that value but it is probably best to leave it set to locale and lang.
I think some are not checked by default. I chose to select all methods to be active. That allows for the most flexibility.
Now to get the language you want you simply pass the locale parameter in the url using the locale id specified for the particular language you are going to use.
eg: CSS shows you that the locale ID's for these languages are.
French = fr
english = en
german = de
spanish =es
and so on.
To display in french (If you have added that language) you call the page like so.
index.php?locale=fr
This will cause the page to use your french translations and by using session cookies all pages with french translations will be in french.
Now to change using the drop down list try the folowing.
1. create a record with i field to allow add and update.
2. remove all the buttons from that record
3. remove all the text etc just leaving the data input control.
4. rename the control locale
5. make it a list box.
6. change preserver parameters to get & post
7. attach the listbox to a table that will contain the locale id as the bound value and the text value being the language name.
8. make the return page for the form to be what ever page you want. Usually index.php
9. On the client side after change event for the control set the action to submit the form.
Now when someone drops down the list box with languages and selects one the resultant submit will generate.
index.php?locale=fr ... If french is chosen.
Does that help? Let me know if you make it work,
Take Care.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
ReneS
Posts: 225
|
| Posted: 07/07/2008, 12:45 PM |
|
Hi John,
I don't understand your method. Different tables for different languages, do you build all your pages per language? or change table on the fly depending on language choosen? Can you explain some more for me?
Thanks,
Rene
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/07/2008, 5:16 PM |
|
Hi Rene
For the static text on the pages (Which are really templates with 8 or so database fed labels)
I use the localization feature of CCS. Those translations are contained in the individual .txt files that CCS manages for you.
The dynamic content you see at the site comer from user configurable database fields that contain HTML and the approbpriate text for that language page.
For ease of implementation and better MySql performance I chose to have each language use it's own table. The tables all have the same internal structure (a must) and the table names are content+'the local id. eg: contenten would be the english table contentde would be the gereman table.
This way if i add an new translation adding the new table is easy.
So on the fly I change the name of the table I am using by adding the $locale value to the end of the generic table name to create the appropriate table name for the SQL querys.
BTW be sure you declare $locale as global when you are using it.
Does that help?
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/07/2008, 5:24 PM |
|
BTW in order to get $local into your application you will need to make the call
$locale=CCGetSession("locale"); in each page that needs it. Be sure it is outside of a function like in the whitespace at the tope of your php or event file.
Or do like I do most of the time create an include page that sets all the variables you code needs and include that file into all your pages. This is convenient so you only have to make changes in one place to modify system wide variables & constants.
Then whenever you need to know the locale id in any function, just delare it global and you have it to do anything. like use it in a query to just get records that are in that language if you build you databse that way. Or add it to the end of the table name before selecting a table.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |