To say When it rains... in Chinese, you’d say 下雨的时候... (xiàyǔ de shíhou). Notice that 的时候 (de shíhou, when) comes at the end of the phrase!