In Chinese grammar, duration goes after 'verb'. The placement of the object is flexible.
[1. 你] [2. 学习] [3. 几年] [4. 汉语] [5. 了]
[1. subject] [2. verb] [3. duration] [4. object] [5. final particle indicates completion]
~
[1. 你] [2. 学习] [3. 汉语] [4. 几年] [5. 了]
[1. subject] [2. verb] [3. object] [4. duration] [5. final particle indicates completion]
The difference between the two phrases is the placement of the object.
After reading another thread here I though maybe there is a "hidden 的" and it could be 你学习了几年的汉语??
The difference between "你学习几年汉语了?" and "你学习了几年的汉语?" is:
- "你学习几年汉语了? emphasizes on the duration of the verb 学习
Take away the object and write "你学习几年了?" (how many years have you been studying?) and the sentence is still grammatically correct.
- "你学习了几年的汉语?" emphasizes on the qualification of the object.
几年的 in 几年的汉语 qualifies the object 汉语; take away the object and write: "你学习了几年的" (you have been studying for how many years of...?") would make the sentence incomplete.
As I stated before, the position of the object is flexible. You can even make it a [topic] + [comment] sentence structure and write:
"[汉语 (topic)] [你学习几年了 (comment)]
~
Also could I place the 了 directly after the verb: 你学习了汉语几年??
Yes, you can write [你学习了][汉语几年?] or [你学习了][几年汉语?]
The 了 after the verb is a particle indicates completion of the action, similar to [ed] in English
你学习 = you study
你学习了 = you studied
[verb (学习了)] follows by the [object (汉语)] is within the grammar rules.