Hong Kong (AFP) - Hong Kong social media lit up on Friday when protesters noticed Google's translation software was briefly churning out a rather odd suggestion during a week that has seen the worst political violence to hit the city in decades.

Eagle-eyed Google users discovered that when people entered the phrase "I am sad to see Hong Kong become part of China" the suggested translation in both Simplified and Traditional Chinese converted the word "sad" to "happy".

"Oh my god, I can't believe my eyes," one Facebook user commented under one of the many screen grabs of the false translation that went viral on Friday.

"The app intentionally mistranslates the English to 'so happy/content' instead of 'so sad'," added student Rachel Wong on Twitter. "I hope Google fixes this."

When AFP entered the sentence "I am sad to see Hong Kong become part of China" on Friday morning it did show the wrong translation, replacing sad with happy.

Searches involving some other combinations of countries or territories also reproduced the error.

An hour later, a correct translation was showing.

The company's hugely popular software tool uses complex algorithms and deep learning, as well as allowing users to make suggested translations to improve accuracy.

"Google Translate is an automatic translator, using patterns from millions of existing translations to help decide on the best translation for you," a spokesman for Google told AFP.

"These automatic systems can sometimes make unintentional mistakes like translating a negative to a positive."

The international finance hub has been rocked this week by political violence as protesters opposed to a proposed China extradition law clashed with police.

On Thursday, the popular encrypted messaging app telegram, which is being used by protesters to coordinate, announced it had suffered a major cyber-attack that originated from China.