Actually Catalan is not a dialect but a language in its own right. It originated on the Middle Ages, Spain was then invaded by the Muslims and only some pockets of resistance remained in the North. One of this pockets evolve into Castilla and the other into Aragon. Both Kingdoms claiming to be the rightful descendants of the Hispanic Goth Kingdom. At this time the low Latin spoken by the commoners started to be written and evolving. Since Spain was divided in different kingdoms each developed its own roughly Galician in the Northwest, Castilian in Castilla and Catalonian in the east. At this point in time Catalonia was only an earldom, part of the Aragonian Crown which at one point occupied big chunks of the Mediterranean as far as the Dukedom of Neopatria in Greece. In fact an early version of Catalan is still spoken in some villages in Sardinia. Time passed, the Reconquista (the slow process of regaining the land occupied by the Muslims which lasted from 711 till 1492) advanced and since Castillian kings were more succesful in their campaigns and also the empty lands left behind by the retreating muslims were repopulated mainly by castilian spoken Spaniards, Castilian became prevalent in Spain while catalan remained a villagers language with little if any literature or grammatical evolution. Centuries passed and the Romanticism reignited the interest for the Middle Ages, local traditions, folk lore...the catalonian expression of this wider movement was called La Renaixença and the Catalan language was reinvigorated, codified and get literary development. This movement started around 1830 and lasted for the rest of the century. Its greatest poet being Mossen (priest) Cinto Verdaguer.
Unfortunately then came the XXth century and the language became a weapon of choice instead of a tool of communication. Franco tried to impose this onanistic vision of Spain as a uniformed land where only one language, one religion, one Zeitgeist and one make of cars were to be tollerated (and most of all one dictator) and he tried to banish the catalan language. To no effect, of course.
Then Franco died, Catalonia and all the regions of Spain got unprecedented levels of devolution and self government and the Catalan Nationalists got to the regional government which they used and are still using to try to impose this onanistic vision of Catalonia as a uniformed land where only one language and above all one party is to be tollerated, despite the fact that roughly 50% of the population do not have catalan as its mother tongue. We have got to the nonsense that many children learning today in state schools receive less classes of Spanish than of English. The damage this is producing to this children is huge and will only be noted in the future. Do nationalist care. Of course not. This children will grow to be the pefect cannon fodder for the nationalist. Snowball would be proud.
Anyway, the catalan language is of course as innocent of this abuses as was the Spanish before. It's a beautiful language closer to Latin than Spanish and specially apt for poetry. This is a sample from Verdaguer:
Quan á la falda't miro de Montjuich seguda,
m'apar vèuret als brassos d'Alcides gegantí,
que per guardar sa filla del seu costat nascuda
en serra transformantse s'hagués quedat aquí.
Y al veure que traus sempre rocam de ses entranyes 5
per tos casals, que creixen com arbres ab sahó,
apar que diga á l'ona y al cel y á les montanyes:
-Miraula; òs de mos òssos, s'es feta gran com jo!-
Sorry about the long post but you asked for it!