Copy over getLocale() code from toolkit/mozapps/extensions/AddonManager.jsm that wraps calls with try/catch.