Google has rather specific and convoluted requirements for XML sitemaps, especially for localization. After spending a great deal of time figuring out the formats and creating sitemaps that conform I simplified my life by creating a database structure and scripts to automate the most painful parts.
Then I put all of that into a package that allows you to generate sitemaps for subdomain based localization that includes all of the necessary hreflangs and the return tags. Then I built an administrative front-end for this and put the whole thing into a package, which is available on GitHub and Packagist.
The package allows you to specify pages in an admin panel and will then create a sitemap with the details in the database. It also will allow you to create a sitemap index to point to other sitemaps which you create yourself.
Last Updated: 2017-02-01 13:38
Detailed information on the package is available here.