If you have `<button>file</button>` and use it in both "[file] a complaint" and "save to a [file]", then you're in trouble indeed.
But you can fix that by adding context to translation keys in the template, e.g. in TAL you can do `<button i18n:translate="'file (verb)'">file</button>`.
In the example I linked above, there's a whole mess of rules to capture if you want to handle singular/plural correctly in different languages, including those that distinguish more cases than singular and plural. It boils down to the fact that word-for-word translation doesn't work in all but the simplest cases: you can't translate "[a] [b] [c] [d]" by having 4 lookup tables for [a], [b], [c], and [d] and then plugging them into a template independently.
http://www.gnu.org/software/gettext/manual/gettext.html#Cont...
This can get quite tricky, because languages don't easily map onto 1-to-1 items that can be just translated independently and stuck into a template. See the classic "localization horror story": http://interglacial.com/tpj/13/ (and HN discussion: http://news.ycombinator.com/item?id=2095334)