The answer to this question is by reading messages written on oracle bones
Even though the written language was not recognizable by them first, many of people in shang dynasty found a lot of oracles from the bones of ox, birds, and goats. They can only manage to fully decipher the language in early twenty century