In my introductory quantum mechanics book it was stated that the operator $-i\hbar\vec{\nabla}$ represents the momentum $\vec{p}=m\vec{v}$ of a particle. In the book "Physics of atoms and molecules" by Brandsen-Joachain, when studying the interaction of an atom with electromagnetic radiation, they use the operator $-i\hbar\vec{\nabla}$ to represent the vector whose components are the generalised momenta $p_i=\frac{\partial L}{\partial \dot q_i}$, where $L$ is the classical lagrangian. In this case we use a lagrangian that contains also a magnetic term, and we have $\vec{p}=m\vec{v}+q\vec{A}$, where $\vec{A}$ is the vector potential.
I am confused as this books state two different things. In the case that the second book is right, the operator $-i\hbar\vec{\nabla}$ represents the generalised momenta even if we don't use cartesian coordinates? For example if we use polar coordinates we have that $-i\hbar\vec{\nabla}$ represents the vector $(\frac{\partial L}{\partial \dot r},\frac{\partial L}{\partial \dot \theta},\frac{\partial L}{\partial \dot \phi})?$