Search the Community
Showing results for tags 'languages'.
-
Hey community, first of all: I love this CMS! But unfortunately my Code Internationalization (i18n) doesn´t work within included php files: I´m using the module Pro Fields Page Table, the regular Languages Support Module and no template caching. The website has 2 Languages (DE as default, EN as second language) Problem: Using <?php echo(__('Test')); ?> within /site/templates/home.php works without any problems and gets translated correctly However using <?php echo($this->_('Headline'));?> within /site/templates/components/component.php does not work. Note: using <?php echo(__('Headline'));?> in .../component.php throws an error and therefore cannot be used. Example: /site/templates/ce-includer.php (Template with the dynamic text-field 'filepath'): include('components/'.$page->filepath); this correclty includes the file "/site/templates/components/home-content.php" Code in home-content.php: <h1><?php echo($this->_('Headline'));?></h1> Output for both pages (DE and EN version - the string was translated to "Headline DE" in german and "Headline EN" in english): <h1>Headline</h1> Does anyone know how to use Code Internationalization in such a szenario? All the best and keep up the great work! Daniel
-
Hello, how would I do a multi-language website search with just a selector? I have many multi-lang fields and I want to do a search through all of them at once and through all of their language values. Is there a "selector way" of doing this? Maybe something like `title|title:de|title:it`? It seems I have seen this somewhere a long time ago but can't find in any documentation or forum search... Or the only way of doing it is by running separate searches for each language with output formatting off and then consolidating it all in one single results array? Because I still want to give users a result, even if it is in another language than current $user. Visitors mostly will be searching for specific terms that are very similar in all languages, but might be not used in one language version of a single page, for example. Or the user might not have switched language tohis prefered and did the search first, etc.. (many use cases in my situation) Example: $pages->find('title~='.$q) - maybe different operator is needed? /en/search/?q=visit = 1 results /it/search/?q=visit = 0 results Thanks for any advice!
-
Hello One of my customers needs to have his site translated by a publisher. He asks me if it is possible to create a role that could only edit the German version of the pages, without permission on the English version. I haven't found any permission related to this need, but maybe it's possible from a hook? Thank you for your help
-
Wouldn’t it be cool to have whole repeater items (or even repeater matrix items) language-specific. Some of my clients do have pages that are 90% identical in German and English, but there are some sections that should not appear in one or another language. I attached a concept screenshot. Would something like this be possible with some simple backend hooks and "hidden checkbox fields"? Or is it way more complicated?
-
Hi everyone ? Is there a way to order the language tabs in the backend? Currently, they seem to be ordered based on the created date (or id?) … ( time passes … ⏰ ?♂️) Just answered my own question. One can reorder the languages in the page tree under admin » languages or directly in the DB » pages » template_id=54 » sord field. Anyone knows if there are side effects when moving the default language from sort 0 to somewhere higher?
-
Hello, This is not directly about language module but I think I can get information from you. Can I add a vendor module to have all languages written automatically into name? I used this vendor module which is good with any language (hebrew, arabic...). How could I add it, so admin interface can use it ? Thank you
-
Hi all, A very odd issue this one! I'm working on a site with 5 languages - English (default), French, German, Spanish and Polish. I have a set of pages set up as a country list (templae='country') which contain various country info like two-letter country code etc and where the page title is the Country name. This is so that I can use the country list in various parts of the site. When the site is showing in English, Spanish and Polish I can display the country list without an issue. However, when the page is displaying in French or German the country pages seem not to exist. So, this code... $countries = $pages->find("template=country"); foreach ($countries as $country) { if ($country) { echo $country->title . "<br />"; } } ...displays the country list just fine in English, Spanish and Polish but displays nothing in French and German. Just for extra info, the Title field is set up as PageTitleLanguage and all languages are setup the same. Any ideas? TIA.
-
Hello, recently i came across this issue. Basically, I am using TemplateEngineBlade module which allows me to use Blade templating engine in my templates. I needed to translate strings like '__(<your string>)', but since the module compiles the templates into its own directory (as highlighted in screenshots), the language translator find the function call in 2 files: Template where the code is written Modules 'compiled'/cache directory where the templates are in their compiled state Now, I actually have to translate the string in its compiled directory else it doesn't work at all. But since that filename changes often it is not usable at all. I tryed prepending all templates with a file (for example _init.php) and getting all translatable strings there which works but not for the use cases where i need to get same string translated in multiple languages in a single page - I would have to create separate variables. Does anyone have any idea which would help me work around my issue? Thanks
- 4 replies
-
- template engine
- string translation
-
(and 1 more)
Tagged with:
-
I have a dropdown menu which displays a list of languages installed on my site. Id like to add some country flags to the menu list items and the simplest way would be to add an image field to the languages template which is installed in the settings branch. However it seems like this system template won't accept new fields but isn't locked. Is there a way to extend this template to accept new fields? P
-
Hi all, I have experienced some weird problems when using the Float field combined with the translation of setlocale() arguments. It seems that with specific setlocale() (in my case setlocale('it_IT')) leads to transform the decimal separator from "."to "," (for example "2.566" is transformed to "2,566") so all queries contains a "," and mysql stores only the integer part (without any errors). Good query: INSERT INTO `field_testfloat` (pages_id, data) VALUES('1024', '24.534') ON DUPLICATE KEY UPDATE data=VALUES(data) Bad query: INSERT INTO `field_testfloat` (pages_id, data) VALUES('1024', '24,534') ON DUPLICATE KEY UPDATE data=VALUES(data) The naive solution is to leave blank setlocale(), but i wonder if it is possibile to correct this behaviour.
- 11 replies
-
This is probably really simple but I am unable to get the two letter code for the default language. $languages->default gives me a numeric code (the page ID for that language). $user->language give me the numeric code again $user->languages->name gives me "default" if it is the default language, else the two-letter code for the language. But I don't see the two letter code for the language in $config (I might be missing it) nor anywhere else. I've hardcoded around this now, so the question is largely academic, but I'd prefer not to hardcode it. Being able to get the two character code, and not 'default' for the default language would be equally helpful.
-
Hi Guys I have a problem with the Code Internationalization (Site Translation Files) in Processwire. I am using the method Ryan is describing in this topic and also the normal way of translating files. The weird behaviors are that translations are just gone after a change in the main translation file called _strings (uses Ryan method). Or some other weird behavior was, that the english translation of the _strings file were somehow ported inside the german _strings file. I really don't know what could cause this. Have ever witnessed something like that? I have made some thoughts about this whole Code Internalization thing in ProcessWire and I am thinking to go another way (don't get me wrong, it's perfect for small to mid projects but in my opinion it is just a overkill for big projects), because at the beginning the strings we needed to translate were splitted up in many files which produced many site translation files to translate per language. It was just to much and confusing for the customer (and also for me), so that we needed another approach. So I tried Ryans method with one central translation files. The problem with this one is that it also gets confusing since it is a very big amount of strings to translate and also the problems described above. So for know I will try to make approach to store the strings in Pages. All translations of a string would be stored side by side. I know that this is probably more complex behind the scenes but it is far easier for the customer (especially with ListerPro). And I also like the idea of having the translations inside the DB instead in form of Files. What are your thoughts about it? Have ever done something like that? Greetings Orkun
-
By Processwire default the Installation is always in English. As Ryan said earlier: To install a new language pack withNicos Module is easy buthow to get it running as Default. And where actually do you get the default ENGLISH files as if you exchange the default files English will be gine. It is even one when you change the name and title to something else than default. IMHO there need to be a way to switch to a default language with / much easier. All the tutorials - which are great - unfortunately keep the default Lingua Franca = English. i.e. can somebody perhaps point to a tutorial how to setup German, or any other language than English as Default Language and how to get as second Language English running without having to disable the default Language field or moving files from German to be default? This is absolutly not developer Friendly as it costs a lot of time and bears the danger that things get lost or modified at the wrong place. IMHO Nicos approach with uploading the translations in a one tep process is a good way but as said the English translation is missing! Also it does not seem to be possible to upload a language file again i.e. for updating as translations usually change with every version. It would be great if this Tutorial here http://processwire.com/api/multi-language-support/ would point out into the right direction if you are not inteded to use English as default language but still need English as another Language. Thanks
-
Hey all, For my website I had to make a connection with an external DB. In that DB there are categories of products in different languages, and I want to import these categories in the languages that are available in processwire, I can do that with a very long code but I want to make it shorter. So I wrote a function to get the categories, but the different languages of the category names not, only if I insert the ISO-code hard-code. So here is my code: protected function get_category() { $languages = wire("languages"); try { $prestashp = $this->get_dbPrestashop(); foreach($languages as $language) { $iso_code= $language->name ; $categories = $prestashp->query( "SELECT l.id_lang, l.iso_code, cl.description, cl.name AS category_title, cl.id_shop, c.active, c.id_category, c.id_parent, c.position, cl.link_rewrite FROM ps_category c INNER JOIN ps_category_lang cl ON c.id_category=cl.id_category LEFT JOIN ps_lang l ON cl.id_lang=l.id_lang WHERE c.active='1' AND cl.id_shop='1' AND c.id_parent = '2' ORDER BY c.position "); } }catch(Exception $e) { $this->message('Failed to show categories. Try again later.'); return false; } return $categories; } So in the DB there is Deutsch, Dutch, English(default), Spanish, Italian. And when I edit the template the different languages of the category names need to be imported in the right tab of the field. https://gyazo.com/52a3549a8adaed2d5f44cac6dfb6d9d3 As you can see, there are language tabs above the field, and the names of the category in that language need to be insterted there. Anyone have an idea how I can fix this?
-
Hi Guys I'am trying to output the localized month names in french, german and italian for my newsletter. At the moment my default language is french. This code outputs everytime time the french month name: foreach ($languages->find("name!=en") as $language) { $user->language = $languages->get($language->name); switch ($language->name) { case 'default': $date = strftime("%d. %B %G", $page->date). "-FR/DEFAULT"; break; case 'de': $date = strftime("%d. %B %G", $page->date). "-DE"; break; case 'it': $date = strftime("%d. %B %G", $page->date). "-IT"; break; } echo $date."<br />"; } output looks like this: 31. mars 2016-FR/DEFAULT 31. mars 2016-DE 31. mars 2016-IT I also have set the right locale inside every language translation file. How can I fix this, that it looks like this: 31. mars 2016-FR/DEFAULT 31. März 2016-DE 31. marzo 2016-IT
-
Hello everyone, in the first line I need to say, that I am NO developer or programmer. I am just a german language translator and interpreter who is seeking for help. The freelancer who created a website ( I have tried to change the code in this line: <a href="'.$page->siteurl.'">. I managed to get the link work but just for one language. If I changed the language version the link showed me always the same version. Can someone tell me if someone like me without any knowledge in this matter can handle it to get this thing done? fix a problem with 'SEO boxes' visible here http://berlineo.com/pl/oferta/tlumaczenia-pisemne/''>http://berlineo.com/pl/oferta/tlumaczenia-pisemne/'>http://berlineo.com/pl/oferta/tlumaczenia-pisemne/ at the bottom (looks like radio button); the code was copied from the home page, where these SEO buttons are OK; I need this section to be usable wherever I wish to paste it; Can sombody tell me the reason for this and help me fix it? Thank you in advance!
-
Hi, I've been creating a site that has multiple languages but crucially does not use Processwire's awesome inbuilt multi-language support (some background here). My site tree looks something like this... Home - Articles (English) -- Article title -- Article title -- Article title - French -- Articles --- Article title --- Article title --- Article title - German -- Articles --- Article title --- Article title --- Article title etc Now the client want the page slugs to be the same on all languages, so for example an article will have a url like domain.com/articles/name-of-article/ domain.com/fr/articles/name-of-article/ domain.com/de/articles/name-of-article/ etc. The problem... To make life easier for the translators they want the translated articles to auto-generate that page slug. Processwire can't really do that when a translator adds it as it doesn't know which article it is a translation of. Once on the edit screen I have a PageFieldType so the translator has to explicitly select the English version that their post is a translation of. This makes it easy for me in the templates to share content that doesn't need translation such as main image etc. So... I either need a way to extract the slug from the English version and use it for translated versions auotmatically (once the PageFieldType connection is made) overiding any slug that the translators have used. or even better.... I thought a module that automatically creates an unpublished page under /articles/ in all 12 languages with the same page slug when a new English article is added under /articles/. Would this be possible with Processwire? I'm not sure where to start (I'm very much dipping my toes in modules but have used Processwire extensively for projects previously). Any help/guidance would be massively appreciated, thanks!
-
I'm working on a site that has 12x languages (and 12x translators) and following on from working out how to create roles that only allow editing of one language, the client have requested that these translators be able to edit at the same time. What are the possibilities here with Processwire? I'm thinking (potentially) 12x users editing the same page is a nightmare of overwritten changes etc. Has anyone had any similar requests from clients for multiple users editing at the same time? I think the solution may need to be 12x languages manually added so the page tree is: Home - English -- Articles --- Article title --- Article title - Spanish -- Articles --- Article title --- Article title - French -- Articles --- Article title --- Article title etc However I'd prefer not to do this as it's *a lot* of duplication and also not using the inbuilt language options of Processwire. Any help/thoughts on the best way to tackle this much appreciated.
- 6 replies
-
- roles
- multiple editors
-
(and 1 more)
Tagged with:
-
The great latest localization enhancements for PW 2.5 raise some problems due to the multi-language site profile. I observed that when the site translation files are included in the core translation files language pack, they are unnecessarily uploaded to the Core Translation Files and I can delete them, but cannot move them to their appropriate location. As the translation files are distributed in one package, many of them downloaded directly from GitHub, it would be a smarter solution if the language pack uploader dispatched the site language files to the Site Translation Files section. It turned out in Ryan's answer on my GitHub issue report, that we cannot use these site translation files for monolingual sites, so it would be recommended if the language pack uploader detected the multilingual status and when it failed (due to monolingual site), it displayed a warning and did not upload the site language files.
-
- improvements
- languages
- (and 4 more)
-
Hello everyone, I was just asking myself, why there are no hooks for the methods in the LanguagesFieldValue class. I was going to improve the multilanguage support with a modul that introduces fallback languages. That would mean that for each language you can declare none or many fallback languages and if there is no translation of the value in the current language, it goes through all fallback languages and looks whether there's a corresponding value defined. It would be easy to implement this by hooking to the toString() method, but it is not hookable. Do you see another simple way to implement what I need or can we get hooks in the class in core? With kind regards, Marc
-
I've been trying to set up a bilingual site with Spanish as the default language, and English as the second choice. I've chosen the third option --"Example 3: Display a different language based on URL pre-segment"-- on the page: http://processwire.c...anguage-fields/ I've placed the following code in the "language-gateway.php" as indicated (I think) in the tutorial: <? $user->language = $languages->get($page->name); $path = '/'; foreach($input->urlSegments as $segment) { $path .= $segment . '/'; } $mypage = $pages->get($path); if(!$mypage->id || !$mypage->viewable()) throw new Wire404Exception(); // echo $mypage->render(); // the line above is commented out to avoid a "rendering" the page twice $out = $mypage->render(); $regex = '{(<a [^>]*href=["\']/)(["\']'; $topnav = $page->parent->children(); foreach($topnav as $p) $regex .= "|" . $p->name; $regex .= ")}"; $out = preg_replace($regex, '$1' . $page->name . '$2', $out); echo $out; ?> Everything works great, except that the regular expression does not seem to work. My links in the English version (which again is NOT the default option in my setup) are outputted as "domain.com/enabout/" for the About page in the default PW template instead of "domain.com/en/about/". Notice that there's a trailing slash missing after "en". What am I doing wrong? Any help would be greatly appreciated.
-
I'm opening this topic so people can discuss translations. I was thinking of opening one only for Portuguese, but some doubts apply in general. Maybe I will still open a new thread specifically for Portuguese down the road when it makes sense. ...... Now, the questions that brought me here: What are you guys doing with computer terms like "cache", "template", "email", "URL" and "link" to name only few, or more PW specific terms like "page tree" or "fieldgroup"? Are you translating them or leaving them in English between quotation marks? Also, should we discuss general Best Practices for all languages or just let the people responsible for each language to decide?