Update jquery.intl-tel-input to v23.0.10 and add option for i18n

Created on 6 June 2024, 6 months ago

Problem/Motivation

The current version of the imported intl-tel-input library is 17.0.19. The latest release is: 23.0.10.
It offers additional options, including the ability to translate the list of countries displayed.

Proposed resolution

Import the latest release and add an option in webform for the phone fields to select the country translations displayed.

Feature request
Status

Active

Version

6.2

Component

Code

Created by

🇫🇷France fchometon Lyon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @fchometon
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 8.2 & MySQL 8
    last update 6 months ago
    535 pass, 1 fail
  • Pipeline finished with Failed
    6 months ago
    Total: 2154s
    #192768
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 8.2 & MySQL 8
    last update 6 months ago
    536 pass
  • Pipeline finished with Success
    6 months ago
    Total: 2301s
    #192824
  • Status changed to Needs review 6 months ago
  • Status changed to Needs work 5 months ago
  • 🇧🇷Brazil renatog Campinas

    On webform.element.telephone.js#L51 is used: "localization"
    var localization = $telephone.attr('data-webform-telephone-international-i18n');

    On /src/Plugin/WebformElement/Telephone.php#L194 is used: "localisation"
    '#title' => $this->t('Code language for localisation of country names'),

    Please correct me if I'm mistaken but seems that both are correct depending the region, like British English and American English, right?

    If yes, it's ok but I'd suggest to choose one to be consistent and avoid mixing both. As the same approach of Drupal Coding Standards that allows more than one option but recommends to choose one and avoid mixing:

    Variables should be named using lowercase, and words should be separated either with uppercase characters (example: $lowerCamelCase) or with an underscore (example: $snake_case). Be consistent; do not mix camelCase and snake_case variable naming inside a file.

    If possible I'd suggest "localization" that is already in use at webform.install.update.inc#L2355

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 8.2 & MySQL 8
    last update 5 months ago
    536 pass
  • Status changed to Needs review 5 months ago
  • 🇫🇷France fchometon Lyon

    @renatog, you're right. I pushed the requested change

  • Pipeline finished with Failed
    5 months ago
    Total: 2351s
    #204852
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 8.2 & MySQL 8
    last update 5 months ago
    536 pass
  • I've noticed that the build path for the index.js file is not correct, there is a '/' missing in the Telephone.php file (line 129).

    It would also be beneficial, as we are trying to translate countries for accessability reasons, to always translate them to the current language of the page (especially when a language switch is available).
    This could also be a checkbox 'use site default language' and hide the field for the langcode when checked.

    I hope this is helpful feedback.

    ~ Josh

  • I've created a (temporary) patch that fixes the issues mentioned in my previous comment and adds default behavior to use the current site language as the render language when the langcode field is not explicitly set.

  • Pipeline finished with Failed
    5 months ago
    Total: 2204s
    #223365
  • Status changed to Needs work 3 months ago
  • 🇵🇱Poland bronismateusz

    I applied the patch to my site, but the country flags stopped showing before the phone number, so something is wrong.

  • Status changed to RTBC 3 months ago
  • 🇵🇱Poland bronismateusz

    @Sneezycheesy Sorry for the confusion, I checked everything again today and the patch works great. Also, I upgraded the version in your patch to the latest version equal to 24.1.1.

  • 🇵🇱Poland bronismateusz

    I found the source of the problems from comment #8. The Webform module tries to load a translation file for the `intl-tel-input` library based on the selected language. However, if the selected language is not supported by the library, the module cannot load the necessary file, leading to missing translations and potential errors. I have therefore added the loading of the English version in such a situation.

  • Status changed to Needs work 3 months ago
  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    Please make the changes on the merge request. This allows tests to be run.

  • Pipeline finished with Failed
    3 months ago
    Total: 197s
    #261583
  • Pipeline finished with Failed
    3 months ago
    Total: 610s
    #261588
  • Pipeline finished with Failed
    3 months ago
    Total: 2254s
    #261604
  • 🇺🇾Uruguay jjose.quevedo

    Hi folks, I've attached a patch for the webform.element.telephone.js file, adding additional options to the telephone element component.

  • First commit to issue fork.
  • 🇺🇸United States jrockowitz Brooklyn, NY
  • Pipeline finished with Failed
    3 days ago
    Total: 387s
    #348031
Production build 0.71.5 2024