Jump to content

Laegnur

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Laegnur

  1. Hello. In a client website, they have a form with all the Spanish provinces as Select options. The client want that when there is an address saved on client's profile, the form preloads it. The province is saved as text string on profile. So, I explode it, and get and an array with all the address parts. Now I'm trying to set the Select's selected value to the option with same name as the province part of the address but I'm getting an error: "Method InputfieldSelect::addOptionAttributes does not exist or is not callable in this context" What I'm doing wrong? $field = $modules->get("InputfieldSelect"); $field->label = "Provincia"; $field->attr('id+name','provincia'); $field->addOptions([ "Alava" => "Álava/Araba", "Albacete" => "Albacete", "Alicante" => "Alicante", ..... ]); $field->required = 1; $field->addOptionAttributes($direccion[3], array("selected"));
  2. Hello @bernhard thanks for your answer. Now I understand how to set the locale for each language in the module and was able to achieve what I wanted. Finally my date code would look like this $data = strtotime($publicacion->data_publicacion); $dateFormatter = \IntlDateFormatter::create( $languages->getLocale(), \IntlDateFormatter::NONE, \IntlDateFormatter::NONE, \date_default_timezone_get(), \IntlDateFormatter::GREGORIAN ); $contido .= '<time datetime="' . $publicacion->data_publicacion . '">' ."\n"; $dateFormatter->setPattern('EEEE'); $contido .= '<em>' . datefmt_format($dateFormatter, $data) . '</em>' . "\n"; $dateFormatter->setPattern('MMMM'); $contido .= '<strong>' . datefmt_format($dateFormatter, $data) . '</strong>' . "\n"; $dateFormatter->setPattern('dd'); $contido .= '<span>' . datefmt_format($dateFormatter, $data) . '</span>' . "\n"; $contido .= '</time>' . "\n"; And the final result:
  3. Hello On my project, I'm using the multi-language module to translate the site to 3 languages. Now I want to format the posts datetime on a custom way, and I found this method using date() to output weekday name, month name, and day number. But the output names are on English. What is the best way to set the locale for each language added in the multi-language module? $data = strtotime($publicacion->data_publicacion); $contido .= '<em>' . date('l', $data) . '</em>' . "\n"; $contido .= '<strong>' . date('F', $data) . '</strong>' . "\n"; $contido .= '<span>' . date('d', $data) . '</span>' . "\n";
  4. Hello That's what I get for not reading all the documentation. Thank you very much for clarifying this point.
  5. Hello. I'm almost a new user in Processwire. Now I'm adventuring myself into make a new website with this CMS, and adding multi-language support to it. I installed the site using the blank profile, and install later the language support modules. Configure 3 languages, and add fields, templates and pages with translated labels, all correct. But now, I have 5 strings across multiple template files that I need to translate. When I go to one of the languages, and build the phrase index it appears to find all the strings but when search for translatable files, it only find 4 string. The problematic string is the "_x('Developed by', 'developer')". What I'm doing wrong with this string?
×
×
  • Create New...