succeeded in industrializing parts of the Empire. Newly prosperous members of the bourgeoisie erected large homes and began to take prominent roles in urban life that rivaled the aristocracy's. In the early period, they encouraged the government to seek foreign investment to build up infrastructure, such as railroads, in aid of industrialization, transportation and communications, and development. The influence of liberals in Austria, most of them ethnic Germans, weakened under the leadership of Count Eduard von Taaffe, the Austrian prime minister from 1879 to 1893. Taaffe used a coalition of clergy, conservatives and Slavic parties to weaken the liberals. In Bohemia, for example, he authorized Czech as an official language of the bureaucracy and school system, thus breaking the German speakers' monopoly on holding office. Such reforms encouraged other ethnic groups to push for greater autonomy as well. By playing nationalities off one another, the government ensured the monarchy's central role in holding together competing interest groups in an era of rapid change. During the First World War, rising national sentiments and labour movements contributed to strikes, protests and civil unrest in the Empire. After the war, republican, national parties contributed to the disintegration and collapse of the monarchy in Austria and Hungary. Republics were established in Vienna and Budapest. Legislation to help the working class emerged from Catholic conservatives. They turned to social reform by using Swiss and German models and intervening in private industry. In Germany, Chancellor Otto von Bismarck had used such policies to neutralize socialist promises. The Catholics studied the Swiss Factory Act of 1877, which limited working hours for everyone and provided maternity benefits, and German laws that insured workers against industrial risks inherent in the workplace. These served as the basis for Austria's 1885 Trade Code Amendment. The Austro-Hungarian compromise and its supporters remained bitterly unpopular among the ethnic Hungarian voters, and the continuous electoral success of the pro-compromise Liberal Party frustrated many Hungarian voters. While the pro-compromise liberal parties were the most popular among ethnic minority voters, the Slovak, Serb, and Romanian minority parties remained unpopular among the ethnic minorities. The nationalist Hungarian parties, which were supported by the overwhelming majority of ethnic Hungarian voters, remained in the opposition, except from 1906 to 1910 where the nationalist Hungarian parties were able to form government. Foreign affairs The emperor officially had charge of foreign affairs. His minister of foreign affairs conducted diplomacy. See Ministers