Catalonia /kætəˈloʊniə/ (Catalan: Catalunya; Occitan: Catalonha; Spanish: Cataluña)[n 1] is an autonomous community of Spain, designated a "nationality" by its Statute of Autonomy. Catalonia comprises four provinces: Barcelona, Girona, Lleida, and Tarragona. The capital and largest city is Barcelona, the second largest city in Spain, and the centre of one of the largest metropolitan areas in Europe, and it comprises most of the territory of the former Principality of Catalonia, with the remainder now part of France. Catalonia is bordered by France and Andorra to the north, the Mediterranean Sea to the east, and the Spanish regions of Aragon and the Valencian Community to west and south respectively. The official languages are Spanish, Catalan, and Aranese (an Occitan dialect). In the 10th century the eastern counties of the March of Gothia and the Marca Hispanica became independent from the Frankish kingdom, uniting as vassals of Barcelona. In 1137 Barcelona and Aragon formed the Crown of Aragon, and Catalonia became a maritime power and the main base for the Crown of Aragon's naval power and expansionism in the Mediterranean. Medieval Catalan literature flourished. Between 1469 and 1516, the King of Aragon and the Queen of Castille married and ruled together their kingdoms, retaining all their distinct institutions, courts, and the Constitution. During the Reapers' War (1640–52), Catalonia rebelled against the presence of Castillian army in its territory, becoming a republic under French protection. Under the terms of the Treaty of the Pyrenees in 1659, which ended the wider Franco-Castillian war, Castille agreed with France to cede it the northern parts of Catalonia, mostly incorporated in the county of Roussillon. During the War of the Spanish Succession (1701–14), the Crown of Aragon sided against Philip V of Spain, whose subsequent victory led to the abolition of Catalan institutions and the imposition of the Castillian ones, and the replacement of Catalan with the Spanish language in public life.