Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

In vietnam #39

Closed
willingchangthernguyen opened this Issue · 27 comments

2 participants

@willingchangthernguyen

can not run in vietnam

@floere
Owner

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

@willingchangthernguyen

Yes, the rules are correct
Thanks

@floere
Owner

@willingchangthernguyen Would you be willing to implement the rules and send a pull request? (I almost have no time for this right now)

@willingchangthernguyen

How can I do ?

@floere
Owner

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 :) )

@floere floere reopened this
@floere floere closed this issue from a commit
@floere + Vietnam, closes #39 97ac497
@floere floere closed this in 97ac497
@floere
Owner

@willingchangthernguyen I've included Vietnam in Phony. Enjoy and please tell me if there are any problems.

@willingchangthernguyen

Thanks, I will check it

Willing

@willingchangthernguyen

Hi Floere

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

Thanks
Willing

@floere
Owner

Hi Willing,

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?

Cheers,
Florian

@willingchangthernguyen

Hi Floere
In USA
415 922 4711 -> 05922 4711 not include 0
1415 922 4711 -> 0415 922 4711 ??

Thanks
Willing

@willingchangthernguyen

Hi Floere
Ok ,we need a country code

but about US:
1415 922 4711 -> 0415 922 4711 ?? ,they don't need 0

Thanks
Willing

@floere
Owner

Hi Willing,

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?

Cheers,
Florian

@willingchangthernguyen

HI Florian
I give an example in US
1415 922 4711 , the phony generates 0415 922 4711 ?? , don't need 0 letter ,should 415 922 4711

Thanks
Willing

@floere
Owner

What did you do to get these numbers?

I did this with your example:

require 'phony'

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?

@willingchangthernguyen

HI Florian
for US
Phony.formatted('14159224711', :format => :national).should == '4159224711'
in vietnam is ok Phony.formatted('84903670454', :format => :national) should == 0903670454
Thanks
Willing

@floere
Owner

Hi Willing,

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?

Cheers,
Florian

@willingchangthernguyen

Hi Florian
You are right

Thanks
Willing

@willingchangthernguyen

Hi Florian

Please change it asap ,I am using your gem

Thanks
Willing

@floere
Owner

Hi Willing

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.

Cheers,
Florian

@willingchangthernguyen

Hi Florian
:D
I will wait
Thanks
Willing

@floere floere reopened this
@floere
Owner

Hi Willing

Thanks for the wait and your understanding. The fix is released in version 1.7.0.

It is demonstrated here:
https://github.com/floere/phony/blob/master/spec/lib/phony_spec.rb#L175-177

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,
Florian

@floere floere closed this
@willingchangthernguyen

Hi Florian

14159224711 ->still 04159224711
please delete 0
Thanks
Willing

@floere
Owner

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)

@willingchangthernguyen

Hi Florian
Successful
Thanks
Willing

@floere
Owner

Good to hear!

@willingchangthernguyen

Hi Florian
I saw countries gem ,it's data have some great thing ,please check it to improve phony
Thanks
Willing

@floere
Owner

Hi Willing,

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!
Florian

@glebm glebm referenced this issue from a commit in glebm/phony
@floere + closes #39, + US formatted using format :national does not prefix a…
… 0 anymore
0481660
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.