forked from pingcap/discourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: English locale with international date formats
Makes en_US the new default locale
- Loading branch information
Showing
44 changed files
with
274 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//= depend_on 'client.en_US.yml' | ||
//= require locales/i18n | ||
|
||
<% JsLocaleHelper.reloadable_plugins(:en_US, self) %> | ||
<%= JsLocaleHelper.output_locale(:en_US) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
en_US: | ||
js: | ||
dates: | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
time: "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: "MMM D h:mm a" | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
long_no_year_no_time: "MMM D" | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
full_no_year_no_time: "MMMM Do" | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
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: "MMM D, YYYY" | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
full_with_year_no_time: "MMMM Do, YYYY" | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
long_date_with_year: "MMM D, 'YY LT" | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
long_date_without_year: "MMM D, LT" | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
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: "MMM D <br/>LT" | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
long_date_with_year_with_linebreak: "MMM D, 'YY <br/>LT" | ||
|
||
tiny: | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
date_month: "MMM D" | ||
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
en_US: | ||
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" | ||
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/ | ||
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: "%m-%d-%Y" | ||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime | ||
short_no_year: "%B %-d" | ||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime | ||
date_only: "%B %-d, %Y" | ||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime | ||
long: "%B %-d, %Y, %l:%M%P" | ||
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime | ||
no_day: "%B %Y" | ||
date: | ||
<<: *datetime_formats | ||
time: | ||
<<: *datetime_formats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# frozen_string_literal: true | ||
|
||
class MigrateEnglishLocale < ActiveRecord::Migration[5.2] | ||
def up | ||
execute <<~SQL | ||
UPDATE users | ||
SET locale = 'en_US' | ||
WHERE locale = 'en' | ||
SQL | ||
|
||
execute <<~SQL | ||
UPDATE site_settings | ||
SET value = 'en_US' | ||
WHERE name = 'default_locale' AND value = 'en' | ||
SQL | ||
|
||
execute <<~SQL | ||
UPDATE translation_overrides | ||
SET locale = 'en_US' | ||
WHERE locale = 'en' | ||
SQL | ||
|
||
execute <<~SQL | ||
UPDATE theme_translation_overrides | ||
SET locale = 'en_US' | ||
WHERE locale = 'en' | ||
SQL | ||
end | ||
|
||
def down | ||
execute <<~SQL | ||
UPDATE users | ||
SET locale = 'en' | ||
WHERE locale = 'en_US' | ||
SQL | ||
|
||
execute <<~SQL | ||
UPDATE site_settings | ||
SET value = 'en' | ||
WHERE name = 'default_locale' AND value = 'en_US' | ||
SQL | ||
|
||
execute <<~SQL | ||
UPDATE translation_overrides | ||
SET locale = 'en' | ||
WHERE locale = 'en_US' | ||
SQL | ||
|
||
execute <<~SQL | ||
UPDATE theme_translation_overrides | ||
SET locale = 'en' | ||
WHERE locale = 'en_US' | ||
SQL | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.