buothz Posted July 2, 2012 Posted July 2, 2012 I have a problem with the language system: 1) I have two languages, "Default" and my own "it". What I can do to set "It" as default? 2) For the label, system give text of the label in English only ... how can I do to get the translated one when i click italian flag? Site is: http://www.cosascegli.it try for example an yacht page, if you need I'll post the code now that I'm at work ... Thank u in advance.
Soma Posted July 2, 2012 Posted July 2, 2012 Let me search that for you Default language: Everything about displaying languages in frontend: http://processwire.com/api/multi-language-support/multi-language-fields/
buothz Posted July 2, 2012 Author Posted July 2, 2012 Let me search that for you Default language: http://processwire.c...fault +language http://processwire.c...dule/#entry7501 Everything about displaying languages in frontend: http://processwire.c...anguage-fields/ thank u for the response but i can't solve my problem... If i visit my site with the end of the url http://www.xxx.it/?language=it i see the right language field, but I u use the session i'll see the english. code // LANGUAGES if($input->get->language) { // user clicked on a link to set the language $name = $sanitizer->pageName($input->get->language); $language = $languages->get($name); if($language) $session->language = $language->name; } if($session->language) { // language is defined in user's session $user->language = $languages->get($session->language); } $field = $fields->get('anno'); $label = $field->get("label$language"); echo "<li><strong>$label:</strong> $s->anno</li>"; $homepage = $pages->get("/"); $children = $homepage->children; $children->prepend($homepage); foreach($children as $child) { $class = $child === $page->rootParent ? " class='on'" : ''; echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>"; } //fine foreach iniziale if ($session->language == 'it') { echo '<li><a href="./?language=en"><img src="/img/gb.png" alt="English Language"></a></li>'; } else { echo '<li><a href="./?language=it"><img src="/img/it.png" alt="Italian Language"></a></li>'; } try http://www.cosascegl...acht/azimut-75/ (default language it) http://www.cosascegl...75/?language=it $session don't record the selected choice? How what i can do? Problem is ONLY for NAV and LABEL thank u...
buothz Posted July 2, 2012 Author Posted July 2, 2012 Looks ok to me. I can switch language just fine. no :'( because if I visit http://www.cosascegl...acht/azimut-75/ eng Hull Construction: Fiberglass hull, teak deck and cockpit. Flybridge with teak walkways now i click the italian's flag http://www.cosascegl...75/?language=it Materiale Scafo: Vetroresina, ponte e pozzetto in teak. Camminamenti del flybridge in teak now i refresh (i loose ?language=it but session lang = it) http://www.cosascegl...acht/azimut-75/ Hull Construction: Vetroresina, ponte e pozzetto in teak. Camminamenti del flybridge in teak Hull Construction is not italian label! Italian label is "Materiale Scafo"... where is the problem? Thank u...
buothz Posted July 2, 2012 Author Posted July 2, 2012 FOUND THE PROBLEM! if ($session->language == 'it') { echo '<li><a href="./?language=en"><img src="/img/gb.png" alt="English Language"></a></li>'; $language = $languages->get("it"); } else { echo '<li><a href="./?language=it"><img src="/img/it.png" alt="Italian Language"></a></li>'; } system loose "$language = $languages->get("it");" i've put it on the head.inc for all the pages... but the problem of the only eng nav? Some one can help me?
buothz Posted July 2, 2012 Author Posted July 2, 2012 Not sure, have you debugging turned on? no, how i can activate it on pw?
SiNNuT Posted July 2, 2012 Posted July 2, 2012 no, how i can activate it on pw? Go to site, config.php around line 90, set to true: /** * debug: debug mode causes additional info to appear for use during dev and debugging * * Under no circumstance should you leave this ON with a live site. * */ $config->debug = false; 1
arjen Posted July 2, 2012 Posted July 2, 2012 In the /site/config.php file around line 92 you can find $config->debug = false;. 1
Soma Posted July 2, 2012 Posted July 2, 2012 Ah just posted same time. You should then do this: The default would be "". Field labels use "anno1299" where 1299 is the id of the language. The default would be just "anno"; $language = ''; if($input->get->language) { // user clicked on a link to set the language $name = $sanitizer->pageName($input->get->language); $language = $languages->get($name); if($language) $session->language = $language->name; } if($session->language) { // language is defined in user's session $user->language = $languages->get($session->language); $language = $languages->get($session->language); } Always remember to try to debug. You can then see errors and warnings you don't see without. Turn it on in the site/config.php
buothz Posted July 2, 2012 Author Posted July 2, 2012 Go to site, config.php around line 90, set to true: /** * debug: debug mode causes additional info to appear for use during dev and debugging * * Under no circumstance should you leave this ON with a live site. * */ $config->debug = false; only alert "Strict Standards: Declaration of Pdfcomposer::___execute() should be compatible with that of Process::___execute() in /home/mhd-01/www.cosascegli.it/htdocs/site/modules/Pdfcomposer.module on line 3 because i don't use it... i've always problem of the nav language...
Soma Posted July 2, 2012 Posted July 2, 2012 When I tested your code 1:1, and turned on debug. It showed me the warning that the $language var doesn't exist. 1
buothz Posted July 2, 2012 Author Posted July 2, 2012 When I tested your code 1:1, and turned on debug. It showed me the warning that the $language var doesn't exist. thank u but where did u see it? browser? chrome console?
Soma Posted July 2, 2012 Posted July 2, 2012 As a php notice where the field label text output would be. Maybe your server has notices disabled. 1
buothz Posted July 2, 2012 Author Posted July 2, 2012 As a php notice where the field label text output would be. Maybe your server has notices disabled. yes, is a low cost server... thank u for help but also with your code don't translate NAV
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now