Sanskrit has been studied by Western scholars since the late 18th century. In the 19th century, the study of Sanskrit played a crucial role in the development of the field of comparative linguistics of the Indo-European languages. During the British Raj (1857-1947), Western scholars edited many Sanskrit texts which had survived in manuscript form. The study of Sanskrit grammar and philology remains important both in the field of Indology and of Indo-European studies.
The study of Sanskrit in the Western world began in the 17th century. Some of Bhartṛhari's poems were translated into Portuguese in 1651. In 1779 a legal code known as vivādārṇavasetu was translated by Nathaniel Brassey Halhed from a Persian translation, and published as A Code of Gentoo Laws. In 1785 Charles Wilkins published an English translation of the Bhagavad Gita, which was the first time a Sanskrit book had been translated directly into a European language.
In 1786 Sir William Jones, who had founded The Asiatic Society two years earlier, delivered the third annual discourse; in his often-cited "philologer" passage, he noted similarities between Sanskrit, Ancient Greek and Latin—an event which is often cited as the beginning of comparative linguistics, Indo-European studies, and Sanskrit philology.