Merge pull request #897 from reitermarkus/os-language
Add language method to `OS::Mac`.
This commit is contained in:
commit
4fb691e175
@ -41,6 +41,10 @@ module OS
|
|||||||
version.to_sym
|
version.to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def language
|
||||||
|
@language ||= Utils.popen_read("defaults", "read", ".GlobalPreferences", "AppleLanguages").delete(" \n\"()").sub(/,.*/, "")
|
||||||
|
end
|
||||||
|
|
||||||
# Locates a (working) copy of install_name_tool, guaranteed to function
|
# Locates a (working) copy of install_name_tool, guaranteed to function
|
||||||
# whether the user has developer tools installed or not.
|
# whether the user has developer tools installed or not.
|
||||||
def install_name_tool
|
def install_name_tool
|
||||||
|
|||||||
8
Library/Homebrew/test/test_os_mac_language.rb
Normal file
8
Library/Homebrew/test/test_os_mac_language.rb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
require "testing_env"
|
||||||
|
require "os/mac"
|
||||||
|
|
||||||
|
class OSMacLanguageTests < Homebrew::TestCase
|
||||||
|
def test_language_format
|
||||||
|
assert_match %r{\A[a-z]{2}(-[A-Z]{2})?\Z}, OS::Mac.language
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user