Move all the API access logic into a separate library, possibly unified to support Pootle and Weblate.