Skip to content

Commit

Permalink
Fix #2344 - Missing translation for quote header timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Billy Zhou committed Dec 4, 2018
1 parent be77674 commit 6ff974e
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ class EmailReply extends App.Controller
day: 'numeric'
year: 'numeric'
}
new Date(date_string).toLocaleTimeString('en-US', options)
locale = App.i18n.get() || 'en-US'
try
new Date(date_string).toLocaleTimeString(locale, options)
catch e
new Date(date_string).toLocaleTimeString('en-US', options)

@emailForward: (ticket, article, ui) ->

Expand Down
72 changes: 72 additions & 0 deletions test/browser/agent_ticket_email_reply_keep_body_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,76 @@ def test_full_quote
assert match[1]
assert Time.zone.parse(match[1])
end

# Regression test for issue #2344 - Missing translation for Full-Quote-Text "on xy wrote"
def test_full_quote_german_locale
@browser = instance = browser_instance
login(
username: 'master@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all()

ticket_open_by_title(
title: 'Welcome to Zammad',
)
watch_for(
css: '.content.active .js-settingContainer .js-setting .dropdown-icon',
)

# enable email full quote in the ticket zoom config page
scroll_to(
position: 'botton',
css: '.content.active .js-settingContainer .js-setting .dropdown-icon',
)
click(css: '.content.active .js-settingContainer .js-setting .dropdown-icon')
modal_ready()
select(
css: '.modal #ui_ticket_zoom_article_email_full_quote select[name="ui_ticket_zoom_article_email_full_quote"]',
value: 'yes'
)
click(
css: '.modal #ui_ticket_zoom_article_email_full_quote .btn[type="submit"]',
)
modal_close()
modal_disappear()

exists(css: '.content.active .ticket-article [data-type="emailReply"]')

# switch user profile language to German
switch_language(
data: {
language: 'Deutsch'
},
)

ticket_open_by_title(
title: 'Welcome to Zammad',
)

scroll_to(
position: 'botton',
css: '.content.active .ticket-article [data-type="emailReply"]',
)
click(css: '.content.active .ticket-article [data-type="emailReply"]')

full_text = @browser.find_element(css: '.content.active .article-new .articleNewEdit-body').text

match = full_text.match(/\nAm (.*?), schrieb Nicole Braun:/)
assert match

datestamp = match[1]
assert datestamp
assert Time.zone.parse(datestamp)
day_of_week = datestamp.split(',').first
assert %w[Montag Dienstag Mittwoch Donnerstag Freitag Samstag Sonntag].include? day_of_week

# switch user profile language to English again for other tests
switch_language(
data: {
language: 'English (United States)'
},
)
end
end
49 changes: 49 additions & 0 deletions test/browser_test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4440,6 +4440,55 @@ def checkbox_is_selected(scope, value)
scope.find_element(css: "input[value=#{value}]").property('checked')
end

=begin
Switch the current logged in user's profile language to a new language
switch_language(
browser: browser2,
data: {
language: 'Deutsch'
},
)
IMPORTANT REMINDER! At the end of tests, the caller must manually set the language back to English again:
switch_language(
browser: browser2,
data: {
language: 'English (United States)'
},
)
Failure to switch back to English will cause large amounts of subsequent tests to fail due to the UI language differences.
=end

def switch_language(params = {})
switch_window_focus(params)
log('switch_language', params)

instance = params[:browser] || @browser
data = params[:data]

click(browser: instance, css: '#navigation .user-menu .js-avatar')

click(browser: instance, css: '#navigation .user-menu a[href="#profile"]')

select(
browser: instance,
css: '.content.active .searchableSelect-shadow',
value: data[:language],
)

click(browser: instance, css: '.content.active .btn--primary')

watch_for(
browser: instance,
css: '#notify',
)
end

=begin
Retrieve a hash of all the avaiable Zammad settings and their current values.
Expand Down

0 comments on commit 6ff974e

Please sign in to comment.