From 48dcf1916928999776df36882a553f15a9f0ffe7 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 19 Aug 2018 22:10:20 +0200 Subject: [PATCH] Ignore unparsable system languages. --- Library/Homebrew/cask/lib/hbc/dsl.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index 07d0c6ae1b..65c41d4614 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -138,7 +138,17 @@ module Hbc raise CaskInvalidError.new(cask, "No default language specified.") end - MacOS.languages.map(&Locale.method(:parse)).each do |locale| + locales = MacOS.languages + .map do |language| + begin + Locale.parse(language) + rescue Locale::ParserError + nil + end + end + .compact + + locales.each do |locale| key = locale.detect(@language_blocks.keys) next if key.nil?