Refactor the translation helpers function

The function was very long and did many unrelated things.
Split to several functions for maintainability.

Change-Id: I714aec0f183ce25b8dfff002d88b4a27c3fbefc3
Merge "Refactor the translation helpers function"