中文 vs. 汉语: What's the difference? Apparently, both of these mean Chinese, and the Chinese language. I gather that 中文 is maybe more like "written Chinese," and 汉语 is "spoken Chinese." Is this correct?

I've often looked at BBC zhongwen, so it makes sense that that's "written". If a movie was in Chinese, would you say 汉语 for that? 

Can you give more examples of each, particularly when you could only use one or the other? Are there any examples in which you could potentially use either, with a slightly different meaning?
I gather that 中文 is maybe more like "written Chinese," and 汉语 is "spoken Chinese."


This is correct as you would expect, however there are subtle nuances caused by the different spoken Chinese languages and issues of cultural identity, and that Mandarin is often considered the standard spoken Chinese language.

Before I digress here are some examples where you'd use one or the other:


Chinese subtitles = 中文字幕. When referring to only the written language, use 中文. Note that for practical reasons, you may need to disambiguate further: 简体字幕 or 繁体字幕.
Chinese dictionary = 汉语字典. For dictionaries, use 汉语 because they often relate to the entire language, both spoken and written, for example including pronunciation. To keep with convention though, all dictionaries use "汉语", even if they don't deal with the spoken form, for example an English-Chinese dictionary would be called a 英汉词典.
I can speak Chinese = 我会说中文/汉语. Here the two terms are interchangeable, if you are referring to Mandarin, which is confusing at first. This is because of the status of Mandarin as the standard Chinese spoken language. Sometimes you want to be more specific by referring to the specific Chinese language, e.g. 我会说普通话 or 我会说广东话. (I'm not sure here, but in situations where a spoken Chinese language other than Mandarin is standard, 中文 also means that language. For example in Hong Kong saying 我会说中文 could mean "I can speak Cantonese", especially if you were contrasting it with a non-Chinese language)
I can write Chinese = 我会写中文. It would be improper in this case to use "汉语". You can also say "I can write Chinese characters" though, by unambiguously saying 我会写汉字.


Here's some background information:

There is "one" Chinese written language, and "many" Chinese spoken languages

The reason I've used scare quotes is that the answer varies depending on how strict you are or what your political/ideological views are. The Wikipedia article explains all, but here are the basics:


Linguistically, there are many Chinese spoken languages as they are mutually unintelligible. This is different from most other languages, where dialects are intelligible, but what's translated as Chinese "dialects" or 方言 can range from easily understood (between 北京话 and 东北话) to completely unintelligible (e.g. 客家話).
Despite this, many Chinese prefer to treat the different spoken languages as "dialects" of one language. This is due to a shared cultural identity; China experienced prolonged unified rule, in other words, many Chinese are historically accustomed to speaking mutually unintelligible languages but still being part of the same national identity. Do note that this is a politically charged topic though.
There are two scripts used for written Chinese, Simplified and Traditional (简体 and 繁体). Some Chinese "dialects" even have their own unique characters (e.g. 冇 and 係) and grammars which are considered informal or archaic and you don't often encounter them in formal written contexts. For practical reasons though, you can consider there to be only one written Chinese language. This is also a controversial topic though, which I would rather only acknowledge without exploring further.