Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with i18n library #49

Open
frankPairs opened this issue Dec 11, 2015 · 5 comments
Open

Conflict with i18n library #49

frankPairs opened this issue Dec 11, 2015 · 5 comments

Comments

@frankPairs
Copy link

Hi!!

I've found a problem with phoneformat library.

I've used http://i18next.com/ library to do translations The problem is that it also declares a i18n global variable as phoneformat.js then this global variable is overwritten and the library doesn't work correctly.

I think that you could change this global variable name for other because i18n is a common library to manage translations and a lot of people use it.

Thank you.

@frankPairs
Copy link
Author

Hi!

I've solve this problem with the next line:

var i18n = typeof i18n !== 'object' ? {phonenumbers: {}} : Object.create(i18n, {'phonenumbers': { value: {}}});

Maybe there is a better solution but I've tried it in my project and it works perfectly. If anyone find a better solution, I will be enthusiastic to know it!

Thanks and good morning.

@FarhanJohari
Copy link

hi there.. where did you put this line of code ?? really need help

@frankPairs
Copy link
Author

Hi @FarhanJohari, you have to put this line in i18n var definition.

@FarhanJohari
Copy link

hi again.. @frankPairs sorry for asking again... actually im not understand which var definition that u mention..

@frankPairs
Copy link
Author

Hi @FarhanJohari.

For instance, change line 4297 of phone-format.js file by this line:

var i18n = typeof i18n !== 'object' ? {phonenumbers: {}} : Object.create(i18n, {'phonenumbers': { value: {}}});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants