catalog: fix language detection

Detection would fail if language was not specified in the filename
but a dot appeared somewhere higher in the path.