Most of you guys are talking beside the point. In fact, it's a clever plan by the Chinese gov. to de-dollarise its currency and economy.
Let me put my two cents into this.
Here are the following facts:
China has tons of USD
Gold price is tied to the rate of USD
USD goes up, gold goes down
The lower the gold prices goes, the cheaper China buys gold
Now, with the devaluation, the psychological part comes in. Everyone who has little clue about the relationship about gold and the USD will think that the USD is a safe haven and so they flock to the USD pushing the USD up and the gold price down.
It's a catch 22 for the US and a clever move by China.