It sounds like you're addressing two different dialogue issues, here: historical accuracy and dialect.
When it comes to dialect, Scott has nailed it: your script shouldn't be a phonetic puzzle. Do include any vocabulary that's specific to your story world. Do not spell out words "by sound"--your actors will manage the accents just fine, it's part of their job.
My personal standard for "too much" on dialect is when I have to stop and sound out the dialogue in order to work out what the words are meant to be. My standard for "just right" is when I can instantly recognize who a character is by his or her distinctive speech--but the dialect doesn't slow down my read.
When it comes to historical accuracy in language, as with all other writing choices, serve the story first. That said, here are some tips to help you pick period-appropriate language.
1. Read literature from the period to get a feeling for the language. If it's available, listen to popular music from the period, too.
2. The
Google Ngram Viewer is your friend. Not sure if your 1920's American gangster would say he was "on the lam"?
Look it up! (He wouldn't.)
3. Any dictionary that includes etymologies will tell you when a word entered the language.
4.
WorldWideWords is a great site that explains the meaning and origin of words and phrases -- that also has an email subscription option.
5. People born before you were didn't speak in a stilted, "old-timey" way, so please don't write your dialogue this way. Contractions aren't a recent invention, either.
6. Want to know what traps to avoid? Look up the (many) criticisms of anachronisms in Mad Men and Downton Abbey. E.g.,
"Downton Abbey" anachronisms: beyond nitpickery or
Mad Men-ese. And realize that anachronism-hunting is an Internet phenomenon now so your work may also be subjected to this level of scrutiny.
Del Close was famous for telling his improv students at Second City Chicago to "play to the top of your intelligence" and to always assume the audience is more intelligent than you are.
I'd recommend keeping Close's advice in mind when you're deciding if a historical story is accurate "enough"--does this dialogue serve the story, and will it work for an intelligent audience?