jackocnr / intl-tel-input

A JavaScript plugin for entering and validating international telephone numbers
https://intl-tel-input.com
MIT License
7.54k stars 1.94k forks source link

Adds missing exports / fixes grunt task #1579

Closed anthony0030 closed 4 months ago

anthony0030 commented 4 months ago

The important files to look at are

I was testing out the code yesterday an I could not get it to work. I just realized I had a bunch of exports missing. These exports allowed me just to override the interface translation without touching the countries.

This is part of my code

import { enInterfaceTranslations, elInterfaceTranslations } from "intl-tel-input/build/js/i18n/index.mjs";
...

    let translations = {};
    switch (i18n.locale) {
      case "en":
        translations = enInterfaceTranslations;
        break;
      case "el":
        translations = elInterfaceTranslations;
        break;
      default:
        console.error(`${i18n.locale} is not supported in our implementation of intl_tel_input yet.`);
        translations = enInterfaceTranslations;
        break;
    }

...
        i18n: translations,

Idealy I would like to do this

import { enInterfaceTranslations, elInterfaceTranslations } from "intl-tel-input/i18n";

instead of

import { enInterfaceTranslations, elInterfaceTranslations } from "intl-tel-input/build/js/i18n/index.mjs";

Thanks 😄

jackocnr commented 4 months ago

Thanks so much for this Anthony 👍