Search the Community

Showing results for tags 'languages'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Found 17 results

  1. 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.
  2. 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
  3. 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
  4. 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.
  5. 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
  6. 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, AS category_title, cl.id_shop,, 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'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. 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?
  7. Hi Everyone Can I change the type of the title field from PageTitleLanguage to PageTitle per template and not only global? Greetings Nukro
  8. 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
  9. 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''>'> 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!
  10. 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 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!
  11. 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.
  12. 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 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
  13. 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.
  14. 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
  15. 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.
  16. 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 "" for the About page in the default PW template instead of "". Notice that there's a trailing slash missing after "en". What am I doing wrong? Any help would be greatly appreciated.
  17. 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?