Search the Community
Showing results for tags 'multi-language'.
-
Hi, I am currently using Processwire for a client project and am quite pleased with the ease of use and versatility. Unfortunately I came across a problem I am not able to solve: I have a multi-lang site where the home page path are as follows: www.example.com/ -> german (default) www.example.com/en/ -> english ... I build a language switcher that first gets the current page and then displays links for the page in all the different languages. <?php namespace ProcessWire; ?> <ul class="lang-switcher"> <?php $real_page = $pages->get($_SERVER['REQUEST_URI']); foreach ($languages as $language) { if (!$real_page->viewable($language)) { continue; } // echo <li>...</li> } ?> </ul> (I need to search for the real page because the language switcher is loaded inside of the menu which is an additional page/template which get loaded via echo $pages->get("title='Main menu'")->render(); . When using $page->localURL() I get the /main-menu page.) this works without problems for urls: www.example.com/ www.example.com/test www.example.com/en/test ... But not for: www.example.com/en/ I diagnosed that $pages->get("/en/") returns a NullPage instead of the english home page. Do you have any idea why this is and how to fix it. Thanks alot.
- 2 replies
-
- multi-language
- get
-
(and 1 more)
Tagged with:
-
Hello, how would I write a condition to output markup only to pages that have a template with multi-language support? I'm not finding any references to this particular topic.
-
I am struggling with an issue where my language switcher with flags sometimes doesn't show the flag. It works in the default language (german): but when the site is in english the german flag is not shown (path to image is not found): I don't really understand why it works if the site is shown in german but not in english.. Code for language switcher: // remember what language is set to $savedLanguage = $user->language; $languageImage = $savedLanguage->image->url; echo "<li><a href='#' class='dropdown-toggle' data-toggle='dropdown'><img src='$languageImage' alt='$savedLanguage->title'> <span uk-icon='icon: chevron-down'></span></a>"; echo "<div class='uk-navbar-dropdown'>"; echo " <ul class='uk-nav uk-navbar-dropdown-nav'>"; foreach($languages as $language) { //go through all languages // if user is already viewing the page in this language, skip it if($language->id == $savedLanguage->id) continue; // if this page isn't viewable (active) for the language, display root page $viewable = true; if(!$page->viewable($language)) $viewable = false; // set the user's language, so that the $page->url and any other // fields we access from it will be reflective of the $language $user->language = $language; // output a link to this page in the other language $path = $language->image->url; $pagePath = $page->url; if(!$viewable) $pagePath = $pages->get(1)->url; echo "<li><a class='uk-text-medium' href='$pagePath' alt='$language->title'><img src='$path' alt='$language->title flag'> $language->title</a></li>"; } echo " </ul>"; echo "</div>"; echo "</li>"; // restore the original language setting $user->language = $savedLanguage; Language template: image field is configured as automatic (array if multiple) in language page (both german and english) only one image is saved html output of language switcher dropwon (image couldn't be loaded): html output when image can be displayed:
-
Hi again, while just being occupied with Processwire's multi-language support, this question came to my mind: Is there already some mechanism established to deliver translations with a module? This seems like it can't work out of the box, because everyones language subtree will be different. But since it also would be impossible to pack translations for all modules in the official repo into the language packs, is there some mechanism for this? Or maybe at least some convention how to deliver translations then? The way I understand how it works now, everyone using a module is required to translate it for him-/herself, which is a bit tedious. With kind regards, Marc
- 19 replies
-
- multi-language
- i18n
-
(and 1 more)
Tagged with:
-
[solution] ========================================================= Using devilbox to develop locally. Installing the Beginner, Intermediate and Blank sites from the setup menu works perfect. The sites load, all pages load, can access the admin panel, all fine. However when installing the Multi-language site, the one I can pick during the setup procedure, things do not work. The English Home page works. The English About page, https://wiremultilang.loc/en/about/ tells me Same for the English Sitemap, https://wiremultilang.loc/en/site-map/ . I have allowed all cookies and can see them when checking in the browser cookies and site data, using Firefox 65.0.1 64-bit on Ubuntu 18.04.2 LTS. Clicking "German" on the Home page, https://wiremultilang.loc/de/ , shows me the German version of the 404 page. Clicking "Finish" on the Home page, https://wiremultilang.loc/fi/ , shows me the Finish version of the 404 page. What could be the issue here? Thank you for your guidance or any help you could supply.
-
Hey everyone, I'm pretty experienced with pagination and haven't seen this before. I have my pages pulled using $pages->find, which is working fine however using renderPager() generates pagination where the links do not work. Here are some details. All templates needing pagination have pagination enabled in the admin. URL Segments are not enabled. Clicking on the "Next" or numbered links merely reloads the current page. The link href values are properly being output with the urls being /page2, /page3, /page4, etc. Manually entering the paginated urls has the same effect of reloading the current page with no new content. Pages are being returned from the ->find function properly and with the proper limit. A few other details: ProcessWire v3.0.98 Multi-language is enabled, 2 languages implemented. Pagination does not work on either language Have very few modules installed (few enough to list), none of which I could see interfering: ProFields, ProDrafts, ListerPro, DB Backups, Cronjob DB Backup, Upgrades, Upgrade Checker, Force Password Change, Markup Sitemap XML I'm stumped. For the sake of being overly-thorough, here's the code: <?php $articleTemplates = [ 'template_news_article', 'template_news_video', 'template_news_press_release' ]; $searchParams = [ 'template=' . implode('|', $articleTemplates), 'sort=-published', 'limit=' . $pages->get('template=template_news')->list_count ]; $articles = $pages->find(implode(',', $searchParams)); echo $articles->renderPager(); ?>
-
Disable A Language Whilst Translators Work On It
swampmusic posted a topic in Multi-Language Support
Trying to figure out work flow for translators on a new website and have hit a brick wall. Site was launched in Spanish, now the translators want to add in other languages. I presumed that when you tick the "active" language checkbox on settings for the home page, then the new language would not appear on the public facing website, but translators would be able to work with the pages in the admin and view their work. Finally, once all translation had been completed, we could activate the language from the home page. I have searched thru the forums and found older articles from 2015 here. https://processwire.com/talk/topic/11100-disable-a-language-on-a-multilanguage-site/ https://processwire.com/talk/topic/10467-allow-translators-to-work-on-hidden-language/ This seems a really messy hack, or did i miss something ? Does anyone know if there has been an update within Processwire since 2015 to make this better/easier, or other articles explaining how to achieve it ? We were looking for a solution that the client can use from within Admin. Not via .htaccess or similar that would require tech skills. Many thanks for reading ?- 4 replies
-
- tranlators
- deactivate
-
(and 2 more)
Tagged with:
-
Update: The render behavior of the profile is correct. My mistake was to use TextLanguage in the fields when i just need the user to see labels according of his language (that can be achieved with the text field type). Hi, I'm using LoginRegister to allow users to edit their users profiles in the front-end, and some of the user fields are type TextLanguage (to allow multiple languages). The problem is that when I render the Profile Edit, the inputfields shows in all the installed languages. That doesn't happen when I render the login or register forms. How can i prevent that the TextLanguage inputfields render in both languages? My code <?php $user->language = $languages->get("default"); $input->get->profile = 1; $profileForm = $modules->get('LoginRegister')->set('renderStyles', false)->execute(); ?> and later... <?= $profileForm ?> The output for an multilanguage inputfield: <div class="InputfieldContent "> <div class="LanguageSupport" id="langTab_Inputfield_profile_firstname" data-language="1029"> <label for="Inputfield_profile_firstname" class="LanguageSupportLabel detail">English</label> <input id="Inputfield_profile_firstname" class="InputfieldMaxWidth" name="profile_firstname" type="text" maxlength="2048"> </div> <div class="LanguageSupport" id="langTab_Inputfield_profile_firstname__1031" data-language="1031"> <label for="Inputfield_profile_firstname__1031" class="LanguageSupportLabel detail">Spanish</label> <input id="Inputfield_profile_firstname__1031" class="InputfieldMaxWidth" name="profile_firstname__1031" type="text" maxlength="2048"> </div> </div>
-
Hi, I have a website with multi-languages support and a frontend form for course registration. If a user choose English which is not the default language, the page title only save to the English tab of the page title. How can I save the page title to the default language through API?? Gideon
-
Support for Multi-Language field in Module: Import Pages from CSV file Is there a support for multi language field import option from csv? If yes, what will be the structure for csv file data. Case scenario: I have title field which is multi-language field(English & Arabic). business|بزنيس club|كلوب deluxe|ديلوكس duplex|دوبلكس
- 2 replies
-
- multi-language
- textlang field
-
(and 1 more)
Tagged with:
-
Hi All, Arabic content changes not available in page getChanges method While editing the page from admin panel in the multi-language field, added a hook to save the changes made to the page. $this->pages->addHookAfter('saveReady', $this, 'hookUpdateLog'); public function hookUpdateLog(HookEvent $event) { $page = $event->arguments[0]; if(in_array($page->template->name, $this->templateList)) { $this->logFieldChanges($page); } } public function logFieldChanges($page) { $changes = $page->getChanges(); //This changes does not contain the field of arabic changes. } Please let me know, If I am approaching in a right way.
-
- getchanges
- page
-
(and 3 more)
Tagged with:
-
I need a way when i am iterating the fields in some page, to check if the field is a multi lang value or not. $data = []; foreach ($page->template->fieldgroup as $field) { if (field support multi value) { continue; } $data[] = $field; } return $data; How can i check that? Thank you
-
Hi All, I have a processwire setup for multi language which is english and arabic. I have a template called hotel which has title field act as hotel name for both EN & AR language. Since a week ago I was getting the error in Since we have key in pages table which states as below So the field name1056 should store the Arabic value of the title field. But its not storing the arabic value, since we have CHARACTER SET ascii for the field `name1056` as below Can anyone explain me * On what basis character set is defined? * Is there any specific reason for setting the ASCII character set? Thanks in advance for the help.
-
- name
- multi-language
-
(and 3 more)
Tagged with:
-
I'm building a multi-language site and wanted to know the best way to deal with images. Because on a multi-language site, they may want a different image for a different language, especially if the image has text in it. What is the best way to deal with this? Should I make another image field for spanish and if they don't put anything there, just use the english image and if there is a spanish image, then use that image for spanish?
- 3 replies
-
- language
- multi-language
-
(and 1 more)
Tagged with:
-
Hey all, I am trying to prevent the display of descriptions for images in default language while user browses site with alternative language. In a gallery my goal would be to display the same images, and hide the description that I am using as captions. As a hack I could decide based on tags, but this causes extra workload for the editors of the site, and seems less robust than a built in query. Any hints are highly appreciated.
- 5 replies
-
- multi-language
- image
-
(and 2 more)
Tagged with:
-
I want to create a website with one version in german and one in english. There is no point to translate isolated strings, I just want to translate the whole content of each page. I have looked through the documentation, but I am a little bit confused about all the different translation features. so what would be the best approach for my purpose?
-
Hi, Just added some 'Language-alternate fields' to a page fieldtype and I'm seeing the language displayed twice in admin under the field name... Is this a bug? I'm running 2.7.2 and the fields are set to 'Multiple pages (PageArray)'.
-
Hi, I have a menu at the top of my homepage (~15 links). I'd like to translate it. Example : <a href="#" class="menu-item">collection</a> <a href="#" class="menu-item">products</a> <a href="#" class="menu-item">support</a> [...] What's your prefered method to translate that ? I already have my configuration ready for different languages according to the url : /en -> display english, /fr -> french, ... Do you add one more field per link on the homepage or do you add a single "menu" field ? With one field / link you add content by filling your textlanguage with : "collection" for example and then display it on the homepage through $page->link1 With one field / menu you add the whole html stuff I guess, with the CKEditor for example on a textarealanguage field : <a href="#" class="menu-item">collection</a> <a href="#" class="menu-item">products</a> <a href="#" class="menu-item">support</a> and then display it on the homepage the same way than with one field / link. Which method would you use ? Let's vote Thanks
-
hi guys, My homepage is built on a home.php file which calls/(includes) a _home_inc.php file. In the home.php file, if the user is not logged (I don't know anything about him), I take the browser's default language, let's say english ('en'). How can I load the english version of my website ? My default language is french. I'd like to say to Processwire to go to http://www.myurl.com/en and not http://www.myurl.com/ (which is french based). (the english version exists, I've setup the multi-language options in the admin and I can go to http://www.myurl.com/en and see the english version). Thanks
-
Hi guys, I've been playing with PW for a few days now, having fun so far. I'm testing the multi-language capability features. I've read https://processwire.com/api/multi-language-support/code-i18n/ and https://processwire.com/api/multi-language-support/multi-language-urls/. I succeeded to display a page in my default language, then by adding "/en", display the "en" version and so on. So I understand how to manage the description part of the website which won't be modify very often, great. But I don't get it for text such as : sprintf(__('Your city is %1$s, and your zip code is %2$s.'), $city, $zipcode); I mean I get it about the sprintf stuff, I used to have such a system on my old website, with countries include files en.inc, it.inc. What I don't understand is how PW will load the english text, the italian text ? Do I have to build myself the matching countries files according to the language set on the page ? Something like if 'en' then include ('en.inc'); ? Thanks
-
Here's my first serious attempt at a PW module. I have the need that pages shouldn't be "published" in all languages at once, so I've put together a PageLangPublish module. It adds both buttons for publishing/unpublishing of each language to the page tree and status icons (from image fields added to each page in admin/languages) next to the page title in the tree. You can find the module at github under https://github.com/BitPoet/PageLangPublish I've probably done a lot of things quite awkwardly (even incorrectly) there, so I'd be grateful for any pointers and ideas. The module also adds a hookable isLanguageViewable method to the Page class. Usage example: $topnav = array(); foreach($homepage->children as $item) { if( $item->isLanguageViewable($user->language) ) { $topnav[] = "<a class='topnav' href='{$item->url}'>{$item->title}</a>"; } } echo implode(" | ", $topnav); Here's a screenshot:
- 11 replies
-
- 5
-
- language
- multi-language
-
(and 1 more)
Tagged with:
-
Hi all, We have this huge website (over 7000 pages and a few dozen templates). We've used TextLanguage and TextAreaLanguage fields for all textual fields, and all image and file fields have their own description input boxes for different languages too. Now we'd need to export all pages and send them to our translator so they can translate all site contents with their specialized programs, and a way to import the translations back to our site alongside the content in original language. Has anyone done anything similar to this? How did you solve it? Maybe there already is a solid way to do this, or an idea we've not thought of yet. Thanks for any thoughts!
-
Hi folks, I have a site set up for a festival of events over the next 5 years. Each year (page with children) in the site is in a different location and we want to use the Multi-Language Support to toggle between the native language of the location and English. I have set up the Multi-Language Support stuff fine but the only issue is that it's applying it to the whole site whereas I only need to use specific languages in specific sections. For example, for a Portuguese section a URL might be http://www.domain.com/pt/designing-respect/home/ whereas I need something like http://www.domain.com/designing-respect/pt/home/ instead and on another section for a Chinese section a URL might be http://www.domain.com/designing-politics/cn/home/ so the language support is being applied to the section rather than all of them to the same whole site. This is also the case with using multi-language title fields; it's adding all the options to all the pages whereas I need them only on the relevant sections (so within the Chinese section you'd get the English title field and the Chinese title field; not all the language title fields). Any ideas?
-
Hello, when using the default multi-language module, you can set different titles for each language on a page. The logic is: the default language is the source and every non-default language inherits from it if empty. For a use case I have, I need to update all title's on a page for every language via the API. I tried a little with this code but it doesn't work (with no errors): $globalTitle = 'Test'; foreach ($languages as $language) { $page->set('title'.$language->id, $globalTitle); }
-
Ryan, Is this list of translatable files still up-to-date? By the way, /wire/modules/LanguageSupport/ProcessLanguageTranslator.module doesn't seem to have translatable phrases. //Jasper