Jump to content

Jozsef

Members
  • Posts

    278
  • Joined

  • Last visited

Everything posted by Jozsef

  1. Thank you for the detailed answer, it's very educational. I was aware of some of the considerations but I didn't think about cache, for example. I understand that the DeepL service take time, especially with a 5000 word document. ? I did go through the readme multiple times before. Great module and thanks again for the brilliant support here.
  2. Thank you @FireWire, after some wrestling I got it working. My issue was that I assumed that the returned translation is a simple string while it's not. For anyone interested, this is the working function I put together. It returns the translated field value or translates a multi-language field (headline in this case) on demand, if it's not yet translated. You can call it simply <?= translate($page,'headline'); ?>. It's saved and displayed right away. This way it can also be used in a foreach loop where you want to display a field from a different page. Please let me know if something could be improved or simplified, I'm not a PHP guru. Do you think it will have a toll on performance for already translated fields? /* Translate a field if it's not available in current language * * @param object $page * @param string $field * @return string * */ function translate($page,$field) { // If field is empty there's nothing to be translated if (!$page->$field) return; // Get current language setting $lang = wire('user')->language; $page->of(false); // Check if the field is already translated $local_value = $page->$field->getLanguageValue($lang); if (!$local_value) { $fluency = wire('modules')->get('Fluency'); // If not, translate it from default language $translate = $fluency->translate('en', $page->$field, $lang->language_code); // Get the translated string from the response object $translated = $translate->data->translations[0]->text; if ($translated) { // Save the translated value back to the field $page->$field = $translated; $page->save($field); // Set return value $local_value = $translated; } else { // If translation fails and returns empty string // We use the default language $local_value = $page->$field; } } $page->of; return $local_value; } There's still the issue of updated content in the original language but I'm not sure how to deal with that.
  3. I tried to follow examples from earlier in this topic to achieve the following in my template files. The goal would be to save characters for the client and only translate content that is required. Example: - Check if $page->headline is available in the user's language - If not, translate it and save it I could get it to work with my limited PHP knowledge, this is the code I tried: $lang = $user->language; $page->of(false); $local_headline = $page->headline->getLanguageValue($lang); if (!$local_headline) { $fluency = $modules->get('Fluency'); $translate = $fluency->translate('en', $page->headline->getLanguageValue($lang), $lang->name); echo $translate; $page->headline = $translate; $page->save("headline"); } $page->of; The error I'm getting is: Undefined variable: message in /modules/Fluency/engines/DeepL.class.php on line 172
  4. Yes, this is the exact reason why I asked about it. In its current state it's not even as complete as Padloper 1 so the most I could do is playing around with it. And that would not be a proper beta test I'm afraid. It's been years since I last used PayPal for anything so Stripe is a must have on my list, I'm not so much into custom solutions though...
  5. Thanks, Francis. Quick question: Is it an introductory price? Will it increase when you release it to the public?
  6. @Jan Romero, guess what version the site is on: 3.0.191 ? I always use the dev version for new sites and never ran into any issue. There's always a first for everything. ? Thanks a million, I searched the web and the forum up and down but didn't find it. You saved my day.
  7. I've got a strange error I don't know how to debug. Any time I try to add a new page I get the following notifications. It doesn't matter what template I try to use, it's always the same. The page "lithuanian" did not exist yet so the name shouldn't change No page is created at the end. Not with the original or changed name. It just vanishes. Created page /admin/setup/languages/lithuanian-100 using template: language ProcessPageAdd: Warning, the name you selected "lithuanian" was already in use and has been changed to "lithuanian-100". I suspect it's something with the database but not sure where to look. Any idea?
  8. There must be something on my local machine, I uploaded it to the dev server and it works straight away. I configured it and got busy translating. Thanks for the help and for the great module! I tested DeepL's translation quality with my native language and it blew my mind. Multilingual sites are now really a breeze to create.
  9. Yes, the API key validated label is there and it displays 0 for usage, as expected.
  10. Thank you for the brilliant work, I'm implementing it on a school website. I must do something wrong though because there are no available languages to setup in the module. I followed the PW and your module instructions: Enabled the multi language core modules Added an additional language to test (on top of the default) Edited the Home page for the language URLs Changed page name, text and textarea fields to multi language Now everything seems to work as expected but inside the Fluency (and TranslatePage) settings there are no languages showing up at all. Can anyone enlighten me what step I missed? I'm on PW 3.0.191 dev - Fluence 0.3.2 - local AMPPS with PHP 7.3.11
  11. The client's site has front end login, currently using the LoginRegisterPro module. I understand it's a security feature that the only error message that's shown is "Failed Login". Since the site is dealing with students, and thousands of members, they requested that I show the more explicit "Incorrect Password" error message when it applies to reduce support requests and they understand the risks. The only place I've found the "Invalid password" spelled out was the Session log but couldn't find where it is generated. Can someone point me to the right direction on how i could enable "User with this email not found" and "Incorrect password" type of error messages on front end?
  12. When using the Processwire namespace I also needed to add a leading backslash to the DirectoryIterator class so it can access the global namespace, in case someone needs to use it with the latest PW and PHP versions. <pre> <?php namespace Processwire; ini_set('max_execution_time', 60*5); // 5 minutes, increase as needed include("./index.php"); // Add a leading back slash to the class so it can access the global namespace $dir = new \DirectoryIterator(wire('config')->paths->files); foreach($dir as $file) { if($file->isDot() || !$file->isDir()) continue; $id = $file->getFilename(); if(!ctype_digit("$id")) continue; $page = wire('pages')->get((int) $id); if(!$page->id) { echo "Orphaned directory: " . wire('config')->urls->files . "$id/" . $file->getBasename() . "\n"; continue; } // determine which files are valid for the page $valid = array(); foreach($page->template->fieldgroup as $field) { if($field->type instanceof FieldtypeFile) { foreach($page->get($field->name) as $file) { $valid[] = $file->basename; if($field->type instanceof FieldtypeImage) { foreach($file->getVariations() as $f) { $valid[] = $f->basename; } } } } } // now find all the files present on the page // identify those that are not part of our $valid array // Add a leading back slash to the class so it can access the global namespace $d = new \DirectoryIterator($page->filesManager->path); foreach($d as $f) { if($f->isDot() || !$f->isFile()) continue; if(!in_array($f->getFilename(), $valid)) { echo "Orphaned file: " . wire('config')->urls->files . "$id/" . $f->getBasename() . "\n"; // unlink($f->getPathname()); } } wire('pages')->uncache($page); // just in case we need the memory } ?> </pre>
  13. Wow, @Robin S you are very good at debugging. I'll try that and see what happens. I'm not sure what the double tap issue comes from, I run near stock Android on a OnePlus phone with the latest Chrome. This has been an issue going back to years now.
  14. My client reported this issue because he wants to edit his site on his Android phone, especially uploading photos from there to the site. After uploading an image to an image field it is not possible to edit / add description when it is displayed as a square or proportional thumbnail. Since the "Edit" overlay is not displayed on tap, deleting the image is also not possible. Tapping or double tapping the image has absolutely no effect. Editing images is only possible if I change the image field to list view but buttons and the description field still need double tap to work that is anything but expected or intuitive. Single tap only changes their hover state. This has been always working as expected on iOS: single tap expands the thumbnail to editing view where the crop/focus/variations buttons and description field only require a single tap to engage. This has been tested on ProcessWire version: 3.0.171 and Android 9.0 / Chrome 89. Previous Android versions and Chrome versions had the same issue. Changing the admin theme also had no affect. Any idea how can I even start solving this issue? It looks like a core problem. since the GitHub issue had no reply I was hoping to pick the collective brain. I can't launch the site until this is sorted and the client is unlikely to switch to iPhone any time soon. ?
  15. @benbyf Did this project ever go ahead? I'd be happy to pay the usual $140-150 dev licence fee for such a module. ProcessWire seriously lacking any kind of membership solution.
  16. I've been with Krystal.uk for the last 18 months and they are absolutely amazing, it's an independent UK based business. They usually respond to support queries in minutes or couple of hours max. They use LiteSpeed but it's a drop-in replacement for Apache with htaccess support and all, not to mention the improvements such as HTTP/2 and LSCache. I'm on their shared hosting but their performance still runs circles around any other host I used, they also offer managed or unmanaged VPS. As far as I know all their hardware runs on 100% SSD too. You can't beat DigitalOcean pricing but with them you are on your own. Krystal's pricing is transparent though, and they give you a lot of things as standard that you would pay extra for with others.
  17. I don't know, Youtube works perfectly with the two modules I mentioned (Ryan's and flydev's versions), my client published YouTube videos using it as recently as January 2021.
  18. @BFD Calendar I can confirm it doesn't work for YouTube, I had to revert to flydev's fork of Ryan's module on a website recently. Ryan's TexformatterVideoEmbed module also works perfectly for Youtube or Vimeo videos. Since Facebook discontinued anonymous social embedding you are ok going with either version.
  19. @flydev ??, thanks for that, it did the trick.
  20. I'm trying to implement this module as a replacement for the original PaymentStripe module for a custom payment form. I've found everything in the readme file except one: how does one output the form? This module doesn't have a render method so I am confused.
  21. Thank you for sharing your thoughts, I definitely do not enjoy working with those open source ecommerce systems, development is never a straight line. I will try your approach next time I have this client conversation. The funny thing is that Snipcart's fee is almost fully covered by the difference in Stripe fees between the US and the EU and it's still more competitive than Shopify.
  22. @Gadgetto or anyone else who uses Snipcart to build stores for their clients: How do you justify the extra cost (minimum monthly fee / transaction fee) to clients over free solutions such as Padloper? I'd love to use Snipcart with your integration but given the choice clients go with a free to run system. Sorry this is not a technical question but thought you regularly work with Snipcart if you took the time and effort to develop such a deep integration.
  23. @999design I have the same issue, even though the paragraph tags have no attributes in my case. Tried it as links and as plain text between p tags, no luck.
  24. @Gideon So Unfortunately Facebook doesn't allow embedding content anymore (started on 24th October 2020) unless the site is authenticated. More here: https://developers.facebook.com/docs/plugins/oembed This includes Facebook and Instagram
×
×
  • Create New...