var formatLocale = require('./utils').formatLocale

function getLocale(locale) {
  if (locale) return locale

  if (global.Intl && typeof global.Intl.DateTimeFormat === 'function') {
    return global.Intl.DateTimeFormat().resolvedOptions && global.Intl.DateTimeFormat().resolvedOptions().locale
  }

  if (global.chrome && global.chrome.app && typeof global.chrome.app.getDetails === 'function') {
    locale = global.chrome.app.getDetails()

    if (locale) {
      return locale.current_locale
    }
  }

  locale = (global.clientInformation || global.navigator || Object.create(null)).language ||
           (global.navigator &&
             (global.navigator.userLanguage ||
             (global.navigator.languages && global.navigator.languages[0]) ||
             (global.navigator.userAgent && global.navigator.userAgent.match(/;.(\w+\-\w+)/i)[1])))

  if (!locale && ['LANG', 'LANGUAGE'].some(Object.hasOwnProperty, process.env)) {
    return (process.env.LANG ||
            process.env.LANGUAGE ||
            String()).replace(/[.:].*/, '')
                     .replace('_', '-')
  }

  return locale
}

var locale2 = function(locale) {
  return formatLocale(getLocale(locale))
}

exports.locale2 = locale2

@@ -107,199 +107,8 @@
 le%0A%0A
-  if (global.Intl && typeof global.Intl.DateTimeFormat === 'function') %7B%0A    return global.Intl.DateTimeFormat().resolvedOptions && global.Intl.DateTimeFormat().resolvedOptions().locale%0A  %7D%0A%0A
   if
@@ -661,16 +661,238 @@
 %5B1%5D)))%0A%0A
+  if (!locale) %7B%0A    if (global.Intl && typeof global.Intl.DateTimeFormat === 'function') %7B%0A      locale = global.Intl.DateTimeFormat().resolvedOptions && global.Intl.DateTimeFormat().resolvedOptions().locale%0A    %7D%0A    %0A  
   if (!l
@@ -965,24 +965,26 @@
 env)) %7B%0A    
+  
 return (proc
@@ -995,24 +995,26 @@
 env.LANG %7C%7C%0A
+  
             
@@ -1049,16 +1049,18 @@
         
+  
 String()
@@ -1104,16 +1104,18 @@
         
+ 
+ 
 .replace
@@ -1125,16 +1125,22 @@
 ', '-')%0A
+    %7D%0A
   %7D%0A%0A  r

Fix the priority