Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
Allow forward slash in locale key
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanb authored and glebm committed Nov 8, 2021
1 parent f1d34be commit 11c8825
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/i18n/tasks/scanners/ruby_key_literals.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def strip_literal(literal)
literal
end

VALID_KEY_CHARS = /(?:[[:word:]]|[-.?!:;À-ž])/.freeze
VALID_KEY_CHARS = /(?:[[:word:]]|[-.?!:;À-ž\/])/.freeze
VALID_KEY_RE = /^#{VALID_KEY_CHARS}+$/.freeze

def valid_key?(key)
Expand Down
16 changes: 16 additions & 0 deletions spec/scanners/ruby_key_literals_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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_valid_key('category/product')
end
end
end

0 comments on commit 11c8825

Please sign in to comment.