I think this is partially related to a question I raised recently, even though my site won't have that many languages per country but some countries will have 2 languages.
How can I add in new Locales to the locale list?
Then you would do something like this in your config
return array(
'example.com' => array(
'siteUrl' => array(
// Global locales
'en' => 'http://example.com/en/',
'es' => 'http://example.com/es/',
'fr' => 'http://example.com/fr/',
'de' => 'http://example.com/de/',
// Canada locales
'ca_en' => 'http://ca.example.com/en/',
'ca_es' => 'http://ca.example.com/es/',
'ca_fr' => 'http://ca.example.com/fr/',
'ca_de' => 'http://ca.example.com/de/',
// UK locales
'gb_en' => 'http://uk.example.com/en/',
'gb_es' => 'http://uk.example.com/es/',
'gb_fr' => 'http://uk.example.com/fr/',
'gb_de' => 'http://uk.example.com/de/',
),
),
);
This should work, I haven't tested it as yet as my site is still in planning stages and I have not gotten into the development phase as yet.
Edited answer based on comment.
For all countries to use the same English, you can set your array to look like below, however this will not allow individual countries to have different English copy since we are pointing them all to the same Locale now.
return array(
'example.com' => array(
'siteUrl' => array(
// Global locales
'en' => 'http://example.com/en/',
'es' => 'http://example.com/es/',
'fr' => 'http://example.com/fr/',
'de' => 'http://example.com/de/',
// Canada locales
'en' => 'http://ca.example.com/en/',
'ca_es' => 'http://ca.example.com/es/',
'ca_fr' => 'http://ca.example.com/fr/',
'ca_de' => 'http://ca.example.com/de/',
// UK locales
'en' => 'http://uk.example.com/en/',
'gb_es' => 'http://uk.example.com/es/',
'gb_fr' => 'http://uk.example.com/fr/',
'gb_de' => 'http://uk.example.com/de/',
),
),
);