For example, when a page starts with:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
is it possible to detect what language the page is written in using the doctype or some other method? And if so, what language would I use?
The language code in the doctype is to show what language the dtd is written in (usually EN for English). For the language of the page you would probably look for a language attribute in the html tag:
possible attributes and explanations: