tern: handle duplicate languages by stacking versions

This is pretty tricky, so we'll probably have to do some manual cleanup in a few
cases after the migration.  But I think it'll do the right thing for the most
part.
Merge remote-tracking branch 'origin/dev' into dev