Jump to content

Gadgetto

Members
  • Posts

    394
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by Gadgetto

  1. Thanks, I had something similar, but the button action isn’t interrupted if I click „Cancel“. The native JavaScript I posted above returns false in this case and the button link isn’t executed - which is what I want.
  2. @bernhard, could you please give me a hint on how to implement a vex confirm within this situation? I'm trying this since the last hour but without success... ? $('.ResendInvoiceButton').on('click', function() { return window.confirm('Do you want to resend the invoice?'); // <-- I'd like to replace this with a vex dialogue });
  3. This won't work, as you you have no warrant, that the admin has set "default" to German (or English). I think the best way (as we discussed above) is, to provide the translated json language files with the module and the site admin has to import those files into the desired language) Edit: @gebeer you beet me by 2 minutes ...
  4. Could you please describe the workflow how I can create those language-files to be later added manually to the 'Site Translation files'? Edit: OK, I think I get it partly. I need to translate all SnipCart related files in PW backend and the export as .zip. The .zip holds all translated Json files of the complete sites folder. now I could pick only those Json files which belongs to the SnipCart package and bundle them with the module. an admin has then to import those SnipCart related Json files in PW language editor via this: If this is the correct way, then its really not as big problem as it seems to. -- Martin
  5. Thats really bad (at least in my opinion). In MODX where I came from, this was never a problem. Pre-defined language files could be easily installed withe each plugin. Translations could be done using web-services like Crowdin. So I can only release my module with a single language. And translation has to be done manually after that within PW.
  6. @LostKobrakai your post from above made me curious: is there currently no way to provide/preinstall language files with a module? I'd like to release SnipWire at least in English and German.
  7. I think it would be great if the ProcessWire language template already had a field e.g. "alpha-2" which needs to be filled (required) with the language code defined by the ISO 639 standard. Each language could have it's own custom name "default", "german", "english", ... (like it is now) but a language code would be also needed. I know I can add this field manually, but I think it should be in the PW core - with the restriction that you would have to map this manually! I think I'll post a feature request for Ryan ... @LostKobrakai Your PR from above would be a great addition! I gave your request a "thumbs up"!
  8. Yes, I do this in frontend each time I'm using multi-languages. The problem is, for a ProcessModule I have no warranty that the site owner uses "default" for English language. So a manual mapping would always be required.
  9. @dragan & @wbmnfktr, your suggested method (the admin needs to map the languages) currently seems to be the way to do this. I just don't think it's very elegant. After all, I'll probably implement the country list as a standard array with PW language methods. This is the way how PW handles it. I could try to generate the PHP language files with their language methods programmatically.
  10. Hey Jens, thanks for the hint, but the problem isn't finding a library - the problem is, I don't know a good way to load the correct country list file based on the current PW language.
  11. With the help of @Noboru I could fix some bugs in the "Extended Resources" installer and with float values in prices. Some rare problems could be fixed and the installer is more stable now. A big problem is the integrated taxes-provider regarding shipping-.taxes. I'm in contact with the Snipcart team to make this as flexible as possible. This isn't easy as we have very different taxes system around the countries of the world.
  12. Hi there, for my SnipWire module I'd like to implement a countries library which provides Json arrays with world-countries and their associated alpha-2 and numeric codes as defined by the ISO 3166 standard. The library provides the word-countires lists in different languages. I created files like world.en.json: [{"id":4,"name":"Afghanistan","alpha2":"af","alpha3":"afg"}, {"id":818,"name":"Egypt","alpha2":"eg","alpha3":"egy"}, ... world.de.json: [{"id":4,"name":"Afghanistan","alpha2":"af","alpha3":"afg"}, {"id":818,"name":"Ägypten","alpha2":"eg","alpha3":"egy"}, ... and so on ... A special class handles the loading of the language files and converts them to PHP arrays. The problem is, I don't know how to load the language file based on the current admin language. ProcessWire doesn't use ISO language codes to identify languages. In a default installation the base language is defined as "default". Other languages can be defined as one likes (e.g. "german", "spanish", ...). It is even possible that admins changes the "default" language to German for example. As this method doesn't use the ProcessWire i18n API ($this->_('Text') or __('Text')), what would be the best and stable way to load the json files based on the correct language? Is this even possible or should I choose another method using translatable strings instead? -- Martin
  13. You can have a look at my SnipWire module (currently in development). It has an extended installer class which creates fields, templates, pages, permissions, copies files to directories, ... using an array. Here is the installer: https://github.com/gadgetto/SnipWire/blob/dev/installer/ExtendedInstaller.php And here the resources array: https://github.com/gadgetto/SnipWire/blob/dev/installer/ExtendedInstaller.resources.php
  14. Oh, I just see, that you need an account to get geonames. No public API. So this isn't suitable for my SnipWire plugin. Edit: And I just found the limits: 20'000 credits daily limit per application (identified by the parameter 'username'), the hourly limit is 1000 credits. A credit is a web service request hit for most services. An exception is thrown when the limit is exceeded.
  15. This looks better and better ... Last question: do you know if there is a limit on requests (per hour/day/month/...)?
  16. Ok, did't find this info. Thank you! Do you know, if they have also pre-translated sources?
  17. Thank you for your input! Seems to be a nice resource so far! BTW - geonames.org site seem to be 20 years old. They use tables for layout... And I can't find information about how how up-to-date the data is.
  18. Just stumbled across this old thread. I found a very good source for a well maintained world countries list! Available in multiple languages, in CSV, JSON and SQL formats, with associated alpha-2, alpha-3, and numeric codes as defined by the ISO 3166 standard, and with national flags included: http://stefangabos.github.io/world_countries/
  19. Thanks! This works perfectly! But I don't understand how the destructive behavior works. Is this cached somewhere? Or via static objects?
  20. OK, I solved it this way (without using the filter method of WireArray): private function _getProductTemplateFields($defaultFieldName, array $allowedFieldTypes = array()) { $selectedFields = new WireArray(); if ($productTemplate = $this->wire('templates')->get(MarkupSnipWire::snipcartProductTemplate)) { $templateFields = $productTemplate->fields; foreach ($templateFields as $field) { if (in_array($field->type, $allowedFieldTypes)) { $selectedFields->add($field); } } } else { $defaultField = $this->wire('fields')->get($defaultFieldName); if ($defaultField->name) $selectedFields->add($defaultField); } return $selectedFields; }
  21. This gets crazy now: I have 2 calls for the exact same method. With the first call the Page field is returned but not with the second one. WTF? Is there some caching involved or could it be an issue with an array pointer?
  22. An empty array is "false" in PHP so I'm using this as it is the fastest possible comparison. ? count($array) will be a lot slower (especially on larger arrays). This is strange, I really don't know why it doesn't get a match for the Page field. This is the field config: and this the template:
×
×
  • Create New...