[1.5.x] Fixed #20398 - Added language selection code to example in documentation

Thanks ggbaker for the suggestion and Simeon Visser for the patch.

Backport of 897e4eab65 from master