For example, if you instead toggle the language option to be some other language like Spanish or something, the URL changes to:
www.domain.com/sp/path
Why not:
www.domain.com/path?lang=sp
?
Also, why not:
www.domain.com/path/sp
It comes down to how you're serving your site. Typically you would just serve static files over a web server and you would have separate files for each language.
Having the language param in the query requires some Javascript to parse it etc, which might work better for single-page applications for example.