Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove remains of path based locale support #1823

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ TARIFF_API_VERSION=2
TARIFF_FROM_EMAIL=no-reply@example.com
TARIFF_TO_EMAIL=support@example.com
UPDATED_NAVIGATION=true
WEBCHAT_URL='test-online-services-helpdesk'
WELSH=true
WEBCHAT_URL='test-online-services-helpdesk'
4 changes: 1 addition & 3 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ TARIFF_API_VERSION=2
TARIFF_FROM_EMAIL=no-reply@example.com
TARIFF_TO_EMAIL=support@example.com
UPDATED_NAVIGATION=true
WEBCHAT_URL='test-online-services-helpdesk'
WELSH=true

WEBCHAT_URL='test-online-services-helpdesk'
1 change: 0 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class ApplicationController < ActionController::Base
include ApplicationHelper

before_action :maintenance_mode_if_active

before_action :set_cache
before_action :set_last_updated
before_action :set_path_info
Expand Down
16 changes: 2 additions & 14 deletions app/helpers/service_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,14 @@ def service_region
end

def replace_service_tags(content)
content.gsub %r{\[\[[A-Z]+_[A-Z_]+\]\]} do |match|
content.gsub %r{\[\[SERVICE_[A-Z_]+\]\]} do |match|
case match
when '[[SERVICE_NAME]]'
service_name
when '[[SERVICE_PATH]]'
service_path_prefix
TradeTariffFrontend::ServiceChooser.xi? ? '/xi' : ''
when '[[SERVICE_REGION]]'
service_region
when '[[LOCALE_PATH]]'
locale_path_prefix
when '[[PREFIX_PATH]]'
"#{service_path_prefix}#{locale_path_prefix}"
else
match
end
Expand Down Expand Up @@ -141,12 +137,4 @@ def current_path
"/#{components.join('/')}?#{query_string}"
end
end

def service_path_prefix
TradeTariffFrontend::ServiceChooser.xi? ? '/xi' : ''
end

def locale_path_prefix
I18n.locale == I18n.default_locale ? '' : "/#{I18n.locale}"
end
end
5 changes: 0 additions & 5 deletions config/initializers/i18n.rb

This file was deleted.

4 changes: 0 additions & 4 deletions config/locales/cy.yml

This file was deleted.

4 changes: 0 additions & 4 deletions lib/trade_tariff_frontend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ def self.check_duties_service_url
ENV.fetch('CHECK_DUTIES_SERVICE_URL', 'https://www.check-duties-customs-exporting-goods.service.gov.uk')
end

def welsh?
ENV['WELSH'].to_s == 'true'
end

def roo_wizard?
ENV['ROO_WIZARD'] == 'true' && TradeTariffFrontend::ServiceChooser.uk?
end
Expand Down
32 changes: 0 additions & 32 deletions spec/features/locale_spec.rb

This file was deleted.

44 changes: 0 additions & 44 deletions spec/helpers/service_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,50 +324,6 @@
it { is_expected.to eql expected }
end
end

context 'with LOCALE_PATH' do
let(:content) { '[Browse]([[LOCALE_PATH]]/browse)' }

context 'with English locale' do
it { is_expected.to eql '[Browse](/browse)' }
end

context 'with Cymru locale' do
include_context 'with Cymru locale'

it { is_expected.to eql '[Browse](/cy/browse)' }
end
end

context 'with PREFIX_PATH' do
let(:content) { '[Browse]([[PREFIX_PATH]]/browse)' }

context 'with UK service and default locale' do
include_context 'with UK service'

it { is_expected.to eql '[Browse](/browse)' }
end

context 'with UK service and Cymru locale' do
include_context 'with UK service'
include_context 'with Cymru locale'

it { is_expected.to eql '[Browse](/cy/browse)' }
end

context 'with XI service and default locale' do
include_context 'with XI service'

it { is_expected.to eql '[Browse](/xi/browse)' }
end

context 'with XI service and Cymru locale' do
include_context 'with XI service'
include_context 'with Cymru locale'

it { is_expected.to eql '[Browse](/xi/cy/browse)' }
end
end
end

describe '#import_export_date_title' do
Expand Down
3 changes: 0 additions & 3 deletions spec/support/shared_context/locale.rb

This file was deleted.