Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix untranslated week days in some locales (#49848)

Christophe Bliard619d67aec9b5
diff --git a/frontend/src/app/core/setup/init-locale.ts b/frontend/src/app/core/setup/init-locale.ts
index c2cf05cceca..a22262ba0bd 100644
--- a/frontend/src/app/core/setup/init-locale.ts
+++ b/frontend/src/app/core/setup/init-locale.ts
@@ -39,7 +39,9 @@ export function initializeLocale() {
I18n.locale = locale;
if (!Number.isNaN(firstDayOfWeek) && !Number.isNaN(firstWeekOfYear)) {
- moment.updateLocale(locale, {
+ // ensure locale like "zh-CN" falls back to "zh-cn"
+ moment.locale(locale);
+ moment.updateLocale(moment.locale(), {
week: {
dow: firstDayOfWeek,
doy: 7 + firstDayOfWeek - firstWeekOfYear,
diff --git a/spec/features/notifications/settings/workdays_settings_spec.rb b/spec/features/notifications/settings/workdays_settings_spec.rb
index 221549f0032..0a13c99c321 100644
--- a/spec/features/notifications/settings/workdays_settings_spec.rb
+++ b/spec/features/notifications/settings/workdays_settings_spec.rb
@@ -97,6 +97,22 @@ RSpec.describe "Workday notification settings", js: true, with_cuprite: true do
expect(pref.reload.workdays).to eq [1, 2, 5, 6]
end
end
+
+ context 'with Chinese Simplified locale and start of week setting defined',
+ with_settings: {
+ start_of_week: 1,
+ first_week_of_year: 1
+ } do
+ let(:locale) { 'zh-CN' }
+
+ it 'displays week days in Chinese (bug #49848)' do
+ settings_page.visit!
+
+ I18n.t('date.day_names', locale:).map(&:strip).each do |day_name|
+ expect(page).to have_field(day_name)
+ end
+ end
+ end
end
context 'with the my page' do