translate: reworked ranges

Now ranges are used from "ranges" var, not args.ranges.
Also we now check for directly neighbour ranges and merge them.