Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/locales.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def load_locales
pt-PT ro-RO ru-RU sh-ZW si-LK sk-SK sl-SI so-SO sq-AL sr-SP sv-SE sw-KE ta-IN te-IN th-TH tr-TR tt-RU uk-UA ur-PK vi-VN vls-BE xh-ZA zh-CN zh-TW
]
I18n.default_locale = :en
I18n.available_locales = two_letter_locales + four_letter_locales
I18n.available_locales = two_letter_locales + four_letter_locales + [:global]
end
end
end
2 changes: 1 addition & 1 deletion lib/project_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ProjectLoader

def initialize(identifier, locales)
@identifier = identifier
@locales = [*locales, 'en', nil]
@locales = [*locales, 'global', 'en', nil]
end

def load(include_images: false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
NAME: 'Blank HTML & CSS Starter'
IDENTIFIER: 'blank-html-starter'
TYPE: 'html'
LOCALE: 'global'
COMPONENTS:
- name: 'index'
extension: 'html'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
NAME: 'Blank Python Starter'
IDENTIFIER: 'blank-python-starter'
TYPE: 'python'
LOCALE: 'global'
COMPONENTS:
- name: 'main'
extension: 'py'
Expand Down
8 changes: 8 additions & 0 deletions spec/lib/project_loader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
end
end

context 'when global project with identifier exists' do
let!(:global_project) { create(:project, identifier:, locale: 'global') }

it 'defaults to global' do
expect(loaded_project).to eq(global_project)
end
end

context 'when no preferred locale or English versions but user version exists' do
let!(:user_project) { create(:project, identifier:, locale: nil) }

Expand Down