FEATURE: Add English (UK) as locale (#11768)
* "English" gets renamed into "English (US)" * "English (UK)" replaces "English" @discourse-translator-bot keep_translations_and_approvals
This commit is contained in:
parent
0b07085d72
commit
3b2f6e129a
|
@ -16,12 +16,12 @@ export default {
|
|||
active_users_30_days: 2026,
|
||||
like_count: 499135,
|
||||
likes_7_days: 3449,
|
||||
likes_30_days: 12313
|
||||
likes_30_days: 12313,
|
||||
},
|
||||
description:
|
||||
"Discussion about the next-generation open source Discourse forum software",
|
||||
title: "QUnit Discourse Tests",
|
||||
locale: "en_US",
|
||||
locale: "en",
|
||||
version: "2.2.0.beta8",
|
||||
https: true,
|
||||
admins: [
|
||||
|
@ -32,7 +32,7 @@ export default {
|
|||
avatar_template:
|
||||
"/user_avatar/meta.discourse.org/sam/{size}/102149_2.png",
|
||||
title: "co-founder",
|
||||
last_seen_at: "2030-01-15T13:30:43.272Z"
|
||||
last_seen_at: "2030-01-15T13:30:43.272Z",
|
||||
},
|
||||
{
|
||||
id: 32,
|
||||
|
@ -41,7 +41,7 @@ export default {
|
|||
avatar_template:
|
||||
"/user_avatar/meta.discourse.org/codinghorror/{size}/110067_2.png",
|
||||
title: "co-founder",
|
||||
last_seen_at: "2030-01-15T13:21:56.592Z"
|
||||
last_seen_at: "2030-01-15T13:21:56.592Z",
|
||||
},
|
||||
{
|
||||
id: 19,
|
||||
|
@ -50,8 +50,8 @@ export default {
|
|||
avatar_template:
|
||||
"/user_avatar/meta.discourse.org/eviltrout/{size}/5275_2.png",
|
||||
title: "co-founder",
|
||||
last_seen_at: "2030-01-14T18:03:08.232Z"
|
||||
}
|
||||
last_seen_at: "2030-01-14T18:03:08.232Z",
|
||||
},
|
||||
],
|
||||
moderators: [
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ export default {
|
|||
avatar_template:
|
||||
"/user_avatar/meta.discourse.org/sam/{size}/102149_2.png",
|
||||
title: "co-founder",
|
||||
last_seen_at: "2030-01-15T13:30:43.272Z"
|
||||
last_seen_at: "2030-01-15T13:30:43.272Z",
|
||||
},
|
||||
{
|
||||
id: 32,
|
||||
|
@ -70,7 +70,7 @@ export default {
|
|||
avatar_template:
|
||||
"/user_avatar/meta.discourse.org/codinghorror/{size}/110067_2.png",
|
||||
title: "co-founder",
|
||||
last_seen_at: "2030-01-15T13:21:56.592Z"
|
||||
last_seen_at: "2030-01-15T13:21:56.592Z",
|
||||
},
|
||||
{
|
||||
id: 19,
|
||||
|
@ -79,9 +79,9 @@ export default {
|
|||
avatar_template:
|
||||
"/user_avatar/meta.discourse.org/eviltrout/{size}/5275_2.png",
|
||||
title: "co-founder",
|
||||
last_seen_at: "2030-01-14T18:03:08.232Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
last_seen_at: "2030-01-14T18:03:08.232Z",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -608,7 +608,7 @@ third line`
|
|||
template: "{{d-editor value=value}}",
|
||||
beforeEach() {
|
||||
this.siteSettings.support_mixed_text_direction = true;
|
||||
this.siteSettings.default_locale = "en_US";
|
||||
this.siteSettings.default_locale = "en";
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
|
@ -622,7 +622,7 @@ third line`
|
|||
template: "{{d-editor value=value}}",
|
||||
beforeEach() {
|
||||
this.siteSettings.support_mixed_text_direction = true;
|
||||
this.siteSettings.default_locale = "en_US";
|
||||
this.siteSettings.default_locale = "en";
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
|
|
|
@ -88,7 +88,7 @@ discourseModule(
|
|||
|
||||
assert.equal(
|
||||
this.subject.header().el().attr("title"),
|
||||
"[en_US.test_none]",
|
||||
"[en.test_none]",
|
||||
"it adds a title attribute to the button"
|
||||
);
|
||||
},
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//= require route-recognizer
|
||||
//= require pretender/pretender
|
||||
//= require locales/i18n
|
||||
//= require locales/en_US
|
||||
//= require locales/en
|
||||
//= require discourse-loader
|
||||
|
||||
// Our base application
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
//= depend_on 'client.en_GB.yml'
|
||||
//= depend_on 'client.en.yml'
|
||||
//= require locales/i18n
|
||||
|
||||
<% JsLocaleHelper.reloadable_plugins(:en_GB, self) %>
|
||||
<%= JsLocaleHelper.output_locale(:en_GB) %>
|
|
@ -1,6 +0,0 @@
|
|||
//= depend_on 'client.en_US.yml'
|
||||
//= depend_on 'client.en.yml'
|
||||
//= require locales/i18n
|
||||
|
||||
<% JsLocaleHelper.reloadable_plugins(:en_US, self) %>
|
||||
<%= JsLocaleHelper.output_locale(:en_US) %>
|
|
@ -5,7 +5,7 @@
|
|||
//= require jquery.debug
|
||||
//= require ember.debug
|
||||
//= require locales/i18n
|
||||
//= require locales/en_US
|
||||
//= require locales/en
|
||||
//= require route-recognizer/dist/route-recognizer
|
||||
//= require fake_xml_http_request
|
||||
//= require pretender/pretender
|
||||
|
|
|
@ -56,7 +56,7 @@ class LocaleSiteSetting < EnumSiteSetting
|
|||
end
|
||||
|
||||
FALLBACKS ||= {
|
||||
en_US: :en
|
||||
en_GB: :en
|
||||
}
|
||||
|
||||
def self.fallback_locale(locale)
|
||||
|
|
|
@ -22,35 +22,35 @@ en:
|
|||
millions: "%{number}M"
|
||||
dates:
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
time: "HH:mm"
|
||||
time: "h:mm a"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
time_with_zone: "HH:mm (z)"
|
||||
time_with_zone: "hh:mm a (z)"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
time_short_day: "ddd, HH:mm"
|
||||
time_short_day: "ddd, h:mm a"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
timeline_date: "MMM YYYY"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_no_year: "D MMM, HH:mm"
|
||||
long_no_year: "MMM D, h:mm a"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_no_year_no_time: "D MMM"
|
||||
long_no_year_no_time: "MMM D"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
full_no_year_no_time: "Do MMMM"
|
||||
full_no_year_no_time: "MMMM Do"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_with_year: "D MMM YYYY HH:mm"
|
||||
long_with_year: "MMM D, YYYY h:mm a"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_with_year_no_time: "D MMM YYYY"
|
||||
long_with_year_no_time: "MMM D, YYYY"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
full_with_year_no_time: "D MMMM YYYY"
|
||||
full_with_year_no_time: "MMMM Do, YYYY"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date_with_year: "D MMM 'YY LT"
|
||||
long_date_with_year: "MMM D, 'YY LT"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date_without_year: "D MMM LT"
|
||||
long_date_without_year: "MMM D, LT"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date_with_year_without_time: "D MMM 'YY"
|
||||
long_date_with_year_without_time: "MMM D, 'YY"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date_without_year_with_linebreak: "D MMM <br/>LT"
|
||||
long_date_without_year_with_linebreak: "MMM D <br/>LT"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date_with_year_with_linebreak: "D MMM 'YY <br/>LT"
|
||||
long_date_with_year_with_linebreak: "MMM D, 'YY <br/>LT"
|
||||
|
||||
wrap_ago: "%{date} ago"
|
||||
|
||||
|
@ -87,7 +87,7 @@ en:
|
|||
one: "%{count}y"
|
||||
other: "%{count}y"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
date_month: "D MMM"
|
||||
date_month: "MMM D"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
date_year: "MMM 'YY"
|
||||
medium:
|
||||
|
@ -101,7 +101,7 @@ en:
|
|||
one: "%{count} day"
|
||||
other: "%{count} days"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
date_year: "D MMM 'YY"
|
||||
date_year: "MMM D, 'YY"
|
||||
medium_with_ago:
|
||||
x_minutes:
|
||||
one: "%{count} min ago"
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
en_US:
|
||||
en_GB:
|
||||
js:
|
||||
dates:
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
time: "h:mm a"
|
||||
time: "HH:mm"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
time_with_zone: "hh:mm a (z)"
|
||||
time_with_zone: "HH:mm (z)"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
time_short_day: "ddd, h:mm a"
|
||||
time_short_day: "ddd, HH:mm"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
timeline_date: "MMM YYYY"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_no_year: "MMM D, h:mm a"
|
||||
long_no_year: "D MMM, HH:mm"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_no_year_no_time: "MMM D"
|
||||
long_no_year_no_time: "D MMM"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
full_no_year_no_time: "MMMM Do"
|
||||
full_no_year_no_time: "Do MMMM"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_with_year: "MMM D, YYYY h:mm a"
|
||||
long_with_year: "D MMM YYYY HH:mm"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_with_year_no_time: "MMM D, YYYY"
|
||||
long_with_year_no_time: "D MMM YYYY"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
full_with_year_no_time: "MMMM Do, YYYY"
|
||||
full_with_year_no_time: "D MMMM YYYY"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date_with_year: "MMM D, 'YY LT"
|
||||
long_date_with_year: "D MMM 'YY LT"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date_without_year: "MMM D, LT"
|
||||
long_date_without_year: "D MMM LT"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date_with_year_without_time: "MMM D, 'YY"
|
||||
long_date_with_year_without_time: "D MMM 'YY"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date_without_year_with_linebreak: "MMM D <br/>LT"
|
||||
long_date_without_year_with_linebreak: "D MMM <br/>LT"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date_with_year_with_linebreak: "MMM D, 'YY <br/>LT"
|
||||
long_date_with_year_with_linebreak: "D MMM 'YY <br/>LT"
|
||||
|
||||
tiny:
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
date_month: "MMM D"
|
||||
date_month: "D MMM"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
date_year: "MMM 'YY"
|
||||
medium:
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
date_year: "MMM D, 'YY"
|
||||
date_year: "D MMM 'YY"
|
|
@ -111,11 +111,11 @@ el:
|
|||
name: Greek
|
||||
nativeName: ελληνικά
|
||||
en:
|
||||
name: English
|
||||
nativeName: English
|
||||
en_US:
|
||||
name: English (United States)
|
||||
nativeName: English (United States)
|
||||
name: English (US)
|
||||
nativeName: English (US)
|
||||
en_GB:
|
||||
name: English (UK)
|
||||
nativeName: English (UK)
|
||||
eo:
|
||||
name: Esperanto
|
||||
nativeName: Esperanto
|
||||
|
|
|
@ -3,20 +3,20 @@ en:
|
|||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
short_date_no_year: "D MMM"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
short_date: "D MMM YYYY"
|
||||
short_date: "D MMM, YYYY"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date: "D MMMM YYYY LT"
|
||||
long_date: "MMMM D, YYYY h:mma"
|
||||
|
||||
datetime_formats: &datetime_formats
|
||||
formats:
|
||||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
|
||||
short: "%d-%m-%Y"
|
||||
short: "%m-%d-%Y"
|
||||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
|
||||
short_no_year: "%-d %B"
|
||||
short_no_year: "%B %-d"
|
||||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
|
||||
date_only: "%-d %B %Y"
|
||||
date_only: "%B %-d, %Y"
|
||||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
|
||||
long: "%-d %B %Y %H:%M"
|
||||
long: "%B %-d, %Y, %l:%M%P"
|
||||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
|
||||
no_day: "%B %Y"
|
||||
date:
|
||||
|
@ -482,7 +482,7 @@ en:
|
|||
Welcome to %{site_name} — **thanks for contributing!**
|
||||
|
||||
- Be kind to your fellow community members.
|
||||
|
||||
|
||||
- Does your reply improve the conversation?
|
||||
|
||||
- Constructive criticism is welcome, but criticize *ideas*, not people.
|
||||
|
@ -2909,8 +2909,8 @@ en:
|
|||
We’ve promoted you up another [trust level](https://blog.discourse.org/2018/06/understanding-discourse-trust-levels/)!
|
||||
|
||||
As an experienced user, you might appreciate [this list of handy tips and tricks](https://blog.discourse.org/2016/12/discourse-new-user-tips-and-tricks/).
|
||||
|
||||
We invite you to keep getting involved – we enjoy having you around.
|
||||
|
||||
We invite you to keep getting involved – we enjoy having you around.
|
||||
|
||||
backup_succeeded:
|
||||
title: "Backup Succeeded"
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
en_US:
|
||||
en_GB:
|
||||
dates:
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
short_date_no_year: "D MMM"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
short_date: "D MMM, YYYY"
|
||||
short_date: "D MMM YYYY"
|
||||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
|
||||
long_date: "MMMM D, YYYY h:mma"
|
||||
long_date: "D MMMM YYYY LT"
|
||||
|
||||
datetime_formats: &datetime_formats
|
||||
formats:
|
||||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
|
||||
short: "%m-%d-%Y"
|
||||
short: "%d-%m-%Y"
|
||||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
|
||||
short_no_year: "%B %-d"
|
||||
short_no_year: "%-d %B"
|
||||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
|
||||
date_only: "%B %-d, %Y"
|
||||
date_only: "%-d %B %Y"
|
||||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
|
||||
long: "%B %-d, %Y, %l:%M%P"
|
||||
long: "%-d %B %Y %H:%M"
|
||||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
|
||||
no_day: "%B %Y"
|
||||
date:
|
|
@ -738,7 +738,7 @@ posting:
|
|||
default: false
|
||||
locale_default:
|
||||
en: true
|
||||
en_US: true
|
||||
en_GB: true
|
||||
title_fancy_entities: true
|
||||
min_personal_message_title_length:
|
||||
client: true
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RenameEnglishLocale < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
rename_locale(old: "en", new: "en_GB")
|
||||
rename_locale(old: "en_US", new: "en")
|
||||
end
|
||||
|
||||
def down
|
||||
rename_locale(old: "en", new: "en_US")
|
||||
rename_locale(old: "en_GB", new: "en")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def rename_locale(old:, new:)
|
||||
execute <<~SQL
|
||||
UPDATE users
|
||||
SET locale = '#{new}'
|
||||
WHERE locale = '#{old}'
|
||||
SQL
|
||||
|
||||
execute <<~SQL
|
||||
UPDATE site_settings
|
||||
SET value = '#{new}'
|
||||
WHERE name = 'default_locale' AND value = '#{old}'
|
||||
SQL
|
||||
|
||||
execute <<~SQL
|
||||
UPDATE translation_overrides
|
||||
SET locale = '#{new}'
|
||||
WHERE locale = '#{old}'
|
||||
SQL
|
||||
|
||||
execute <<~SQL
|
||||
UPDATE theme_translation_overrides
|
||||
SET locale = '#{new}'
|
||||
WHERE locale = '#{old}'
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -195,8 +195,7 @@ module JsLocaleHelper
|
|||
end
|
||||
|
||||
MOMENT_LOCALE_MAPPING ||= {
|
||||
"hy" => "hy-am",
|
||||
"en" => "en-gb"
|
||||
"hy" => "hy-am"
|
||||
}
|
||||
|
||||
def self.find_moment_locale(locale_chain, timezone_names: false)
|
||||
|
@ -213,7 +212,6 @@ module JsLocaleHelper
|
|||
# moment.js uses a different naming scheme for locale files
|
||||
locale.tr('_', '-').downcase
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def self.find_message_format_locale(locale_chain, fallback_to_english:)
|
||||
|
|
|
@ -4,7 +4,7 @@ module SiteSettings; end
|
|||
|
||||
# A cache for providing default value based on site locale
|
||||
class SiteSettings::DefaultsProvider
|
||||
DEFAULT_LOCALE = 'en_US'
|
||||
DEFAULT_LOCALE = 'en'
|
||||
|
||||
def initialize(site_setting)
|
||||
@site_setting = site_setting
|
||||
|
|
|
@ -30,7 +30,7 @@ describe "translate accelerator" do
|
|||
orig = I18n.t('i_am_an_unknown_key99')
|
||||
|
||||
expect(I18n.t('i_am_an_unknown_key99').object_id).to eq(orig.object_id)
|
||||
expect(I18n.t('i_am_an_unknown_key99')).to eq("translation missing: en_US.i_am_an_unknown_key99")
|
||||
expect(I18n.t('i_am_an_unknown_key99')).to eq("translation missing: en.i_am_an_unknown_key99")
|
||||
end
|
||||
|
||||
it "returns the correct language" do
|
||||
|
@ -173,10 +173,10 @@ describe "translate accelerator" do
|
|||
end
|
||||
|
||||
it "supports one and other with fallback locale" do
|
||||
override_translation('en_US', 'items.one', 'one fish')
|
||||
override_translation('en_US', 'items.other', '%{count} fishies')
|
||||
override_translation('en_GB', 'items.one', 'one fish')
|
||||
override_translation('en_GB', 'items.other', '%{count} fishies')
|
||||
|
||||
I18n.with_locale(:en_US) do
|
||||
I18n.with_locale(:en_GB) do
|
||||
expect(I18n.t('items', count: 13)).to eq('13 fishies')
|
||||
expect(I18n.t('items', count: 1)).to eq('one fish')
|
||||
end
|
||||
|
|
|
@ -118,14 +118,14 @@ describe JsLocaleHelper do
|
|||
expect(message).not_to match 'Plural Function not found'
|
||||
end
|
||||
|
||||
it "includes uses message formats from fallback locale" do
|
||||
translations = JsLocaleHelper.translations_for(:en_US)
|
||||
en_us_message_formats = JsLocaleHelper.remove_message_formats!(translations, :en_US)
|
||||
expect(en_us_message_formats).to_not be_empty
|
||||
it "uses message formats from fallback locale" do
|
||||
translations = JsLocaleHelper.translations_for(:en_GB)
|
||||
en_gb_message_formats = JsLocaleHelper.remove_message_formats!(translations, :en_GB)
|
||||
expect(en_gb_message_formats).to_not be_empty
|
||||
|
||||
translations = JsLocaleHelper.translations_for(:en)
|
||||
en_message_formats = JsLocaleHelper.remove_message_formats!(translations, :en)
|
||||
expect(en_us_message_formats).to eq(en_message_formats)
|
||||
expect(en_gb_message_formats).to eq(en_message_formats)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -207,12 +207,12 @@ describe JsLocaleHelper do
|
|||
end
|
||||
|
||||
describe ".find_message_format_locale" do
|
||||
it "finds locale for en_US" do
|
||||
locale, filename = JsLocaleHelper.find_message_format_locale([:en_US], fallback_to_english: false)
|
||||
it "finds locale for en_GB" do
|
||||
locale, filename = JsLocaleHelper.find_message_format_locale([:en_GB], fallback_to_english: false)
|
||||
expect(locale).to eq("en")
|
||||
expect(filename).to end_with("/en.js")
|
||||
|
||||
locale, filename = JsLocaleHelper.find_message_format_locale(["en_US"], fallback_to_english: false)
|
||||
locale, filename = JsLocaleHelper.find_message_format_locale(["en_GB"], fallback_to_english: false)
|
||||
expect(locale).to eq("en")
|
||||
expect(filename).to end_with("/en.js")
|
||||
end
|
||||
|
|
|
@ -785,7 +785,7 @@ describe SiteSettingExtension do
|
|||
|
||||
describe '.default_locale' do
|
||||
it 'is always loaded' do
|
||||
expect(settings.default_locale).to eq('en_US')
|
||||
expect(settings.default_locale).to eq('en')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@ describe I18n::Backend::FallbackLocaleList do
|
|||
expect(list[:en]).to eq([:en])
|
||||
end
|
||||
|
||||
it "works when default_locale is English (United States)" do
|
||||
SiteSetting.default_locale = :en_US
|
||||
it "works when default_locale is English (UK)" do
|
||||
SiteSetting.default_locale = :en_GB
|
||||
|
||||
expect(list[:ru]).to eq([:ru, :en])
|
||||
expect(list[:en_US]).to eq([:en_US, :en])
|
||||
expect(list[:en_GB]).to eq([:en_GB, :en])
|
||||
expect(list[:en]).to eq([:en])
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ describe I18n::Backend::FallbackLocaleList do
|
|||
expect(list[:ru]).to eq([:ru, :en])
|
||||
expect(list[:de]).to eq([:de, :en])
|
||||
expect(list[:en]).to eq([:en])
|
||||
expect(list[:en_US]).to eq([:en_US, :en])
|
||||
expect(list[:en_GB]).to eq([:en_GB, :en])
|
||||
end
|
||||
|
||||
context "when plugin registered fallback locale" do
|
||||
|
@ -50,14 +50,14 @@ describe I18n::Backend::FallbackLocaleList do
|
|||
expect(list[:en]).to eq([:en])
|
||||
end
|
||||
|
||||
it "works when default_locale is English (United States)" do
|
||||
SiteSetting.default_locale = :en_US
|
||||
it "works when default_locale is English (UK)" do
|
||||
SiteSetting.default_locale = :en_GB
|
||||
|
||||
expect(list[:de_AT]).to eq([:de_AT, :de, :en])
|
||||
expect(list[:"de_AT-formal"]).to eq([:"de_AT-formal", :de_AT, :de, :en])
|
||||
expect(list[:de]).to eq([:de, :en])
|
||||
expect(list[:en]).to eq([:en])
|
||||
expect(list[:en_US]).to eq([:en_US, :en])
|
||||
expect(list[:en_GB]).to eq([:en_GB, :en])
|
||||
end
|
||||
|
||||
it "works when default_locale is not English" do
|
||||
|
|
|
@ -22,7 +22,7 @@ describe Search do
|
|||
it "maps locales to correct Postgres dictionaries" do
|
||||
expect(Search.ts_config).to eq("english")
|
||||
expect(Search.ts_config("en")).to eq("english")
|
||||
expect(Search.ts_config("en_US")).to eq("english")
|
||||
expect(Search.ts_config("en_GB")).to eq("english")
|
||||
expect(Search.ts_config("pt_BR")).to eq("portuguese")
|
||||
expect(Search.ts_config("tr")).to eq("turkish")
|
||||
expect(Search.ts_config("xx")).to eq("simple")
|
||||
|
|
|
@ -1013,7 +1013,7 @@ describe UserNotifications do
|
|||
let(:locale) { "fr" }
|
||||
let(:mail_type) { mail_type }
|
||||
it "sets the locale" do
|
||||
expects_build_with(has_entry(:locale, "en_US"))
|
||||
expects_build_with(has_entry(:locale, "en"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -90,15 +90,15 @@ describe LocaleSiteSetting do
|
|||
expect(LocaleSiteSetting.fallback_locale('foo')).to be_nil
|
||||
end
|
||||
|
||||
it 'returns English for English (United States)' do
|
||||
expect(LocaleSiteSetting.fallback_locale('en_US')).to eq(:en)
|
||||
it 'returns English for English (UK)' do
|
||||
expect(LocaleSiteSetting.fallback_locale('en_GB')).to eq(:en)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.fallback_locale' do
|
||||
it 'returns English for English (United States)' do
|
||||
expect(LocaleSiteSetting.fallback_locale('en_US')).to eq(:en)
|
||||
it 'returns English for English (UK)' do
|
||||
expect(LocaleSiteSetting.fallback_locale('en_GB')).to eq(:en)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ RSpec.describe 'Multisite SiteSettings', type: :multisite do
|
|||
describe '#default_locale' do
|
||||
it 'should return the right locale' do
|
||||
test_multisite_connection('default') do
|
||||
expect(SiteSetting.default_locale).to eq('en_US')
|
||||
expect(SiteSetting.default_locale).to eq('en')
|
||||
end
|
||||
|
||||
test_multisite_connection('second') do
|
||||
|
@ -25,7 +25,7 @@ RSpec.describe 'Multisite SiteSettings', type: :multisite do
|
|||
end
|
||||
|
||||
test_multisite_connection('default') do
|
||||
expect(SiteSetting.default_locale).to eq('en_US')
|
||||
expect(SiteSetting.default_locale).to eq('en')
|
||||
|
||||
SiteSetting.default_locale = 'ja'
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ describe ExtraLocalesController do
|
|||
before do
|
||||
JsLocaleHelper.clear_cache!
|
||||
JsLocaleHelper.expects(:plugin_translations)
|
||||
.with(any_of("en", "en_US"))
|
||||
.with(any_of("en", "en_GB"))
|
||||
.returns("admin_js" => {
|
||||
"admin" => {
|
||||
"site_settings" => {
|
||||
|
|
|
@ -354,7 +354,7 @@ describe BadgeGranter do
|
|||
|
||||
it 'removes custom badge titles' do
|
||||
custom_badge_title = 'this is a badge title'
|
||||
TranslationOverride.create!(translation_key: badge.translation_key, value: custom_badge_title, locale: 'en_US')
|
||||
TranslationOverride.create!(translation_key: badge.translation_key, value: custom_badge_title, locale: 'en')
|
||||
described_class.grant(badge, user)
|
||||
user.update!(title: custom_badge_title)
|
||||
|
||||
|
|
Loading…
Reference in New Issue