Catalonia (; ; ; ; ) is an autonomous community of spain, and 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 catalan, spanish 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 their kingdoms together, retaining all their distinct institutions, courts, and the constitution. during the reapers' war (1640–52), catalonia rebelled against the presence of the 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-spanish 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 replacement of latin or catalan with the spanish language in legal documents. despite the napoleonic and carlist wars, catalonia experienced economic growth and industrialisation. during the second half of the 19th century, the region saw a cultural renaissance coupled with incipient nationalism, while several workers movements appeared. in 1913, the four catalan provinces formed a commonwealth, and with the advent of democracy during the second spanish republic (1931–39), the generalitat of catalonia, was restored. after the spanish civil war, the francoist dictatorship enacted repressive measures, abolishing catalan institutions and banning the official use of the catalan language again. during the 1950s and 1960s, catalonia saw significant economic growth and became an important tourist destination, drawing many workers from across spain and making barcelona one of europe's largest industrial metropolitan areas. since the spanish transition to democracy (1975–82) catalonia has recovered political and cultural autonomy and is now one of the most economically dynamic regions of spain.