function loadLocaleMessages() 
{
  const messages = {}

  // Full locale match (e.g. fi-FI)
  tryLoadLocaleMessage(messages, navigator.language);

  // Language match (e.g. fi)
  if (navigator.language.indexOf('-') >= 0)
    tryLoadLocaleMessage(messages, navigator.language.split('-')[0]);

  // Fallback language (e.g. en)
  tryLoadLocaleMessage(messages, fallbackLocale);

  // If no languages were loaded then use fallback language as the active language 
  // although that was not loaded so the ultimate fallback will be the key values
  if (!activeLocale)
    activeLocale = fallbackLocale;

  return messages
}
// Local resources. Load only those resources matching browser's language and the fallback language
Local resources. Load only those resources matching browser's language and the fallback language
Local resources . Load only those resources matching browser ' s language and the fallback language
function loadLocaleMessages() 
{
  const messages = {}
  tryLoadLocaleMessage(messages, navigator.language);
  if (navigator.language.indexOf('-') >= 0)
    tryLoadLocaleMessage(messages, navigator.language.split('-')[0]);
  tryLoadLocaleMessage(messages, fallbackLocale);
  if (!activeLocale)
    activeLocale = fallbackLocale;
  return messages
}
function loadLocaleMessages ( ) { const messages = { } tryLoadLocaleMessage ( messages , navigator . language ) ; if ( navigator . language . indexOf ( '-' ) >= 0 ) tryLoadLocaleMessage ( messages , navigator . language . split ( '-' ) [ 0 ] ) ; tryLoadLocaleMessage ( messages , fallbackLocale ) ; if ( ! activeLocale ) activeLocale = fallbackLocale ; return messages }
Local resources.
Local resources .
// Full locale match (e.g. fi-FI) // Language match (e.g. fi) // Fallback language (e.g. en) // If no languages were loaded then use fallback language as the active language  // although that was not loaded so the ultimate fallback will be the key values