Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

ReferenceError: IntlPolyfill is not defined #220

Closed
ghost opened this issue Aug 27, 2016 · 2 comments
Closed

ReferenceError: IntlPolyfill is not defined #220

ghost opened this issue Aug 27, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 27, 2016

I am trying to dynamically load the Intl polyfill and appropriate locale data in my browser HEAD, but I don't understand the error I am getting.

<script>
        function loadScript(src, callback) {
          var e = document.createElement('script')
          e.src = src
          e.onload = callback(src)
          document.head.appendChild(e)
        }

        if (!('Intl' in window) || true) {
          loadScript('../intl/dist/Intl.js', function(src) {
            console.log(src, 'loaded')
            var lang = Oxygen.Language.getLanguage('en', ['fr', 'en'])
            loadScript('../intl/locale-data/jsonp/' + lang + '.js', function(src) {
              console.log(src, 'loaded')
            })
          })
        }
</script>

In the browser I am seeing:

../intl/dist/Intl.js loaded
../intl/locale-data/jsonp/en.js loaded
Uncaught ReferenceError: IntlPolyfill is not defined
@ghost
Copy link
Author

ghost commented Aug 28, 2016

Ok, seems its a tiny performance issues. I was able to fix the problem by putting a tiny delay using setTimeout before loading the locale data.

@ghost ghost closed this as completed Aug 28, 2016
@caridy
Copy link
Collaborator

caridy commented Aug 30, 2016

dupe of #218

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant