Merge pull request #14928 from dduugg/unglobal-i18n

Remove i18n use
This commit is contained in:
Mike McQuaid 2023-03-12 21:11:22 +00:00 committed by GitHub
commit e6d541612a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 27 additions and 29 deletions

View File

@ -2,7 +2,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require "formula" require "formula"
require "ostruct"
require "cli/parser" require "cli/parser"
require "cask/caskroom" require "cask/caskroom"
require "dependencies_helpers" require "dependencies_helpers"

View File

@ -1,7 +1,6 @@
# typed: true # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "ostruct"
require "caveats" require "caveats"
require "cli/parser" require "cli/parser"
require "unlink" require "unlink"

View File

@ -1,7 +1,6 @@
# typed: true # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "ostruct"
require "cli/parser" require "cli/parser"
require "unlink" require "unlink"

View File

@ -9,6 +9,7 @@ require "formula"
require "cli/parser" require "cli/parser"
require "cask/caskroom" require "cask/caskroom"
require "dependencies_helpers" require "dependencies_helpers"
require "ostruct"
module Homebrew module Homebrew
extend T::Sig extend T::Sig

View File

@ -2,7 +2,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require "formula" require "formula"
require "ostruct"
require "completions" require "completions"
require "manpages" require "manpages"

View File

@ -48,7 +48,7 @@ class Array
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
def to_sentence(words_connector: ", ", two_words_connector: " and ", last_word_connector: ", and ") def to_sentence(words_connector: ", ", two_words_connector: " and ", last_word_connector: " and ")
case length case length
when 0 when 0
+"" +""

View File

@ -7,8 +7,8 @@ require "English"
require "fileutils" require "fileutils"
require "json" require "json"
require "json/add/exception" require "json/add/exception"
require "ostruct"
require "forwardable" require "forwardable"
require "set"
# Only require "core_ext" here to ensure we're only requiring the minimum of # Only require "core_ext" here to ensure we're only requiring the minimum of
# what we need. # what we need.
@ -16,7 +16,6 @@ require "active_support/core_ext/object/blank"
require "active_support/core_ext/string/filters" require "active_support/core_ext/string/filters"
require "active_support/core_ext/object/try" require "active_support/core_ext/object/try"
require "active_support/core_ext/array/access" require "active_support/core_ext/array/access"
require "i18n"
require "active_support/core_ext/hash/except" require "active_support/core_ext/hash/except"
require "active_support/core_ext/kernel/reporting" require "active_support/core_ext/kernel/reporting"
require "active_support/core_ext/hash/keys" require "active_support/core_ext/hash/keys"
@ -26,9 +25,6 @@ require "active_support/core_ext/enumerable"
require "active_support/core_ext/string/exclude" require "active_support/core_ext/string/exclude"
require "active_support/core_ext/string/indent" require "active_support/core_ext/string/indent"
I18n.backend.available_locales # Initialize locales so they can be overwritten.
I18n.backend.store_translations :en, support: { array: { last_word_connector: " and " } }
HOMEBREW_API_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_API_DEFAULT_DOMAIN").freeze HOMEBREW_API_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_API_DEFAULT_DOMAIN").freeze
HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_BOTTLE_DEFAULT_DOMAIN").freeze HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_BOTTLE_DEFAULT_DOMAIN").freeze
HOMEBREW_BREW_DEFAULT_GIT_REMOTE = ENV.fetch("HOMEBREW_BREW_DEFAULT_GIT_REMOTE").freeze HOMEBREW_BREW_DEFAULT_GIT_REMOTE = ENV.fetch("HOMEBREW_BREW_DEFAULT_GIT_REMOTE").freeze
@ -148,8 +144,6 @@ rescue
nil nil
end.compact.freeze end.compact.freeze
require "set"
require "system_command" require "system_command"
require "exceptions" require "exceptions"
require "utils" require "utils"

View File

@ -4,7 +4,6 @@
require "keg_relocate" require "keg_relocate"
require "language/python" require "language/python"
require "lock_file" require "lock_file"
require "ostruct"
require "extend/cachable" require "extend/cachable"
# Installation prefix of a formula. # Installation prefix of a formula.

View File

@ -36,7 +36,6 @@ module Homebrew
markup = build_man_page(quiet: quiet) markup = build_man_page(quiet: quiet)
convert_man_page(markup, TARGET_DOC_PATH/"Manpage.md") convert_man_page(markup, TARGET_DOC_PATH/"Manpage.md")
markup = I18n.transliterate(markup, locale: :en)
convert_man_page(markup, TARGET_MAN_PATH/"brew.1") convert_man_page(markup, TARGET_MAN_PATH/"brew.1")
end end

View File

@ -2,7 +2,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require "open3" require "open3"
require "ostruct"
require "plist" require "plist"
require "shellwords" require "shellwords"

View File

@ -9,12 +9,12 @@ describe Array do
expect([].to_sentence).to eq("") expect([].to_sentence).to eq("")
expect(["one"].to_sentence).to eq("one") expect(["one"].to_sentence).to eq("one")
expect(["one", "two"].to_sentence).to eq("one and two") expect(["one", "two"].to_sentence).to eq("one and two")
expect(["one", "two", "three"].to_sentence).to eq("one, two, and three") expect(["one", "two", "three"].to_sentence).to eq("one, two and three")
end end
it "converts an array to a sentence with a custom connector" do it "converts an array to a sentence with a custom connector" do
expect(["one", "two", "three"].to_sentence(words_connector: " ")).to eq("one two, and three") expect(["one", "two", "three"].to_sentence(words_connector: " ")).to eq("one two and three")
expect(["one", "two", "three"].to_sentence(words_connector: " & ")).to eq("one & two, and three") expect(["one", "two", "three"].to_sentence(words_connector: " & ")).to eq("one & two and three")
end end
it "converts an array to a sentence with a custom last word connector" do it "converts an array to a sentence with a custom last word connector" do
@ -38,7 +38,7 @@ describe Array do
end end
it "converts an array with blank elements to a sentence" do it "converts an array with blank elements to a sentence" do
expect([nil, "one", "", "two", "three"].to_sentence).to eq(", one, , two, and three") expect([nil, "one", "", "two", "three"].to_sentence).to eq(", one, , two and three")
end end
it "does not return a frozen string" do it "does not return a frozen string" do

View File

@ -8,4 +8,14 @@ describe "brew", :integration_test do
.and not_to_output.to_stderr .and not_to_output.to_stderr
.and be_a_success .and be_a_success
end end
it "does not require i18n" do
# This is a transitive dependency of activesupport, but we don't use it.
expect { I18n }.to raise_error(NameError)
end
it "does not require ActiveSupport::Inflector" do
# ActiveSupport inflections are slow to load, so we don't use them.
expect { ActiveSupport::Inflector }.to raise_error(NameError)
end
end end

View File

@ -1014,7 +1014,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
resource do resource do
on_macos do on_macos do
^^^^^^^^^^^ `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version`, and `sha256` (in order). ^^^^^^^^^^^ `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order).
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
url "https://brew.sh/resource2.tar.gz" url "https://brew.sh/resource2.tar.gz"
end end
@ -1081,7 +1081,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
resource do resource do
on_macos do on_macos do
^^^^^^^^^^^ `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version`, and `sha256` (in order). ^^^^^^^^^^^ `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order).
if foo == :bar if foo == :bar
url "https://brew.sh/resource2.tar.gz" url "https://brew.sh/resource2.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
@ -1112,7 +1112,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
on_arm do on_arm do
^^^^^^^^^ `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version`, and `sha256` (in order). ^^^^^^^^^ `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order).
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"
url "https://brew.sh/resource2.tar.gz" url "https://brew.sh/resource2.tar.gz"
end end
@ -1158,7 +1158,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
end end
on_arm do on_arm do
^^^^^^^^^ `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version`, and `sha256` (in order). ^^^^^^^^^ `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order).
if foo == :bar if foo == :bar
url "https://brew.sh/resource2.tar.gz" url "https://brew.sh/resource2.tar.gz"
sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35"

View File

@ -542,7 +542,7 @@ __fish_brew_complete_arg 'contributions' -l debug -d 'Display any debugging info
__fish_brew_complete_arg 'contributions' -l from -d 'Date (ISO-8601 format) to start searching contributions' __fish_brew_complete_arg 'contributions' -l from -d 'Date (ISO-8601 format) to start searching contributions'
__fish_brew_complete_arg 'contributions' -l help -d 'Show this message' __fish_brew_complete_arg 'contributions' -l help -d 'Show this message'
__fish_brew_complete_arg 'contributions' -l quiet -d 'Make some output more quiet' __fish_brew_complete_arg 'contributions' -l quiet -d 'Make some output more quiet'
__fish_brew_complete_arg 'contributions' -l repositories -d 'Specify a comma-separated (no spaces) list of repositories to search. Supported repositories: `brew`, `core`, `cask`, `aliases`, `autoupdate`, `bundle`, `command-not-found`, `test-bot`, `services`, `cask-drivers`, `cask-fonts`, and `cask-versions`. Omitting this flag, or specifying `--repositories=all`, searches all repositories. Use `--repositories=primary` to search only the main repositories: brew,core,cask' __fish_brew_complete_arg 'contributions' -l repositories -d 'Specify a comma-separated (no spaces) list of repositories to search. Supported repositories: `brew`, `core`, `cask`, `aliases`, `autoupdate`, `bundle`, `command-not-found`, `test-bot`, `services`, `cask-drivers`, `cask-fonts` and `cask-versions`. Omitting this flag, or specifying `--repositories=all`, searches all repositories. Use `--repositories=primary` to search only the main repositories: brew,core,cask'
__fish_brew_complete_arg 'contributions' -l to -d 'Date (ISO-8601 format) to stop searching contributions' __fish_brew_complete_arg 'contributions' -l to -d 'Date (ISO-8601 format) to stop searching contributions'
__fish_brew_complete_arg 'contributions' -l user -d 'A GitHub username or email address of a specific person to find contribution data for' __fish_brew_complete_arg 'contributions' -l user -d 'A GitHub username or email address of a specific person to find contribution data for'
__fish_brew_complete_arg 'contributions' -l verbose -d 'Make some output more verbose' __fish_brew_complete_arg 'contributions' -l verbose -d 'Make some output more verbose'

View File

@ -671,7 +671,7 @@ _brew_contributions() {
'--from[Date (ISO-8601 format) to start searching contributions]' \ '--from[Date (ISO-8601 format) to start searching contributions]' \
'--help[Show this message]' \ '--help[Show this message]' \
'--quiet[Make some output more quiet]' \ '--quiet[Make some output more quiet]' \
'--repositories[Specify a comma-separated (no spaces) list of repositories to search. Supported repositories: `brew`, `core`, `cask`, `aliases`, `autoupdate`, `bundle`, `command-not-found`, `test-bot`, `services`, `cask-drivers`, `cask-fonts`, and `cask-versions`. Omitting this flag, or specifying `--repositories=all`, searches all repositories. Use `--repositories=primary` to search only the main repositories: brew,core,cask]' \ '--repositories[Specify a comma-separated (no spaces) list of repositories to search. Supported repositories: `brew`, `core`, `cask`, `aliases`, `autoupdate`, `bundle`, `command-not-found`, `test-bot`, `services`, `cask-drivers`, `cask-fonts` and `cask-versions`. Omitting this flag, or specifying `--repositories=all`, searches all repositories. Use `--repositories=primary` to search only the main repositories: brew,core,cask]' \
'--to[Date (ISO-8601 format) to stop searching contributions]' \ '--to[Date (ISO-8601 format) to stop searching contributions]' \
'--user[A GitHub username or email address of a specific person to find contribution data for]' \ '--user[A GitHub username or email address of a specific person to find contribution data for]' \
'--verbose[Make some output more verbose]' '--verbose[Make some output more verbose]'

View File

@ -1116,7 +1116,7 @@ Display the path to the file being used when invoking `brew` *`cmd`*.
Contributions to Homebrew repos. Contributions to Homebrew repos.
* `--repositories`: * `--repositories`:
Specify a comma-separated (no spaces) list of repositories to search. Supported repositories: `brew`, `core`, `cask`, `aliases`, `autoupdate`, `bundle`, `command-not-found`, `test-bot`, `services`, `cask-drivers`, `cask-fonts`, and `cask-versions`. Omitting this flag, or specifying `--repositories=all`, searches all repositories. Use `--repositories=primary` to search only the main repositories: brew,core,cask. Specify a comma-separated (no spaces) list of repositories to search. Supported repositories: `brew`, `core`, `cask`, `aliases`, `autoupdate`, `bundle`, `command-not-found`, `test-bot`, `services`, `cask-drivers`, `cask-fonts` and `cask-versions`. Omitting this flag, or specifying `--repositories=all`, searches all repositories. Use `--repositories=primary` to search only the main repositories: brew,core,cask.
* `--from`: * `--from`:
Date (ISO-8601 format) to start searching contributions. Date (ISO-8601 format) to start searching contributions.
* `--to`: * `--to`:

View File

@ -1603,7 +1603,7 @@ Contributions to Homebrew repos\.
. .
.TP .TP
\fB\-\-repositories\fR \fB\-\-repositories\fR
Specify a comma\-separated (no spaces) list of repositories to search\. Supported repositories: \fBbrew\fR, \fBcore\fR, \fBcask\fR, \fBaliases\fR, \fBautoupdate\fR, \fBbundle\fR, \fBcommand\-not\-found\fR, \fBtest\-bot\fR, \fBservices\fR, \fBcask\-drivers\fR, \fBcask\-fonts\fR, and \fBcask\-versions\fR\. Omitting this flag, or specifying \fB\-\-repositories=all\fR, searches all repositories\. Use \fB\-\-repositories=primary\fR to search only the main repositories: brew,core,cask\. Specify a comma\-separated (no spaces) list of repositories to search\. Supported repositories: \fBbrew\fR, \fBcore\fR, \fBcask\fR, \fBaliases\fR, \fBautoupdate\fR, \fBbundle\fR, \fBcommand\-not\-found\fR, \fBtest\-bot\fR, \fBservices\fR, \fBcask\-drivers\fR, \fBcask\-fonts\fR and \fBcask\-versions\fR\. Omitting this flag, or specifying \fB\-\-repositories=all\fR, searches all repositories\. Use \fB\-\-repositories=primary\fR to search only the main repositories: brew,core,cask\.
. .
.TP .TP
\fB\-\-from\fR \fB\-\-from\fR
@ -3454,7 +3454,7 @@ Homebrew API: \fIhttps://rubydoc\.brew\.sh\fR
Homebrew\'s Project Leader is Mike McQuaid\. Homebrew\'s Project Leader is Mike McQuaid\.
. .
.P .P
Homebrew\'s Project Leadership Committee is Colin Dean, Issy Long, Jonathan Chang, Mike McQuaid, Misty De Meo, and Sean Molenaar\. Homebrew\'s Project Leadership Committee is Colin Dean, Issy Long, Jonathan Chang, Mike McQuaid, Misty De Méo, and Sean Molenaar\.
. .
.P .P
Homebrew\'s Technical Steering Committee is Bo Anderson, FX Coudert, Michka Popoff, Mike McQuaid, and Rylan Polster\. Homebrew\'s Technical Steering Committee is Bo Anderson, FX Coudert, Michka Popoff, Mike McQuaid, and Rylan Polster\.
@ -3463,7 +3463,7 @@ Homebrew\'s Technical Steering Committee is Bo Anderson, FX Coudert, Michka Popo
Homebrew\'s maintainers are Alexander Bayandin, Bevan Kay, Bo Anderson, Branch Vincent, Caleb Xu, Carlo Cabrera, Daniel Nachun, Dawid Dziurla, Dustin Rodrigues, Eric Knibbe, FX Coudert, George Adams, Issy Long, Markus Reiter, Miccal Matthews, Michael Cho, Michka Popoff, Mike McQuaid, Nanda H Krishna, Patrick Linnane, Rui Chen, Ruoyu Zhong, Rylan Polster, Sam Ford, Sean Molenaar, and Thierry Moisan\. Homebrew\'s maintainers are Alexander Bayandin, Bevan Kay, Bo Anderson, Branch Vincent, Caleb Xu, Carlo Cabrera, Daniel Nachun, Dawid Dziurla, Dustin Rodrigues, Eric Knibbe, FX Coudert, George Adams, Issy Long, Markus Reiter, Miccal Matthews, Michael Cho, Michka Popoff, Mike McQuaid, Nanda H Krishna, Patrick Linnane, Rui Chen, Ruoyu Zhong, Rylan Polster, Sam Ford, Sean Molenaar, and Thierry Moisan\.
. .
.P .P
Former maintainers with significant contributions include Misty De Meo, Shaun Jackman, Vitor Galvao, Claudia Pellegrino, Seeker, William Woodruff, Jan Viljanen, JCount, commitay, Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs, Chongyu Zhu and Homebrew\'s creator: Max Howell\. Former maintainers with significant contributions include Misty De Méo, Shaun Jackman, Vítor Galvão, Claudia Pellegrino, Seeker, William Woodruff, Jan Viljanen, JCount, commitay, Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs, Chongyu Zhu and Homebrew\'s creator: Max Howell\.
. .
.SH "BUGS" .SH "BUGS"
See our issues on GitHub: See our issues on GitHub: