This thread is resolved. Here is a description of the problem and solution.
For a custom language switcher, please see: https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.