summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Schneider <fabbbbbi+git@googlemail.com>2018-11-13 19:38:26 +0100
committerFabian Schneider <fabbbbbi+git@googlemail.com>2019-02-06 17:33:57 +0100
commit8fabc92e8b4779030c4fa09d8e1c72f213814787 (patch)
treed79ecbda0b0b5a2814379d83edb4f2395182526c
parent5402f3c360eaa668782d53cdf04fcc1cb0a400ec (diff)
downloadgitlab-ce-8fabc92e8b4779030c4fa09d8e1c72f213814787.tar.gz
Add helpers for first day of the week
-rw-r--r--app/helpers/preferences_helper.rb17
-rw-r--r--app/views/admin/application_settings/_localization.html.haml6
-rw-r--r--app/views/profiles/preferences/show.html.haml14
-rw-r--r--doc/user/profile/preferences.md2
-rw-r--r--locale/gitlab.pot15
5 files changed, 36 insertions, 18 deletions
diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb
index 3371592a36a..0faa28581cc 100644
--- a/app/helpers/preferences_helper.rb
+++ b/app/helpers/preferences_helper.rb
@@ -43,18 +43,21 @@ module PreferencesHelper
]
end
- def default_first_day_of_week
- Date::DAYNAMES[Gitlab::CurrentSettings.default_first_day_of_week]
- end
-
def first_day_of_week_choices
[
- ["System Default (#{default_first_day_of_week})", nil],
- ['Sunday', 0],
- ['Monday', 1]
+ [_('Sunday'), 0],
+ [_('Monday'), 1]
]
end
+ def default_first_day_of_week
+ first_day_of_week_choices.rassoc(Gitlab::CurrentSettings.default_first_day_of_week).first
+ end
+
+ def first_day_of_week_choices_with_default
+ first_day_of_week_choices.unshift([_('System Default (%{default})') % { default: default_first_day_of_week }, nil])
+ end
+
def user_application_theme
@user_application_theme ||= Gitlab::Themes.for_user(current_user).css_class
end
diff --git a/app/views/admin/application_settings/_localization.html.haml b/app/views/admin/application_settings/_localization.html.haml
index 87209da75fd..7392b32ee89 100644
--- a/app/views/admin/application_settings/_localization.html.haml
+++ b/app/views/admin/application_settings/_localization.html.haml
@@ -4,8 +4,8 @@
%fieldset
.form-group
= f.label :default_first_day_of_week, _('Default first day of the week'), class: 'label-bold'
- = f.select :default_first_day_of_week, options_for_select({_('Sunday') => 0, _('Monday') => 1}, @application_setting.default_first_day_of_week), {}, class: 'form-control'
+ = f.select :default_first_day_of_week, first_day_of_week_choices, {}, class: 'form-control'
.form-text.text-muted
- Default first day of the week in calendars and date pickers.
+ = _('Default first day of the week in calendars and date pickers.')
- = f.submit 'Save changes', class: "btn btn-success"
+ = f.submit _('Save changes'), class: "btn btn-success"
diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml
index bed9aa05224..e290ba89684 100644
--- a/app/views/profiles/preferences/show.html.haml
+++ b/app/views/profiles/preferences/show.html.haml
@@ -66,17 +66,17 @@
.col-lg-4.profile-settings-sidebar
%h4.prepend-top-0
- Localization
+ = _('Localization')
%p
- Customize language and region related settings.
+ = _('Customize language and region related settings.')
= succeed '.' do
- = link_to 'Learn more', help_page_path('user/profile/preferences', anchor: 'localization'), target: '_blank'
+ = link_to _('Learn more'), help_page_path('user/profile/preferences', anchor: 'localization'), target: '_blank'
.col-lg-8
.form-group
= f.label :first_day_of_week, class: 'label-bold' do
- First day of the week
- = f.select :first_day_of_week, first_day_of_week_choices, {}, class: 'form-control'
+ = _('First day of the week')
+ = f.select :first_day_of_week, first_day_of_week_choices_with_default, {}, class: 'form-control'
.form-text.text-muted
- Choose on what day the week should start.
+ = _('Choose on what day the week should start.')
.form-group
- = f.submit 'Save changes', class: 'btn btn-success'
+ = f.submit _('Save changes'), class: 'btn btn-success'
diff --git a/doc/user/profile/preferences.md b/doc/user/profile/preferences.md
index 925bbc84d85..6b8b5cf4d5e 100644
--- a/doc/user/profile/preferences.md
+++ b/doc/user/profile/preferences.md
@@ -94,5 +94,5 @@ This following setting allows you to customize calendar layouts.
### First day of the week
-You can choose between **Default**, **Sunday** and **Monday** for the first day of the week. If you select **Default**, the system-wide default setting will be used.
+You can choose between **System Default**, **Sunday** and **Monday** for the first day of the week. If you select **System Default**, the system-wide default setting will be used.
This preference will be used for all calendar views and datepickers.
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index f9ce6ebb79e..26d64e908b7 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -1413,6 +1413,9 @@ msgstr ""
msgid "Choose file..."
msgstr ""
+msgid "Choose on what day the week should start."
+msgstr ""
+
msgid "Choose the top-level group for your repository imports."
msgstr ""
@@ -2444,6 +2447,9 @@ msgstr ""
msgid "Customize how Google Code email addresses and usernames are imported into GitLab. In the next step, you'll be able to select the projects you want to import."
msgstr ""
+msgid "Customize language and region related settings."
+msgstr ""
+
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
@@ -2510,6 +2516,9 @@ msgstr ""
msgid "Default first day of the week"
msgstr ""
+msgid "Default first day of the week in calendars and date pickers."
+msgstr ""
+
msgid "Default: Directly import the Google Code email address or username"
msgstr ""
@@ -3358,6 +3367,9 @@ msgstr ""
msgid "Finished"
msgstr ""
+msgid "First day of the week"
+msgstr ""
+
msgid "FirstPushedBy|First"
msgstr ""
@@ -6944,6 +6956,9 @@ msgstr ""
msgid "Switch branch/tag"
msgstr ""
+msgid "System Default (%{default})"
+msgstr ""
+
msgid "System Hooks"
msgstr ""