I agree Megumi-san.
It's impossible to translate it in one way, *for* English preposition has such broad meanings and usages. *For* the examples you gave, Megumi-san's answers are perfect:)
Generally speaking, "for" might be translated as
...wo (for something given to me)
ばんごはんを ありがとうございました。Thank you for the dinner.
......te (for doing something)
にほんごを おしえてくれて ありがとうございます。Thank you for teaching Japanese.
.....no tameni (for the benefit of someone)
このうたを、はなこさんのために うたいます。I sing this song for Hanako.
.....ni(for someone/something)
たばこは からだに よくないです。Smoking is not good for your health.
.....de (for some price)
たった1000えんで おすしが たべほうだいです。We can have as-much-as-you-can-eat sushi for only 1000yen.
etc.
But it really depends on the sentence. It's better to study Japanese sentence patterns rather than translating from English.