- Issue created by @yan
- π©πͺGermany yan
I just realized that this is probably more complicated than I thought because the E.164 standard for international phone numbers can have country codes of variable length (for example
+1
for the US and Canada,+49
for Germany,+233
for Ghana etc.). Also city codes vary a lot.Google's libphonenumber could come to the rescue, but it's probably an overkill in most use cases (> 200kb minified code). But it might be an option that could be activated. More on the topic here.
Another way could be to define a format in the module settings (for example telling how to slice the numbers).
In my case, for a German phone number (
+49
) I just patched phoney.js in lines 89 and 90 to this:element.setAttribute('href', 'tel:' + tel); element.innerHTML = '(' + tel.slice(0,3) + ') ' + tel.slice(3,6) + '-' + tel.slice(6);
Not a solution, but a workaround to display a German number with a 3-digit mobile code like this:
+49 123 4737628
. - πΊπΈUnited States bkelly
Hi @yan -
Perfect, glad you could extend it to meet your needs, (the beauty of open source).
I agree, the various international formats make it a minefield of issues that I really can't support.
I wrote the module for personal use but wanted to offer it to anybody with similar privacy concerns. However I don't really have the time/energy to support an international version and intentionally limited the scope. Plus, I'm really not much of a JavaScript coder.
Thank you for your time.
-- Bill Kelly
- Status changed to Closed: works as designed
about 1 month ago 10:26pm 13 October 2024