From 06af2b7936188db5ebc48846fa3eee03a087005b Mon Sep 17 00:00:00 2001 From: Dominik Klein Date: Thu, 30 Sep 2021 15:57:39 +0200 Subject: [PATCH] Fixes #3733 - Simple quote characters (`'`) not properly displayed. (cherry picked from commit 2bd4ceeedfb999d4e948b8aa8b91a759eb7a4c1b) --- .../_application_ui_element.coffee | 6 +++--- .../app/views/data_privacy/preview.jst.eco | 2 +- spec/system/ticket/create_spec.rb | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee b/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee index 9c48d193b..4a950bc02 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee @@ -46,7 +46,7 @@ class App.UiElement.ApplicationUiElement result = [] for row in selection if attribute.translate - row.name = App.i18n.translateInline(row.name) + row.name = App.i18n.translatePlain(row.name) if !_.isEmpty(row.children) row.children = @getConfigOptionListArray(attribute, row.children) result.push row @@ -65,7 +65,7 @@ class App.UiElement.ApplicationUiElement for key in order name_new = selection[key] if attribute.translate - name_new = App.i18n.translateInline(name_new) + name_new = App.i18n.translatePlain(name_new) attribute.options.push { name: name_new value: key @@ -162,7 +162,7 @@ class App.UiElement.ApplicationUiElement nameNew = item.name if attribute.translate - nameNew = App.i18n.translateInline(nameNew) + nameNew = App.i18n.translatePlain(nameNew) row = value: item.id, diff --git a/app/assets/javascripts/app/views/data_privacy/preview.jst.eco b/app/assets/javascripts/app/views/data_privacy/preview.jst.eco index 02856323a..90a19c95d 100644 --- a/app/assets/javascripts/app/views/data_privacy/preview.jst.eco +++ b/app/assets/javascripts/app/views/data_privacy/preview.jst.eco @@ -14,7 +14,7 @@

<%- @T('Warning') %>

-

<%- @T('There is no rollback of this deletion possible. If you are absolutely sure to do this, then type in "%s" into the input.', App.i18n.translateInline('delete').toUpperCase()) %>

+

<%- @T('There is no rollback of this deletion possible. If you are absolutely sure to do this, then type in "%s" into the input.', App.i18n.translatePlain('delete').toUpperCase()) %>

<%- @sure_html %>
diff --git a/spec/system/ticket/create_spec.rb b/spec/system/ticket/create_spec.rb index 46a002012..2de392e32 100644 --- a/spec/system/ticket/create_spec.rb +++ b/spec/system/ticket/create_spec.rb @@ -563,6 +563,25 @@ RSpec.describe 'Ticket Create', type: :system do end end + context 'when state options have a special translation', authenticated_as: :authenticate do + let(:admin_de) { create(:admin, preferences: { locale: 'de-de' }) } + + context 'when translated state option has a single quote' do + def authenticate + open_tranlation = Translation.where(locale: 'de-de', source: 'open') + open_tranlation.update(target: "off'en") + + admin_de + end + + it 'shows the translated state options correctly' do + visit 'ticket/create' + + expect(page).to have_select('state_id', with_options: ["off'en"]) + end + end + end + describe 'It should be possible to show attributes which are configured shown false #3726', authenticated_as: :authenticate, db_strategy: :reset do let(:field_name) { SecureRandom.uuid } let(:field) do