It’s a theatrical superstition that wishing someone good luck is actually bad luck. Following that logic, the polite thing to say is, “Break a leg!” There are all sorts of bad things that can happen to an actor on stage, so I’m not sure why we settled on breaking a leg. Imagine if we said, “Forget your lines!” or “Get a nose bleed!”
Dancers use this as an opportunity to curse at each other. In the dancing world, it’s customary to say “Merde!” before a dancer takes the stage. Merde is French for s#%t. So if you’re looking for an excuse to curse in French, become a dancer.
In the meantime, if you know someone who is in a play, buy them some flowers and tell them you hope they will “break a leg!”