Fix language heredity.

@maethu I fixed the language heredity, when there is no language set. I also added a test for this.