Actually, it doesn't require scripting. In the MedII engine it is possible to change the name of a city depending on the faction that controls it.