In Chinese, pearls are always used as a metaphor for precious and elegant people or things, as connoted by the idiom,"掌上明珠" (zhǎng shàng míng zhū), which literally means "a pearl in one's hand" and is equivalent to "the apple of somebody's eye" in English. Here, "apple" refers to "pupil" (瞳孔, tóng kǒng) rather than the fruit (苹果, píng guǒ). If "the apple of somebody's eye" is not translated in to "某人的掌上明珠", it can just be translated into "某人眼睛的瞳孔"(mǒu rén yǎn jīng de tóng kǒng , the pupil of one's eye) literally. "瞳孔" is called "apple" in old English, because "apple" means "果子" (guǒ zǐ, fruit) as well as "苹果" (píng guǒ). In old times, people failed to notice that a pupil was actually a hole and thought that it was the same with an eyeball, a fruit-shaped ball.
汉语里，珍珠常被用来比喻珍贵、美好的人或物，如"掌上明珠"。英语里相应的表达方式是the apple of somebody's eye。这里的apple 可不是"苹果"，而是指pupil"瞳孔"。不过反过来，the apple of somebody's eye 即使不译成"某人的掌上明珠"，也只能直译成"某人的眼珠子"，不能译成"某人眼睛的瞳孔"。古英语之所以把瞳孔称为apple，是因为apple 不仅有"苹果"的意思，而且还有"果子"的意思。古时人们不知道瞳孔实际是个孔，以为它和眼球一样，也是个果子状的球体。
People in English speaking countries do not know the value of the pearl. There is an idiom in English, "Don't cast your pearls before swine", which is literally close to "明珠暗投" (míng zhū àn tóu) in Chinese. In New Testament: Gospel of Matthew 7: 1-6 (King James Version), Jesus Christ says to his numerous adherents on a hill, "Give not that which is holy unto the dogs, neither cast ye your pearls before swine, lest they trample them under their feet, and turn again and rend you."
英语国家的人并非不了解珍珠的价值，有一条英语成语Don't cast your pearls before swine，其字面意思就和汉语的"明珠暗投"很接近。据英王詹姆士钦定本（King James Version）《新约·马太福音》第7章第1—6节记载，耶稣·基督在一座山上向跟随他的众多信徒说："Give not that which is holy unto the dogs, neither cast ye your pearls before swine, lest they trample them under their feet, and turn again and rend you." "你们不要把圣物交给狗，也不要把自己的珍珠投到猪跟前，以防它们把这些踩在脚下，再转过身来，把你们撕成碎片。"
The idiom "明珠暗投" (míng zhū àn tóu) originates from the Western Han Dynasty in China. According to Shiji • Biography of Lu Zhonglian & Zou Yang, Liu Bi, King of the Wu State in the Western Han Dynasty, had a hanger-on named Zou Yang. Zou Yang found that Liu Bi had been plotting a rebellion, so he admonished Liu to give up but Liu turned a deaf ear to him, so he turned to the King of Liang in the end. Unfortunately, he was envied, so he was framed and thrown into prison sentenced to death. While in prison, he wrote to the King of Liang "I have heard that if someone throws a luminous pearl or jade onto the road, the passers-by would all stare at him, ready to draw out their swords. Why? The treasure has been dropped in front of them without any reason." After that, his descendants often used "明珠暗投" (míng zhū àn tóu) as a metaphor for a valuable thing falling into the hands of a person who doesn't understand it or a talent not being appreciated or placed to an important position.
So the original meaning of these two idioms differs slightly: "casting your pearls before swine" satirizes the impervious listeners who are considered as stupid as swine, while "明珠暗投" (míng zhū àn tóu) expresses self-pity of a person who is treated unjustly or frustrated for all his or her talent. Thus, it may be more accurate to translate "casting your pearls before swine" into "对牛弹琴" (duì niú dàn qín), which means "play the zither to a cow" literally. Justus Doolittle, an American protestant missionary, wrote in his works in 1872, " When Chinese are to express 'Don't cast your pearls before swine', they will say 'Don't play the lute before a donkey'." Here, he changed "zither" （琴, qín） into "lute" （琵琶, pí pá）, and "cow" (牛, niú) into "donkey" （驴, lǘ）, but still meant the same basic idea.
这样看来，这两条成语的本义有所不同：casting your pearls before swine 传达的是对不可理喻的听众的讥讽，说他们蠢得像猪。"明珠暗投"传达的是冤屈者或怀才不遇者的自怜；有鉴于此，把casting your pearls before swine 译成"对牛弹琴"或许更确切一些。美国新教传教士卢公明（Justus Doolittle）在他1872 年的文集中说，中国人在表达Don't cast your pearls before swine 的意思时，会说"Don't play the lute before a donkey."。在他那里，"琴"（zither）变成了lute"琵琶"，"牛"也变成了donkey"驴"，不过基本意思没有走样。
Nowadays, "casting your pearls before swine" is generally used as the equivalent idiom to "对牛弹琴" (duì niú dàn qín) in a Chinese-English dictionary. However, it doesn't necessarily mean that "casting your pearls before swine" has no meaning of "明珠暗投" (míng zhū àn tóu). Please read the passage below.
如今汉英词典一般以casting your pearls before swine作为"对牛弹琴"的对应成语。可是casting your pearls before swine 也并非没有'明珠暗投'的意味，请看：
How strange that I should be called a destitute woman! When I have all of these treasures [beauty of the mind and richness of the spirit and tenderness of the heart] locked in my heart. I think of myself as a very, very rich woman! But I have been foolish—casting my pearls before swine. (Tennessee Williams, A Streetcar Named Desire, 1947)
真怪，我竟然被称作穷困的女人！我心中拥有这一切财富[头脑的聪慧、灵魂的丰富、内心的温柔]，自认为是个非常、非常富有的女人！可是我一直在犯傻——把自己的珍珠投到猪跟前 / 明珠暗投。（田纳西·威廉姆斯，《欲望号街车》，1947）
By contrast, "明珠暗投" will be better here.
Moreover, "casting pearls before swine" can even be used in reverse.
更绝的是，casting pearls before swine还可以反其义而用之：
Isabel drove with Goodrich beside her. Happy, but still feeling she was casting swine before pearls. Isabel was painfully conscious of the shortcomings of the scenery; above all its literal flatness. (L.P. Hartley, A Perfect Woman, 1955)
伊莎贝尔开着车，旁边坐着古德里奇。她心情不错，可还是觉得自己是在把猪投到珍珠跟前 / 暗珠明投。伊莎贝尔明白眼前风景的缺憾，特别是其平淡无奇，为此而深感内疚。（L.P. 哈特莱，《完美的女人》，1955）
Obviously, Goodrich is a person of good taste. Isabel felt guilty as she could not take him to the better scenery. Maybe, "暗珠明投" (àn zhū míng tóu) will be the better word to describe her feeling then.