How can I switch language links to master links on a translated page?
Go to admin/config/regional/language/detection/url and then you must delete the path prefix for the language, you don't need code to do this.



And save the config.