can not run in vietnam
Hi there! Thanks for the issue.
Phony does not yet contain rules for vietnamese telephone numbers (see lib/countries.rb). If you can provide some via pull request or via documentation, that would be most welcome.
Are these rules correct? https://en.wikipedia.org/wiki/Telephone_numbers_in_Vietnam
Yes, the rules are correct
@willingchangthernguyen Would you be willing to implement the rules and send a pull request? (I almost have no time for this right now)
How can I do ?
You can fork the project, then pull the code to your computer, and edit the code. The tests can be run by entering rake. (If all this is gibberish to you, never mind – I will look at it next week :) )
+ Vietnam, closes #39
@willingchangthernguyen I've included Vietnam in Phony. Enjoy and please tell me if there are any problems.
Thanks, I will check it
When I add country_code 84 9y x x x x x x x -> 0 9y x x x x x x x ->ok
But when setting 0 9y x x x x x x x -> delete 0 -> 9y x x x x x x x -> not ok
As outlined in the README, "This gem can normalize, format and split E164 numbers." – so this only works with E164 numbers with a country code.
How do you expect the gem to know what to do if there is no country code?
415 922 4711 -> 05922 4711 not include 0
1415 922 4711 -> 0415 922 4711 ??
Ok ,we need a country code
but about US:
1415 922 4711 -> 0415 922 4711 ?? ,they don't need 0
I'm not sure what you mean. What are you doing in the step "->", i.e. what does the arrow mean?
What do you expect to happen? Can you give me an annotated example where phony does the wrong thing, please?
I give an example in US
1415 922 4711 , the phony generates 0415 922 4711 ?? , don't need 0 letter ,should 415 922 4711
What did you do to get these numbers?
I did this with your example:
p Phony.formatted(Phony.normalize("1415 922 4711")) # => "+1 415 922 4711"
# Or just:
p Phony.formatted("14159224711") # => "+1 415 922 4711"
I get +1 415 922 4711. So what exactly are you doing?
+1 415 922 4711
Phony.formatted('14159224711', :format => :national).should == '4159224711'
in vietnam is ok Phony.formatted('84903670454', :format => :national) should == 0903670454
I think I get it now. If one uses national formatting, it should not add a zero for US numbers, but for Vietnamese numbers it's ok. Am I right?
You are right
Please change it asap ,I am using your gem
This is not how open source software works. If you want "asap", you have to pay: My going rate is 200$ an hour. If you can wait a bit, it is free. "a bit" is dependent on the quality of interaction, and the helpfulness of the other party.
I will wait
Thanks for the wait and your understanding. The fix is released in version 1.7.0.
It is demonstrated here:
If you notice another error, don't hesitate to open another issue, describing – best in code – what the problem was.
Please also remember that I am providing my work and invested free time out of the goodness of my heart, and ask for nothing else but the occasional thank you note, which are surprisingly rare.
All the best and enjoy,
14159224711 ->still 04159224711
please delete 0
Have you updated the gem to the latest version > 1.7.0?
This is what I get:
$ gem install phony
Successfully installed phony-1.7.1
1 gem installed
Installing ri documentation for phony-1.7.1...
Installing RDoc documentation for phony-1.7.1...
$ ruby -e 'require "phony"; p Phony.formatted("14159224711", :format => :national)'
"415 922 4711"
(Note the last line – no zero)
Good to hear!
I saw countries gem ,it's data have some great thing ,please check it to improve phony
The great thing about gems and Ruby is that gems are focussed pieces of code. Phony deals with phone numbers and countries deals with countries.
Using Ruby, you can combine them to be a great combo!
I could pull in countries into phony. But then, not everybody needs country stuff in their phone numbers. So I'd rather leave it up to the users of Phony whether to pull in countries or not.
Thanks for your feedback!
+ closes #39, + US formatted using format :national does not prefix a…
… 0 anymore