repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/support/strip_ansi_escape.rb
spec/support/strip_ansi_escape.rb
# frozen_string_literal: true # Stolen from https://github.com/sickill/rainbow/pull/54 def strip_ansi_escape(string) string.gsub(/\e\[[0-9;]*[a-zA-Z]/, "") end
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/support/capture_std.rb
spec/support/capture_std.rb
# frozen_string_literal: true require "active_support/testing/stream" module CaptureStd include ActiveSupport::Testing::Stream if defined?(ActiveSupport::Testing::Stream) def capture_stderr return yield if ENV["NOSILENCE"] begin err = $stderr $stderr = StringIO.new yield $stderr....
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/support/trees.rb
spec/support/trees.rb
# frozen_string_literal: true module Trees def expect_node_key_data(node, key, data) expect(node.full_key(root: false)).to eq key expect(node.data).to eq adjust_occurrences(data) end def build_tree(hash) I18n::Tasks::Data::Tree::Siblings.from_nested_hash(hash) end def build_node(attr = {}) ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/support/key_pattern_matcher.rb
spec/support/key_pattern_matcher.rb
# frozen_string_literal: true RSpec::Matchers.define :match_key do |key| include I18n::Tasks::KeyPatternMatching match do |pattern| expect(compile_key_pattern(pattern)).to match(key) end end
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/support/i18n_tasks_output_matcher.rb
spec/support/i18n_tasks_output_matcher.rb
# frozen_string_literal: true RSpec::Matchers.define :be_i18n_keys do |expected| def locale_re /^\w{2}\b/ end def extract_keys(actual) actual = strip_ansi_escape(actual).split("\n").map(&:presence).compact actual = actual[3..-2] actual = actual.map do |row| row[1..].gsub(/(?:\s+|^)\|(?:\s+...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/fixtures/prism_controller.rb
spec/fixtures/prism_controller.rb
# frozen_string_literal: true module Prism class PrismController < ApplicationController class EmptyClass end before_action(:authenticate_user!) def index @statistics = {total_time: 0, by_kind: {}, label: t(".label")} return "what" if @statistics[:total_time] == 0 @statisti...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/fixtures/app/controllers/events_controller.rb
spec/fixtures/app/controllers/events_controller.rb
class EventsController < ApplicationController def create end def show() redirect_to :edit, notice: I18n.t('cb.a') # args are ignored I18n.t("cb.b", i: "Hello") # patterns that should not be reported as unused in dynamic mode I18n.t("hash.pattern.#{some_value}", i: "Hello") I18n.t("hash...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/fixtures/used_keys/a.rb
spec/fixtures/used_keys/a.rb
class A def what t('a') end def whot I18n.t('a') end def self.whot # i18n-tasks-use t('service.what') Service.translate(:what) I18n.t('activerecord.attributes.absolute.attribute') translate('activerecord.attributes.absolute.attribute') Archive.human_attribute_name(:name) User...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/fixtures/used_keys/app/controllers/events_controller.rb
spec/fixtures/used_keys/app/controllers/events_controller.rb
# i18n-tasks-skip-prism class EventsController < ApplicationController before_action(:method_a) def create t(".relative_key") t("absolute_key") I18n.t("very_absolute_key") end private def method_a t(".from_before_action") end end
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/fixtures/used_keys/app/components/event_component.rb
spec/fixtures/used_keys/app/components/event_component.rb
class EventComponent < ViewComponent::Base def whatever t(".key") t("absolute_key") end end
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/fixtures/used_keys/app/mailers/user_mailer.rb
spec/fixtures/used_keys/app/mailers/user_mailer.rb
class UserMailer < ApplicationMailer def welcome_notification I18n.with_locale(:en) do mail subject: default_i18n_subject end end end
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/fixtures/lib/my_custom_scanner.rb
spec/fixtures/lib/my_custom_scanner.rb
require 'i18n/tasks/scanners/file_scanner' class MyCustomScanner < I18n::Tasks::Scanners::FileScanner include I18n::Tasks::Scanners::RelativeKeys include I18n::Tasks::Scanners::OccurrenceFromPosition # @return [Array<[absolute key, Results::Occurrence]>] def scan_file(path) text = read_file(path) text....
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/fixtures/lib/test_i18n_plugin.rb
spec/fixtures/lib/test_i18n_plugin.rb
# An i18n-tasks plugin to test that the plugin system works. module TestI18nPlugin include ::I18n::Tasks::Command::Collection cmd :greet, desc: 'print "Hello, %{name}"', args: [['-n', '--name NAME', 'name']] def greet(opts = {}) puts "Hello, #{opts[:name]}" end end ::I18n::Tasks.add_commands ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/commands/reserved_commands_spec.rb
spec/commands/reserved_commands_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Reserved commands" do delegate :run_cmd, :in_test_app_dir, to: :TestCodebase let(:base_keys) do {"a" => "hello %{object}", "b" => "foo %{bar}", "c" => {"d" => "hello %{object}"}, "e" => "ok"} end let(:test_keys) do {"a" => "hello %{o...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/commands/missing_commands_spec.rb
spec/commands/missing_commands_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Missing commands" do delegate :run_cmd, to: :TestCodebase let(:missing_keys) { {"a" => "A", "ref" => :ref} } let(:config) { {base_locale: "en", locales: %w[es fr]} } around do |ex| TestCodebase.setup( "config/i18n-tasks.yml" => co...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/commands/data_commands_spec.rb
spec/commands/data_commands_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Data commands" do delegate :run_cmd, :in_test_app_dir, to: :TestCodebase def en_data {"en" => {"a" => "1", "common" => {"hello" => "Hello"}}} end def en_data2 {"en" => {"common" => {"hi" => "Hi"}}} end before do TestCodebase...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/commands/prune_commands_spec.rb
spec/commands/prune_commands_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Prune commands" do delegate :run_cmd, to: :TestCodebase let(:locale_data) do { "en" => { "hello" => "Hello", "en_only" => "This key exists only in English" }, "fr" => { "hello" => "Bonjour", ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/commands/tree_commands_spec.rb
spec/commands/tree_commands_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Tree commands" do delegate :run_cmd, to: :TestCodebase before do TestCodebase.setup end after do TestCodebase.teardown end context "tree-merge" do trees = [{"a" => "1", "b" => "2"}, {"a" => "-1", "c" => "3"}] it trees.ma...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/commands/inconsistent_commands_spec.rb
spec/commands/inconsistent_commands_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Inconsistent commands" do delegate :run_cmd, :in_test_app_dir, to: :TestCodebase let(:base_keys) { {"a" => "hello %{world}", "b" => "foo", "c" => {"d" => "hello %{name}"}, "e" => "ok"} } let(:test_keys) { {"a" => "hello", "b" => "foo %{bar}", ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/translators/deepl_translate_spec.rb
spec/translators/deepl_translate_spec.rb
# frozen_string_literal: true require "spec_helper" require "i18n/tasks/commands" require "deepl" RSpec.describe "DeepL Translation" do nil_value_test = ["nil-value-key", nil, nil] text_test = ["key", "Hello, %{user} O'Neill! How are you?", "¡Hola, %{user} O'Neill! ¿Qué tal estás?"] html_test_plrl = ["html-key....
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/translators/google_translate_spec.rb
spec/translators/google_translate_spec.rb
# frozen_string_literal: true require "spec_helper" require "i18n/tasks/commands" RSpec.describe "Google Translation" do nil_value_test = ["nil-value-key", nil, nil] empty_value_test = ["empty-value-key", "", ""] text_test = ["hello", "Hello, %{user} O'Neill!", "¡Hola, %{user} O'Neill!"] text_test_multiline =...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/translators/base_translator_spec.rb
spec/translators/base_translator_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Base Translator" do let(:task) { I18n::Tasks::BaseTask.new } # Create a fake translator that raises for html slices let(:translator_class) do Class.new(I18n::Tasks::Translators::BaseTranslator) do def translate_values(list, **options...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/scanners/ruby_key_literals_spec.rb
spec/scanners/ruby_key_literals_spec.rb
# frozen_string_literal: true require "spec_helper" require "i18n/tasks/scanners/ruby_key_literals" RSpec.describe "RubyKeyLiterals" do let(:scanner) do Object.new.extend I18n::Tasks::Scanners::RubyKeyLiterals end describe "#valid_key?" do it "allows forward slash in key" do expect(scanner).to be...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/scanners/pattern_mapper_spec.rb
spec/scanners/pattern_mapper_spec.rb
# frozen_string_literal: true require "spec_helper" require "i18n/tasks/scanners/pattern_mapper" RSpec.describe "PatternMapper" do describe "#scan" do let(:mock_file_path) do "app/views/main/index.html" end let(:mock_file_contents) { <<-ERB } <%= title %> <%= Spree.t 'x' %> <%= S...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/scanners/scanner_multiplexer_spec.rb
spec/scanners/scanner_multiplexer_spec.rb
# frozen_string_literal: true require "spec_helper" require "i18n/tasks/scanners/scanner_multiplexer" RSpec.describe "ScannerMultiplexer" do describe "#keys" do let(:key_a) { make_key_occurrences "key.a", [{path: "a"}] } let(:key_b1) { make_key_occurrences "key.b", [{path: "b1"}] } let(:key_b2) { make_k...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/scanners/files/file_finder_spec.rb
spec/scanners/files/file_finder_spec.rb
# frozen_string_literal: true require "spec_helper" require "i18n/tasks/scanners/files/file_finder" RSpec.describe "FileFinder" do let(:test_files) do %w[a/a/a/a.txt a/a/a.txt a/a/b.txt a/b/a.txt a/b/b.txt a.txt] end around do |ex| TestCodebase.setup(test_files.each_with_object({}) { |f, h| h[f] = "" }...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/scanners/files/caching_file_finder_spec.rb
spec/scanners/files/caching_file_finder_spec.rb
# frozen_string_literal: true require "spec_helper" require "i18n/tasks/scanners/files/caching_file_finder" RSpec.describe "CachingFileFinder" do let(:test_files) do %w[a/a/a/a.txt a/a/a.txt a/a/b.txt a/b/a.txt a/b/b.txt a.txt] end describe "#find_files" do it "accesses the filesystem only once" do ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/scanners/files/file_reader_spec.rb
spec/scanners/files/file_reader_spec.rb
# frozen_string_literal: true require "spec_helper" require "i18n/tasks/scanners/files/file_reader" RSpec.describe "FileReader" do describe "#read_file" do around do |ex| TestCodebase.setup("test.txt" => "test") TestCodebase.in_test_app_dir { ex.call } TestCodebase.teardown end it "re...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/scanners/files/caching_file_finder_provider_spec.rb
spec/scanners/files/caching_file_finder_provider_spec.rb
# frozen_string_literal: true require "spec_helper" require "i18n/tasks/scanners/files/caching_file_finder_provider" RSpec.describe "CachingFileFinderProvider" do describe "#get" do it "provides the same instance for the same arguments" do provider = I18n::Tasks::Scanners::Files::CachingFileFinderProvider...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/scanners/files/caching_file_reader_spec.rb
spec/scanners/files/caching_file_reader_spec.rb
# frozen_string_literal: true require "spec_helper" require "i18n/tasks/scanners/files/caching_file_reader" RSpec.describe "CachingFileReader" do describe "#read_file" do around do |ex| TestCodebase.setup("test.txt" => "test") TestCodebase.in_test_app_dir { ex.call } TestCodebase.teardown ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/locale_tree/siblings_spec.rb
spec/locale_tree/siblings_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Tree siblings / forest" do context "Node" do it "::new with children" do children = I18n::Tasks::Data::Tree::Siblings.from_key_attr([["a", {value: 1}]]) node = new_node( key: "fr", children: children ) ex...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/spec/locale_tree/traversal_spec.rb
spec/locale_tree/traversal_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe I18n::Tasks::Data::Tree::Traversal do delegate :i18n_task, to: :TestCodebase before do TestCodebase.setup fixtures_contents end after do TestCodebase.teardown end describe "#grep_keys" do it "returns Siblings" do expec...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/templates/minitest/i18n_test.rb
templates/minitest/i18n_test.rb
# frozen_string_literal: true require "i18n/tasks" class I18nTest < ActiveSupport::TestCase def setup @i18n = I18n::Tasks::BaseTask.new end def test_no_missing_keys missing_keys = @i18n.missing_keys assert_empty missing_keys, "Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks mi...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/templates/rspec/i18n_spec.rb
templates/rspec/i18n_spec.rb
# frozen_string_literal: true require "i18n/tasks" RSpec.describe I18n do let(:i18n) { I18n::Tasks::BaseTask.new } let(:missing_keys) { i18n.missing_keys } let(:unused_keys) { i18n.unused_keys } let(:inconsistent_interpolations) { i18n.inconsistent_interpolations } it "does not have missing keys" do ex...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks.rb
lib/i18n/tasks.rb
# frozen_string_literal: true # define all the modules to be able to use :: module I18n module Tasks class << self def gem_path File.expand_path(File.join(File.dirname(__FILE__), "..", "..")) end def verbose? @verbose end attr_writer :verbose # Add a scanner...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data.rb
lib/i18n/tasks/data.rb
# frozen_string_literal: true require "i18n/tasks/data/file_system" module I18n::Tasks module Data DATA_DEFAULTS = { adapter: "I18n::Tasks::Data::FileSystem" }.freeze # I18n data provider # @see I18n::Tasks::Data::FileSystem def data @data ||= begin data_config = (config[:da...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/version.rb
lib/i18n/tasks/version.rb
# frozen_string_literal: true module I18n module Tasks VERSION = "1.1.2" end end
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/html_keys.rb
lib/i18n/tasks/html_keys.rb
# frozen_string_literal: true module I18n::Tasks module HtmlKeys HTML_KEY_PATTERN = /[.\-_]html\z/ MAYBE_PLURAL_HTML_KEY_PATTERN = /[.\-_]html\.[^.]+\z/ def html_key?(full_key, locale) !!(full_key =~ HTML_KEY_PATTERN || (full_key =~ MAYBE_PLURAL_HTML_KEY_PATTERN && deplural...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/base_task.rb
lib/i18n/tasks/base_task.rb
# frozen_string_literal: true require "i18n/tasks/command_error" require "i18n/tasks/split_key" require "i18n/tasks/key_pattern_matching" require "i18n/tasks/logging" require "i18n/tasks/plural_keys" require "i18n/tasks/references" require "i18n/tasks/html_keys" require "i18n/tasks/used_keys" require "i18n/tasks/ignor...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command_error.rb
lib/i18n/tasks/command_error.rb
# frozen_string_literal: true module I18n module Tasks # When this type of error is caught: # 1. show error message of the backtrace # 2. exit with non-zero exit code class CommandError < StandardError def initialize(error = nil, message) # rubocop:disable Style/OptionalArguments super(...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/translation.rb
lib/i18n/tasks/translation.rb
# frozen_string_literal: true require "i18n/tasks/translators/deepl_translator" require "i18n/tasks/translators/google_translator" require "i18n/tasks/translators/openai_translator" require "i18n/tasks/translators/watsonx_translator" require "i18n/tasks/translators/yandex_translator" module I18n::Tasks module Trans...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/plural_keys.rb
lib/i18n/tasks/plural_keys.rb
# frozen_string_literal: true require "set" module I18n::Tasks::PluralKeys # Ref: http://cldr.unicode.org/index/cldr-spec/plural-rules CLDR_CATEGORY_KEYS = %w[zero one two few many other].freeze PLURAL_KEY_SUFFIXES = Set.new CLDR_CATEGORY_KEYS PLURAL_KEY_RE = /\.(?:#{CLDR_CATEGORY_KEYS * "|"})$/ # Ref: https...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/logging.rb
lib/i18n/tasks/logging.rb
# frozen_string_literal: true module I18n::Tasks::Logging module_function MUTEX = Mutex.new PROGRAM_NAME = File.basename($PROGRAM_NAME) def warn_deprecated(message) log_stderr Rainbow("#{program_name}: [DEPRECATED] #{message}").yellow.bright end def log_verbose(message = nil) log_stderr Rainbow(...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/console_context.rb
lib/i18n/tasks/console_context.rb
# frozen_string_literal: true module I18n::Tasks class ConsoleContext < BaseTask def to_s @to_s ||= "i18n-tasks-#{I18n::Tasks::VERSION}" end def banner puts Messages.banner end def guide puts Messages.guide end class << self def start require "irb" ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/unused_keys.rb
lib/i18n/tasks/unused_keys.rb
# frozen_string_literal: true require "set" module I18n module Tasks module UnusedKeys def unused_keys(locales: nil, strict: nil) locales = Array(locales).presence || self.locales locales.map { |locale| unused_tree(locale: locale, strict: strict) }.compact.reduce(:merge!) end ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/string_interpolation.rb
lib/i18n/tasks/string_interpolation.rb
# frozen_string_literal: true module I18n::Tasks module StringInterpolation module_function def interpolate_soft(s, t = {}) return s unless s t.each do |k, v| pat = "%{#{k}}" s = s.gsub pat, v.to_s if s.include?(pat) end s end end end
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/prune.rb
lib/i18n/tasks/prune.rb
# frozen_string_literal: true module I18n::Tasks::Prune def prunable_keys(base_locale:, locales:) diff_forest = empty_forest locales.each do |locale| # Based on the docs, missing_diff_tree only returns keys that are in the second argument but not in the first locale_forest = missing_diff_...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/stats.rb
lib/i18n/tasks/stats.rb
# frozen_string_literal: true module I18n::Tasks module Stats def forest_stats(forest) key_count = forest.leaves.count locale_count = forest.count if key_count.zero? {key_count: 0} else { locales: forest.map(&:key).join(", "), key_count: key_count, ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/split_key.rb
lib/i18n/tasks/split_key.rb
# frozen_string_literal: true module I18n module Tasks module SplitKey module_function PARENTHESIS_PAIRS = %w({} [] () <>).freeze START_KEYS = PARENTHESIS_PAIRS.to_set { |pair| pair[0] }.freeze END_KEYS = PARENTHESIS_PAIRS.to_h { |pair| [pair[0], pair[1]] }.freeze private_constant ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/used_keys.rb
lib/i18n/tasks/used_keys.rb
# frozen_string_literal: true require "find" require "i18n/tasks/scanners/pattern_with_scope_scanner" require "i18n/tasks/scanners/ruby_scanner" require "i18n/tasks/scanners/erb_ast_scanner" require "i18n/tasks/scanners/scanner_multiplexer" require "i18n/tasks/scanners/files/caching_file_finder_provider" require "i18n...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/interpolations.rb
lib/i18n/tasks/interpolations.rb
# frozen_string_literal: true module I18n::Tasks module Interpolations class << self attr_accessor :variable_regex end @variable_regex = /(?<!%)%{[^}]+}/ def inconsistent_interpolations(locales: nil, base_locale: nil) # rubocop:disable Metrics/AbcSize locales ||= self.locales base_...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/configuration.rb
lib/i18n/tasks/configuration.rb
# frozen_string_literal: true module I18n::Tasks::Configuration # rubocop:disable Metrics/ModuleLength DEFAULTS = { base_locale: "en", internal_locale: "en", search: ::I18n::Tasks::UsedKeys::SEARCH_DEFAULTS, data: ::I18n::Tasks::Data::DATA_DEFAULTS, translation_backend: :google }.freeze # i1...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/missing_keys.rb
lib/i18n/tasks/missing_keys.rb
# frozen_string_literal: true require "set" module I18n::Tasks module MissingKeys # rubocop:disable Metrics/ModuleLength MISSING_TYPES = %w[ used diff plural ].freeze def self.missing_keys_types @missing_keys_types ||= MISSING_TYPES end def missing_keys_types Missi...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/cli.rb
lib/i18n/tasks/cli.rb
# frozen_string_literal: true require "i18n/tasks" require "i18n/tasks/commands" require "optparse" class I18n::Tasks::CLI include ::I18n::Tasks::Logging def self.start(argv) new.start(argv) end def start(argv) load_dotenv auto_output_coloring do exit 1 if run(argv) == :exit1 rescue O...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/commands.rb
lib/i18n/tasks/commands.rb
# frozen_string_literal: true require "i18n/tasks/command/dsl" require "i18n/tasks/command/collection" require "i18n/tasks/command/commands/health" require "i18n/tasks/command/commands/missing" require "i18n/tasks/command/commands/usages" require "i18n/tasks/command/commands/interpolations" require "i18n/tasks/command...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/references.rb
lib/i18n/tasks/references.rb
# frozen_string_literal: true module I18n::Tasks module References # Given a raw usage tree and a tree of reference keys in the data, return 3 trees: # 1. Raw references -- a subset of the usages tree with keys that are reference key usages. # 2. Resolved references -- all the used references in their fu...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/locale_list.rb
lib/i18n/tasks/locale_list.rb
# frozen_string_literal: true module I18n::Tasks module LocaleList module_function # @return locales converted to strings, with base locale first, the rest sorted alphabetically def normalize_locale_list(locales, base_locale, include_base = false) locales = Array(locales).map(&:to_s).sort if...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/locale_pathname.rb
lib/i18n/tasks/locale_pathname.rb
# frozen_string_literal: true module I18n::Tasks module LocalePathname class << self def replace_locale(path, from, to) path&.gsub(path_locale_re(from), to) end private def path_locale_re(locale) (@path_locale_res ||= {})[locale] ||= %r{(?<=^|[/.-])#{locale}(?=[/.])} ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/ignore_keys.rb
lib/i18n/tasks/ignore_keys.rb
# frozen_string_literal: true module I18n::Tasks::IgnoreKeys # whether to ignore the key # will also apply global ignore rules # @param [:missing, :unused, :eq_base] ignore_type def ignore_key?(key, ignore_type, locale = nil) key =~ ignore_pattern(ignore_type, locale) end # @param type [nil, :missing,...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/key_pattern_matching.rb
lib/i18n/tasks/key_pattern_matching.rb
# frozen_string_literal: true require "strscan" module I18n::Tasks::KeyPatternMatching extend self # rubocop:disable Style/ModuleFunction MATCH_NOTHING = /\z\A/ # one regex to match any def compile_patterns_re(key_patterns) if key_patterns.blank? # match nothing MATCH_NOTHING else ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/collection.rb
lib/i18n/tasks/command/collection.rb
# frozen_string_literal: true require "i18n/tasks/command/dsl" require "i18n/tasks/command/options/common" require "i18n/tasks/command/options/locales" require "i18n/tasks/command/options/data" module I18n::Tasks module Command module Collection def self.included(base) base.module_eval do ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/dsl.rb
lib/i18n/tasks/command/dsl.rb
# frozen_string_literal: true module I18n::Tasks module Command module DSL def self.included(base) base.module_eval do @dsl = Hash.new { |h, k| h[k] = {} } extend ClassMethods end end def t(*args, **kwargs) I18n.t(*args, **kwargs) end mo...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commander.rb
lib/i18n/tasks/command/commander.rb
# frozen_string_literal: true require "i18n/tasks/cli" require "i18n/tasks/reports/terminal" module I18n::Tasks module Command class Commander include ::I18n::Tasks::Logging attr_reader :i18n # @param [I18n::Tasks::BaseTask] i18n def initialize(i18n) @i18n = i18n end ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/options/data.rb
lib/i18n/tasks/command/options/data.rb
# frozen_string_literal: true require "i18n/tasks/command/option_parsers/enum" module I18n::Tasks module Command module Options module Data include Command::DSL DATA_FORMATS = %w[yaml json keys].freeze OUT_FORMATS = ["terminal-table", *DATA_FORMATS, "inspect", "key-values"].freeze...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/options/common.rb
lib/i18n/tasks/command/options/common.rb
# frozen_string_literal: true require "i18n/tasks/command/dsl" module I18n::Tasks module Command module Options module Common include Command::DSL arg :nostdin, "-S", "--nostdin", t("i18n_tasks.cmd.args.desc.nostdin") arg :confirm, "-y", ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/options/locales.rb
lib/i18n/tasks/command/options/locales.rb
# frozen_string_literal: true require "i18n/tasks/command/option_parsers/locale" require "i18n/tasks/command/option_parsers/enum" module I18n::Tasks module Command module Options module Locales include Command::DSL arg :locales, "-l", "--locales en,es,ru", Ar...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commands/data.rb
lib/i18n/tasks/command/commands/data.rb
# frozen_string_literal: true module I18n::Tasks module Command module Commands module Data include Command::Collection arg :pattern_router, "-p", "--pattern_router", t("i18n_tasks.cmd.args.desc.pattern_router") cmd :normalize, pos: "[locale...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commands/meta.rb
lib/i18n/tasks/command/commands/meta.rb
# frozen_string_literal: true module I18n::Tasks module Command module Commands module Meta include Command::Collection cmd :config, pos: "[section ...]", desc: t("i18n_tasks.cmd.desc.config") def config(opts = {}) cfg = i18n.config_for_inspect ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commands/tree.rb
lib/i18n/tasks/command/commands/tree.rb
# frozen_string_literal: true module I18n::Tasks module Command module Commands module Tree include Command::Collection include I18n::Tasks::KeyPatternMatching cmd :tree_translate, pos: "[tree (or stdin)]", desc: t("i18n_tasks.cmd.desc.tree_translate"), ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commands/prune.rb
lib/i18n/tasks/command/commands/prune.rb
module I18n::Tasks module Command module Commands module Prune include ::I18n::Tasks::Command::Collection cmd :prune, desc: t("i18n_tasks.cmd.desc.prune"), args: %i[confirm] def prune(opts = {}) diff_forest = i18n.prunable_keys( base_locale: i18n.base_locale, ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commands/eq_base.rb
lib/i18n/tasks/command/commands/eq_base.rb
# frozen_string_literal: true module I18n::Tasks module Command module Commands module EqBase include Command::Collection cmd :eq_base, pos: "[locale ...]", desc: t("i18n_tasks.cmd.desc.eq_base"), args: %i[locales out_format] def eq_base(opt = {}) ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commands/missing.rb
lib/i18n/tasks/command/commands/missing.rb
# frozen_string_literal: true require "i18n/tasks/command/collection" module I18n::Tasks module Command module Commands module Missing include Command::Collection missing_types = I18n::Tasks::MissingKeys.missing_keys_types arg :missing_types, "-t", "--types #{m...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commands/interpolations.rb
lib/i18n/tasks/command/commands/interpolations.rb
# frozen_string_literal: true module I18n::Tasks module Command module Commands module Interpolations include Command::Collection cmd :check_consistent_interpolations, pos: "[locale ...]", desc: t("i18n_tasks.cmd.desc.check_consistent_interpolations"), args: %...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commands/health.rb
lib/i18n/tasks/command/commands/health.rb
# frozen_string_literal: true module I18n::Tasks module Command module Commands module Health include Command::Collection cmd :health, pos: "[locale ...]", desc: t("i18n_tasks.cmd.desc.health"), args: %i[locales out_format config] def health(opt = {})...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commands/usages.rb
lib/i18n/tasks/command/commands/usages.rb
# frozen_string_literal: true module I18n::Tasks module Command module Commands module Usages include Command::Collection arg :strict, "--[no-]strict", t("i18n_tasks.cmd.args.desc.strict") arg :keep_order, "-k", "--keep-order", t("...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/commands/check_prism.rb
lib/i18n/tasks/command/commands/check_prism.rb
# frozen_string_literal: true module I18n::Tasks module Command module Commands module CheckPrism include Command::Collection arg :prism_mode, "--prism_mode MODE", "Prism parser mode: 'rails' or 'ruby'. Defaults to 'rails' if Rails is available in the project, otherwise...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/option_parsers/locale.rb
lib/i18n/tasks/command/option_parsers/locale.rb
# frozen_string_literal: true module I18n::Tasks module Command module OptionParsers module Locale module Validator VALID_LOCALE_RE = /\A\w[\w\-.]*\z/i def validate!(locale) if VALID_LOCALE_RE !~ locale fail CommandError, I18n.t("i18n_tasks.cmd.errors....
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/command/option_parsers/enum.rb
lib/i18n/tasks/command/option_parsers/enum.rb
# frozen_string_literal: true module I18n::Tasks module Command module OptionParsers module Enum class Parser DEFAULT_ERROR = proc do |invalid, valid| I18n.t("i18n_tasks.cmd.enum_opt.invalid", invalid: invalid, valid: valid * ", ") end def initialize(valid...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/concurrent/cached_value.rb
lib/i18n/tasks/concurrent/cached_value.rb
# frozen_string_literal: true module I18n::Tasks::Concurrent # A thread-safe memoized value. # The given computation is guaranteed to be invoked at most once. # @since 0.9.25 class CachedValue NULL = Object.new # @param [Proc] computation The computation that returns the value to cache. def initia...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/concurrent/cache.rb
lib/i18n/tasks/concurrent/cache.rb
# frozen_string_literal: true require "i18n/tasks/concurrent/cached_value" module I18n::Tasks::Concurrent # A thread-safe cache. # @since 0.9.25 class Cache def initialize @mutex = Mutex.new @map = {} end # @param [Object] key # @return [Object] Cached or computed value. def fet...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/reports/base.rb
lib/i18n/tasks/reports/base.rb
# frozen_string_literal: true module I18n::Tasks::Reports class Base include I18n::Tasks::Logging def initialize(task = I18n::Tasks::BaseTask.new) @task = task end attr_reader :task delegate :base_locale, :locales, to: :task protected def missing_type_info(type) ::I18n::T...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/reports/terminal.rb
lib/i18n/tasks/reports/terminal.rb
# frozen_string_literal: true require "i18n/tasks/reports/base" require "terminal-table" module I18n module Tasks module Reports class Terminal < Base # rubocop:disable Metrics/ClassLength def missing_keys(forest = task.missing_keys) forest = collapse_missing_tree! forest if for...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/translators/watsonx_translator.rb
lib/i18n/tasks/translators/watsonx_translator.rb
# frozen_string_literal: true require "i18n/tasks/translators/base_translator" require "active_support/core_ext/string/filters" module I18n::Tasks::Translators class WatsonxTranslator < BaseTranslator # max allowed texts per request BATCH_SIZE = 50 DEFAULT_SYSTEM_PROMPT = <<~PROMPT.squish You are ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/translators/yandex_translator.rb
lib/i18n/tasks/translators/yandex_translator.rb
# frozen_string_literal: true require "i18n/tasks/translators/base_translator" module I18n::Tasks::Translators class YandexTranslator < BaseTranslator def initialize(*) begin require "yandex-translator" rescue LoadError raise ::I18n::Tasks::CommandError, "Add gem 'yandex-translator' ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/translators/deepl_translator.rb
lib/i18n/tasks/translators/deepl_translator.rb
# frozen_string_literal: true require "i18n/tasks/translators/base_translator" module I18n::Tasks::Translators class DeeplTranslator < BaseTranslator # max allowed texts per request BATCH_SIZE = 50 # those languages must be specified with their sub-kind e.g en-us SPECIFIC_TARGETS = %w[en pt].freeze ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/translators/google_translator.rb
lib/i18n/tasks/translators/google_translator.rb
# frozen_string_literal: true require "cgi" require "net/http" require "uri" require "json" require "i18n/tasks/translators/base_translator" # https://cloud.google.com/translate/docs/reference/rest/v2/translate module I18n::Tasks::Translators class GoogleTranslator < BaseTranslator API_ENDPOINT = "https://tran...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/translators/base_translator.rb
lib/i18n/tasks/translators/base_translator.rb
# frozen_string_literal: true require "i18n/tasks/data/language_names" module I18n::Tasks module Translators class BaseTranslator include ::I18n::Tasks::Logging # @param [I18n::Tasks::BaseTask] i18n_tasks def initialize(i18n_tasks) @i18n_tasks = i18n_tasks end # @param [I...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/translators/openai_translator.rb
lib/i18n/tasks/translators/openai_translator.rb
# frozen_string_literal: true require "i18n/tasks/translators/base_translator" require "active_support/core_ext/string/filters" module I18n::Tasks::Translators class OpenAiTranslator < BaseTranslator include ::I18n::Tasks::Data::LanguageNames # max allowed texts per request BATCH_SIZE = 50 DEFAULT_...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/language_names.rb
lib/i18n/tasks/data/language_names.rb
# frozen_string_literal: true module I18n module Tasks module Data module LanguageNames # rubocop:disable Metrics/ModuleLength # Data loaded from https://github.com/grosser/i18n_data # I18nData.languages.transform_keys!(&:to_sym).transform_values!{|v| v.split(";").first } DATA = { ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/file_formats.rb
lib/i18n/tasks/data/file_formats.rb
# frozen_string_literal: true require "fileutils" module I18n module Tasks module Data module FileFormats def self.included(base) base.extend ClassMethods end def adapter_dump(tree, format) adapter_op :dump, format, tree, write_config(format) end ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/file_system.rb
lib/i18n/tasks/data/file_system.rb
# frozen_string_literal: true require "i18n/tasks/data/file_system_base" require "i18n/tasks/data/adapter/json_adapter" require "i18n/tasks/data/adapter/yaml_adapter" module I18n::Tasks module Data class FileSystem < FileSystemBase register_adapter :yaml, "*.yml", Adapter::YamlAdapter register_adapt...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/file_system_base.rb
lib/i18n/tasks/data/file_system_base.rb
# frozen_string_literal: true require "i18n/tasks/data/tree/node" require "i18n/tasks/data/router/pattern_router" require "i18n/tasks/data/router/conservative_router" require "i18n/tasks/data/router/isolating_router" require "i18n/tasks/data/file_formats" require "i18n/tasks/key_pattern_matching" module I18n::Tasks ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/router/conservative_router.rb
lib/i18n/tasks/data/router/conservative_router.rb
# frozen_string_literal: true require "i18n/tasks/data/router/pattern_router" module I18n::Tasks module Data::Router # Keep the path, or infer from base locale class ConservativeRouter < PatternRouter def initialize(adapter, config) @adapter = adapter @base_locale = config[:base_locale...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/router/isolating_router.rb
lib/i18n/tasks/data/router/isolating_router.rb
# frozen_string_literal: true require "i18n/tasks/key_pattern_matching" require "i18n/tasks/data/tree/node" module I18n::Tasks module Data::Router # Route based on source file path class IsolatingRouter include ::I18n::Tasks::KeyPatternMatching attr_reader :config_read_patterns, :base_locale ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/router/pattern_router.rb
lib/i18n/tasks/data/router/pattern_router.rb
# frozen_string_literal: true require "i18n/tasks/key_pattern_matching" require "i18n/tasks/data/tree/node" module I18n::Tasks module Data::Router # Route based on key name class PatternRouter include ::I18n::Tasks::KeyPatternMatching attr_reader :routes # @option data_config write [Arra...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/adapter/yaml_adapter.rb
lib/i18n/tasks/data/adapter/yaml_adapter.rb
# frozen_string_literal: true require "yaml" module I18n::Tasks module Data module Adapter module YamlAdapter EMOJI_REGEX = /\\u[\da-f]{8}/i TRAILING_SPACE_REGEX = / $/ class << self # @return [Hash] locale tree def parse(str, options) if YAML.method...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/adapter/json_adapter.rb
lib/i18n/tasks/data/adapter/json_adapter.rb
# frozen_string_literal: true require "json" module I18n::Tasks module Data module Adapter module JsonAdapter class << self # @return [Hash] locale tree def parse(str, opts) JSON.parse(str, parse_opts(opts)) end # @return [String] def ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/tree/siblings.rb
lib/i18n/tasks/data/tree/siblings.rb
# frozen_string_literal: true require "set" require "i18n/tasks/split_key" require "i18n/tasks/data/tree/nodes" module I18n::Tasks::Data::Tree # Siblings represents a subtree sharing a common parent # in case of an empty parent (nil) it represents a forest # siblings' keys are unique class Siblings < Nodes # ...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/tree/nodes.rb
lib/i18n/tasks/data/tree/nodes.rb
# frozen_string_literal: true require "i18n/tasks/data/tree/traversal" module I18n::Tasks::Data::Tree # A list of nodes class Nodes include Enumerable include Traversal attr_reader :list def initialize(opts = {}) @list = opts[:nodes] ? opts[:nodes].to_a.clone : [] end delegate :eac...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false
glebm/i18n-tasks
https://github.com/glebm/i18n-tasks/blob/b7db1cb2fe1484d93ee1cf14b5100c321d16392a/lib/i18n/tasks/data/tree/node.rb
lib/i18n/tasks/data/tree/node.rb
# frozen_string_literal: true require "i18n/tasks/data/tree/traversal" require "i18n/tasks/data/tree/siblings" module I18n::Tasks::Data::Tree class Node # rubocop:disable Metrics/ClassLength include Enumerable include Traversal attr_accessor :value attr_reader :key, :children, :parent # rubocop...
ruby
MIT
b7db1cb2fe1484d93ee1cf14b5100c321d16392a
2026-01-04T15:57:47.349094Z
false