アイヌ語追加 (#428) (#433)

Reviewed-on: #433
Co-authored-by: miteruzo <miteruzo@naver.com>
このコミットはプルリクエスト #433 でマージされました。
このコミットが含まれているのは:
2026-10-20 20:44:14 +09:00
committed by みてるぞ
コミット 084a090cab
294個のファイルの変更、13978行の追加、3461行の削除
+7 -4
ファイルの表示
@@ -1,19 +1,22 @@
RSpec.shared_context 'Ainu locale contract' do
let(:ainu_locale) { instance_double(Locale, language_code: 'ain', script_code: 'Jpan') }
let(:ainu_locale) do
instance_double(Locale, language_code: 'ain', script_code: 'Kana', deprecated_at: nil)
end
before do
# Only the foreign-key reference is seeded; no Locale or enum is enabled.
# Keep description contracts independent of locale activation and backfill.
Language.connection.execute(<<~SQL)
INSERT IGNORE INTO languages (code, name, created_at)
VALUES ('ain', 'Ainu', CURRENT_TIMESTAMP)
SQL
Script.find_or_create_by!(code: 'Kana') { _1.name = 'Kana' }
allow(Locale).to receive(:find_by).and_call_original
allow(Locale).to receive(:find_by).with(code: 'ain').and_return(ainu_locale)
allow(Locale).to receive(:find_by).with(code: 'ain-Kana').and_return(ainu_locale)
end
def add_ainu_name tag, name
TagName.insert_all!([{
tag_id: tag.id, language_code: 'ain', script_code: 'Jpan', name:,
tag_id: tag.id, language_code: 'ain', script_code: 'Kana', name:,
primary_flg: true, auto_generated: false,
created_at: Time.current, updated_at: Time.current }])
tag.tag_names.reset
+12
ファイルの表示
@@ -1,4 +1,16 @@
module AuthHelper
def cookie_headers(user)
env = Rails.application.env_config.merge(Rack::MockRequest.env_for('/'))
endpoint = lambda do |request_env|
ActionDispatch::Request.new(request_env).session[:inheritance_code] = user.inheritance_code
[200, {}, []]
end
store = ActionDispatch::Session::CookieStore.new(
endpoint, Rails.application.config.session_options)
headers = ActionDispatch::Cookies.new(store).call(env)[1]
{ 'Cookie' => Array(headers['set-cookie']).map { _1.split(';').first }.join('; ') }
end
def sign_in_as(user)
allow_any_instance_of(ApplicationController)
.to receive(:current_user).and_return(user)
+10 -15
ファイルの表示
@@ -1,22 +1,17 @@
RSpec.shared_context 'English locale' do
def prepare_english_reference!
Language.find_or_create_by!(code: 'en') { _1.name = 'English' }
Script.find_or_create_by!(code: 'Latn') { _1.name = 'Latin' }
region_class = Class.new(ApplicationRecord) { self.table_name = 'regions' }
region_class.find_or_create_by!(code: 826) do |record|
record.alpha_code = 'GB'
record.name = 'United Kingdom'
end
RSpec.shared_context 'Ainu locale' do
def prepare_ainu_reference!
Language.find_or_create_by!(code: 'ain') { _1.name = 'ain' }
Script.find_or_create_by!(code: 'Kana') { _1.name = 'Kana' }
end
let(:locale) do
prepare_english_reference!
Locale.find_or_create_by!(code: 'en') do |record|
record.language_code = 'en'
record.script_code = 'Latn'
record.region_code = 826
prepare_ainu_reference!
Locale.find_or_create_by!(code: 'ain-Kana') do |record|
record.language_code = 'ain'
record.script_code = 'Kana'
record.region_code = 392
record.variants = ''
record.name = 'English'
record.name = 'Ainu'
end
end
end