Fix #2344 - Missing translation for quote header timestamp

This commit is contained in:
Billy Zhou 2018-11-29 00:12:24 +08:00
parent be7767468a
commit 6ff974e6ec
3 changed files with 126 additions and 1 deletions

View file

@ -180,6 +180,10 @@ class EmailReply extends App.Controller
day: 'numeric' day: 'numeric'
year: 'numeric' year: 'numeric'
} }
locale = App.i18n.get() || 'en-US'
try
new Date(date_string).toLocaleTimeString(locale, options)
catch e
new Date(date_string).toLocaleTimeString('en-US', options) new Date(date_string).toLocaleTimeString('en-US', options)
@emailForward: (ticket, article, ui) -> @emailForward: (ticket, article, ui) ->

View file

@ -129,4 +129,76 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase
assert match[1] assert match[1]
assert Time.zone.parse(match[1]) assert Time.zone.parse(match[1])
end 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 end

View file

@ -4440,6 +4440,55 @@ wait untill text in selector disabppears
scope.find_element(css: "input[value=#{value}]").property('checked') scope.find_element(css: "input[value=#{value}]").property('checked')
end 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 =begin
Retrieve a hash of all the avaiable Zammad settings and their current values. Retrieve a hash of all the avaiable Zammad settings and their current values.