Homebrew Cask problems with a second language

Today I was trying to update my cask homebrew packages but the Firefox cask shows an error, I found that there are other people with the same problem on github:
https://github.com/caskroom/homebrew-cask/issues/28684

But the problem is not only with the Firefox cask as you can see in GitHub all cask with language option has the same problem:

Error: 'es-419' cannot be parsed to a Locale while loading 'firefox' from '/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask/Casks/firefox.rb'  
Follow the instructions here:  
  https://github.com/caskroom/homebrew-cask/blob/master/doc/reporting_bugs/pre_bug_report.md

The partial solution is if you have more than one language on your system, remove the additional languages and leave just your primary language.
System Preferences > Language & Region

System Settings Language

Now the installation will be successful.