Chinese messaging app WeChat has apologised after its software used the N-word as an English translation for the Chinese for "black foreigner".
The company blamed its algorithms for producing the error.
It was spotted by Ann James, a black American living in Shanghai, when she texted her Chinese colleagues to say she was running late.
Ms James, who uses WeChat's translation feature to read Chinese responses, got the reply:"The [racial slur] is late."
Horrified, she checked the Chinese phrase - "hei laowai" - with a co-worker and was told it was a neutral expression, not a profanity.
The app's software uses artificial intelligence that has been fed huge reams of text to help it pick the best translations.
These are based on context, so it sometimes uses insulting phrases when talking about negative events.
Local outlet That's Shanghai tested the app, and found that when used to wish someone happy birthday, the phrase "hei laowai" was translated as "black foreigner".But when a sentence included negative words like "late" or "lazy," it produced the racist insult.
Almost a billion people use WeChat, which lets users play games, shop online, and pay for things as well as sending messages.It resembles another popular chat app, WhatsApp, but is subject to censorship.
A research group at the University of Toronto analysed the terms blocked on WeChat in March, and found they included "Free Tibet", "Down with the Communist Party", and many mentions of Nobel laureate Liu Xiaobo, who was China's most prominent human rights advocate....