Merge pull request #6848 from opf/fix/29049/i18n-start-of-week

[29049] Fix missing start-of-week without user_specific_includes

[ci skip]
pull/6852/head
Oliver Günther 6 years ago committed by GitHub
commit d4f3067b8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      app/helpers/application_helper.rb
  2. 1
      app/views/layouts/base.html.erb
  3. 1
      frontend/src/app/init-globals.ts
  4. 1
      frontend/src/app/modules/common/i18n/i18n.service.ts
  5. 1
      frontend/src/test/i18n-shim.ts

@ -422,26 +422,6 @@ module ApplicationHelper
end end
end end
# Returns the javascript tags that are included in the html layout head
def user_specific_javascript_includes
tags = ''
tags += nonced_javascript_tag do
%{
window.openProject = new OpenProject({
urlRoot : '#{OpenProject::Configuration.rails_relative_url_root}',
environment: '#{Rails.env}',
loginUrl: '#{url_for controller: '/account', action: 'login'}'
});
I18n.defaultLocale = "#{I18n.default_locale}";
I18n.locale = "#{I18n.locale}";
I18n.firstDayOfWeek = "#{locale_first_day_of_week}"
}.html_safe
end
tags.html_safe
end
def calendar_for(*args) def calendar_for(*args)
ActiveSupport::Deprecation.warn "calendar_for has been removed. Please add the class '-augmented-datepicker' instead.", caller ActiveSupport::Deprecation.warn "calendar_for has been removed. Please add the class '-augmented-datepicker' instead.", caller
end end

@ -54,6 +54,7 @@ See docs/COPYRIGHT.rdoc for more details.
<meta name="openproject_initializer" <meta name="openproject_initializer"
data-locale="<%= I18n.locale %>" data-locale="<%= I18n.locale %>"
data-first-day-of-week="<%= locale_first_day_of_week %>"
data-default-locale="<%= I18n.default_locale %>" data-default-locale="<%= I18n.default_locale %>"
data-environment="<%= Rails.env %>"/> data-environment="<%= Rails.env %>"/>
<meta name="current_menu_item" content="<%= current_menu_item %>"/> <meta name="current_menu_item" content="<%= current_menu_item %>"/>

@ -48,6 +48,7 @@ window.appBasePath = jQuery('meta[name=app_base_path]').attr('content') || '';
const meta = jQuery('meta[name=openproject_initializer]'); const meta = jQuery('meta[name=openproject_initializer]');
I18n.locale = meta.data('defaultLocale'); I18n.locale = meta.data('defaultLocale');
I18n.locale = meta.data('locale'); I18n.locale = meta.data('locale');
I18n.firstDayOfWeek = parseInt(meta.data('firstDayOfWeek'), 10);
// Enable debug logging for reactive states // Enable debug logging for reactive states
whenDebugging(() => { whenDebugging(() => {

@ -7,6 +7,7 @@ export interface GlobalI18n {
t(translateId:string, parameters?:any):string; t(translateId:string, parameters?:any):string;
lookup(translateId:string):boolean | undefined; lookup(translateId:string):boolean | undefined;
locale:string; locale:string;
firstDayOfWeek:number;
} }
@Injectable() @Injectable()

@ -3,6 +3,7 @@ import {GlobalI18n} from "core-app/modules/common/i18n/i18n.service";
export class I18nShim implements GlobalI18n { export class I18nShim implements GlobalI18n {
public defaultLocale = 'en'; public defaultLocale = 'en';
public firstDayOfWeek = 1;
public locale = 'en'; public locale = 'en';
public translations = { public translations = {
en: {} en: {}

Loading…
Cancel
Save