Follow-up: 1f5d1bf8d3 - Increase translation string length to handle existing description strings properly.

This commit is contained in:
Martin Gruner 2021-11-26 08:08:02 +01:00 committed by Rolf Schmidt
parent f0ffe24b4e
commit d5f48bb195
12 changed files with 46 additions and 58 deletions

View file

@ -23,8 +23,8 @@ class App.Sla extends App.Model
@description = __(''' @description = __('''
** Service Level Agreements **, abbreviated ** SLAs **, help you to meet certain customers' time-related responses. Thus, for example, you can say customers should always get a response from you after 8 hours at the latest. In the event of an imminent violation or a breach, Zammad will alert you to such events. ** Service Level Agreements **, abbreviated ** SLAs **, help you to meet certain customers' time-related responses. Thus, for example, you can say customers should always get a response from you after 8 hours at the latest. In the event of an imminent violation or a breach, Zammad will alert you to such events.
''') + '\n\n' + __('''
It can be ** response time ** (time between the creation of a ticket and the first reaction of an agent), ** update time ** (time between a customer's request and an agent's reaction) and ** solution time ** (time between creation and closing a ticket ) To be defined. It can be ** response time ** (time between the creation of a ticket and the first reaction of an agent), ** update time ** (time between a customer's request and an agent's reaction) and ** solution time ** (time between creation and closing a ticket ) To be defined.
''') + '\n\n' + __('''
Any violations are displayed in a separate view in the overviews. You can also configure ** e-mail notifications **. Any violations are displayed in a separate view in the overviews. You can also configure ** e-mail notifications **.
''') ''')

View file

@ -39,22 +39,24 @@ class App.TextModule extends App.Model
# coffeelint: disable=no_interpolation_in_single_quotes # coffeelint: disable=no_interpolation_in_single_quotes
@description = __(''' @description = __('''
Create Text Modules to **spend less time writing responses**. Text Modules can include smart variables like the users name or email address. Create Text Modules to **spend less time writing responses**. Text Modules can include smart variables like the users name or email address.
''') + '\n\n' + __('''
Examples of snippets are: Examples of snippets are:
* Hello Mrs. #{ticket.customer.lastname}, * Hello Mrs. #{ticket.customer.lastname},
* Hello Mr. #{ticket.customer.lastname}, * Hello Mr. #{ticket.customer.lastname},
* Hello #{ticket.customer.firstname}, * Hello #{ticket.customer.firstname},
* My Name is #{user.firstname}, * My Name is #{user.firstname},
''') + '\n\n' + __('''
Of course you can also use multi line snippets. Of course you can also use multi line snippets.
''') + '\n\n' + __('''
Available objects are: Available objects are:
* ticket (e. g. ticket.state, ticket.group) * ticket (e. g. ticket.state, ticket.group)
* ticket.customer (e. g. ticket.customer.firstname, ticket.customer.lastname) * ticket.customer (e. g. ticket.customer.firstname, ticket.customer.lastname)
* ticket.owner (e. g. ticket.owner.firstname, ticket.owner.lastname) * ticket.owner (e. g. ticket.owner.firstname, ticket.owner.lastname)
* ticket.organization (e. g. ticket.organization.name) * ticket.organization (e. g. ticket.organization.name)
* user (e. g. user.firstname, user.email) * user (e. g. user.firstname, user.email)
''') + '\n\n' + __('''
To select placeholders from a list, just enter "::". To select placeholders from a list, just enter "::".
''') ''')
# coffeelint: enable=no_interpolation_in_single_quotes # coffeelint: enable=no_interpolation_in_single_quotes

View file

@ -17,8 +17,8 @@ class App.Trigger extends App.Model
@description = __(''' @description = __('''
Every time a customer creates a new ticket, they automatically receive a confirmation email to assure them that their issue has been submitted successfully. This behavior is built into Zammad, but its also highly customizable, and you can set up other automated actions just like it. Every time a customer creates a new ticket, they automatically receive a confirmation email to assure them that their issue has been submitted successfully. This behavior is built into Zammad, but its also highly customizable, and you can set up other automated actions just like it.
''') + '\n\n' + __('''
Maybe you want to set a higher priority on any ticket with the word urgent in the title. Maybe you want to avoid sending auto-reply emails to customers from certain organizations. Maybe you want mark a ticket as pending whenever someone adds an internal note to a ticket. Maybe you want to set a higher priority on any ticket with the word urgent in the title. Maybe you want to avoid sending auto-reply emails to customers from certain organizations. Maybe you want mark a ticket as pending whenever someone adds an internal note to a ticket.
''') + '\n\n' + __('''
Whatever it is, you can do it with triggers: actions that watch tickets for certain changes, and then fire off whenever those changes occur. Whatever it is, you can do it with triggers: actions that watch tickets for certain changes, and then fire off whenever those changes occur.
''') ''')

View file

@ -23,8 +23,8 @@ module Translation::SynchronizesFromPo
strings_for_locale(locale).each_pair do |source, entry| # rubocop:disable Metrics/BlockLength strings_for_locale(locale).each_pair do |source, entry| # rubocop:disable Metrics/BlockLength
if source.length > 500 || entry.translation.length > 500 if source.length > 3000 || entry.translation.length > 3000
Rails.logger.error "Cannot import translation for locale #{locale} because it exceeds maximum string length of 500: source: '#{source}', translation: '#{entry.translation}'" Rails.logger.error "Cannot import translation for locale #{locale} because it exceeds maximum string length of 3000: source: '#{source}', translation: '#{entry.translation}'"
next next
end end

View file

@ -227,15 +227,15 @@ class CreateBase < ActiveRecord::Migration[4.2]
add_index :locales, [:name], unique: true add_index :locales, [:name], unique: true
create_table :translations do |t| create_table :translations do |t|
t.string :locale, limit: 10, null: false t.string :locale, limit: 10, null: false
t.string :source, limit: 500, null: false t.string :source, limit: 3000, null: false
t.string :target, limit: 500, null: false t.string :target, limit: 3000, null: false
t.string :target_initial, limit: 500, null: false t.string :target_initial, limit: 3000, null: false
t.boolean :is_synchronized_from_codebase, null: false, default: false t.boolean :is_synchronized_from_codebase, null: false, default: false
t.string :synchronized_from_translation_file, limit: 255 t.string :synchronized_from_translation_file, limit: 255
t.integer :updated_by_id, null: false t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false t.integer :created_by_id, null: false
t.timestamps limit: 3, null: false t.timestamps limit: 3, null: false
end end
add_index :translations, [:source], length: 255 add_index :translations, [:source], length: 255
add_index :translations, [:locale] add_index :translations, [:locale]

View file

@ -0,0 +1,14 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
class TranslationStringLength < ActiveRecord::Migration[6.0]
def change
# return if it's a new setup
return if !Setting.exists?(name: 'system_init_done')
# Increase translation string length from 500 to 3000.
change_column(:translations, :source, :string, limit: 3000)
change_column(:translations, :target, :string, limit: 3000)
change_column(:translations, :target_initial, :string, limit: 3000)
Translation.reset_column_information
end
end

View file

@ -245,7 +245,7 @@ msgid "** Data Privacy **, helps you to delete and verify the removal of existin
msgstr "" msgstr ""
#: app/assets/javascripts/app/models/sla.coffee #: app/assets/javascripts/app/models/sla.coffee
msgid "** Service Level Agreements **, abbreviated ** SLAs **, help you to meet certain customers' time-related responses. Thus, for example, you can say customers should always get a response from you after 8 hours at the latest. In the event of an imminent violation or a breach, Zammad will alert you to such events." msgid "** Service Level Agreements **, abbreviated ** SLAs **, help you to meet certain customers' time-related responses. Thus, for example, you can say customers should always get a response from you after 8 hours at the latest. In the event of an imminent violation or a breach, Zammad will alert you to such events.\n\nIt can be ** response time ** (time between the creation of a ticket and the first reaction of an agent), ** update time ** (time between a customer's request and an agent's reaction) and ** solution time ** (time between creation and closing a ticket ) To be defined.\n\nAny violations are displayed in a separate view in the overviews. You can also configure ** e-mail notifications **."
msgstr "" msgstr ""
#: app/assets/javascripts/app/controllers/_plugin/keyboard_shortcuts.coffee #: app/assets/javascripts/app/controllers/_plugin/keyboard_shortcuts.coffee
@ -793,10 +793,6 @@ msgstr ""
msgid "Any Recipient" msgid "Any Recipient"
msgstr "" msgstr ""
#: app/assets/javascripts/app/models/sla.coffee
msgid "Any violations are displayed in a separate view in the overviews. You can also configure ** e-mail notifications **."
msgstr ""
#: db/seeds/settings.rb #: db/seeds/settings.rb
msgid "App ID" msgid "App ID"
msgstr "" msgstr ""
@ -1078,10 +1074,6 @@ msgstr ""
msgid "Available for the following roles" msgid "Available for the following roles"
msgstr "" msgstr ""
#: app/assets/javascripts/app/models/text_module.coffee
msgid "Available objects are:\n* ticket (e. g. ticket.state, ticket.group)\n* ticket.customer (e. g. ticket.customer.firstname, ticket.customer.lastname)\n* ticket.owner (e. g. ticket.owner.firstname, ticket.owner.lastname)\n* ticket.organization (e. g. ticket.organization.name)\n* user (e. g. user.firstname, user.email)"
msgstr ""
#: db/seeds/settings.rb #: db/seeds/settings.rb
msgid "Available types for a new ticket" msgid "Available types for a new ticket"
msgstr "" msgstr ""
@ -2085,7 +2077,7 @@ msgid "Create Text Modules"
msgstr "" msgstr ""
#: app/assets/javascripts/app/models/text_module.coffee #: app/assets/javascripts/app/models/text_module.coffee
msgid "Create Text Modules to **spend less time writing responses**. Text Modules can include smart variables like the users name or email address." msgid "Create Text Modules to **spend less time writing responses**. Text Modules can include smart variables like the users name or email address.\n\nExamples of snippets are:\n\n* Hello Mrs. #{ticket.customer.lastname},\n* Hello Mr. #{ticket.customer.lastname},\n* Hello #{ticket.customer.firstname},\n* My Name is #{user.firstname},\n\nOf course you can also use multi line snippets.\n\nAvailable objects are:\n* ticket (e. g. ticket.state, ticket.group)\n* ticket.customer (e. g. ticket.customer.firstname, ticket.customer.lastname)\n* ticket.owner (e. g. ticket.owner.firstname, ticket.owner.lastname)\n* ticket.organization (e. g. ticket.organization.name)\n* user (e. g. user.firstname, user.email)\n\nTo select placeholders from a list, just enter \"::\".\n"
msgstr "" msgstr ""
#: app/controllers/first_steps_controller.rb #: app/controllers/first_steps_controller.rb
@ -3745,7 +3737,7 @@ msgid "Every category in your knowledge base should be given a unique icon for m
msgstr "" msgstr ""
#: app/assets/javascripts/app/models/trigger.coffee #: app/assets/javascripts/app/models/trigger.coffee
msgid "Every time a customer creates a new ticket, they automatically receive a confirmation email to assure them that their issue has been submitted successfully. This behavior is built into Zammad, but its also highly customizable, and you can set up other automated actions just like it." msgid "Every time a customer creates a new ticket, they automatically receive a confirmation email to assure them that their issue has been submitted successfully. This behavior is built into Zammad, but its also highly customizable, and you can set up other automated actions just like it.\n\nMaybe you want to set a higher priority on any ticket with the word “urgent” in the title. Maybe you want to avoid sending auto-reply emails to customers from certain organizations. Maybe you want mark a ticket as “pending” whenever someone adds an internal note to a ticket.\n\nWhatever it is, you can do it with triggers: actions that watch tickets for certain changes, and then fire off whenever those changes occur."
msgstr "" msgstr ""
#: app/assets/javascripts/app/views/api.jst.eco #: app/assets/javascripts/app/views/api.jst.eco
@ -3765,10 +3757,6 @@ msgstr ""
msgid "Examples" msgid "Examples"
msgstr "" msgstr ""
#: app/assets/javascripts/app/models/text_module.coffee
msgid "Examples of snippets are:\n* Hello Mrs. #{ticket.customer.lastname},\n* Hello Mr. #{ticket.customer.lastname},\n* Hello #{ticket.customer.firstname},\n* My Name is #{user.firstname},"
msgstr ""
#: app/assets/javascripts/app/controllers/_manage/ticket_auto_assignment.coffee #: app/assets/javascripts/app/controllers/_manage/ticket_auto_assignment.coffee
msgid "Exception users" msgid "Exception users"
msgstr "" msgstr ""
@ -5138,10 +5126,6 @@ msgstr ""
msgid "Ionicons" msgid "Ionicons"
msgstr "" msgstr ""
#: app/assets/javascripts/app/models/sla.coffee
msgid "It can be ** response time ** (time between the creation of a ticket and the first reaction of an agent), ** update time ** (time between a customer's request and an agent's reaction) and ** solution time ** (time between creation and closing a ticket ) To be defined."
msgstr ""
#: app/assets/javascripts/app/controllers/ticket_overview.coffee #: app/assets/javascripts/app/controllers/ticket_overview.coffee
msgid "Items per page" msgid "Items per page"
msgstr "" msgstr ""
@ -5681,10 +5665,6 @@ msgstr ""
msgid "May" msgid "May"
msgstr "" msgstr ""
#: app/assets/javascripts/app/models/trigger.coffee
msgid "Maybe you want to set a higher priority on any ticket with the word “urgent” in the title. Maybe you want to avoid sending auto-reply emails to customers from certain organizations. Maybe you want mark a ticket as “pending” whenever someone adds an internal note to a ticket."
msgstr ""
#: app/assets/javascripts/app/views/layout_ref/organization_profile.jst.eco #: app/assets/javascripts/app/views/layout_ref/organization_profile.jst.eco
#: app/assets/javascripts/app/views/organization_profile/object.jst.eco #: app/assets/javascripts/app/views/organization_profile/object.jst.eco
#: app/assets/javascripts/app/views/popover/organization.jst.eco #: app/assets/javascripts/app/views/popover/organization.jst.eco
@ -6693,10 +6673,6 @@ msgstr ""
msgid "October" msgid "October"
msgstr "" msgstr ""
#: app/assets/javascripts/app/models/text_module.coffee
msgid "Of course you can also use multi line snippets."
msgstr ""
#: app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee #: app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee
#: db/seeds/settings.rb #: db/seeds/settings.rb
msgid "Office 365" msgid "Office 365"
@ -10364,10 +10340,6 @@ msgstr ""
msgid "What values of %s should be synced to users." msgid "What values of %s should be synced to users."
msgstr "" msgstr ""
#: app/assets/javascripts/app/models/trigger.coffee
msgid "Whatever it is, you can do it with triggers: actions that watch tickets for certain changes, and then fire off whenever those changes occur."
msgstr ""
#: app/assets/javascripts/app/controllers/_integration/slack.coffee #: app/assets/javascripts/app/controllers/_integration/slack.coffee
msgid "When notification is being sent." msgid "When notification is being sent."
msgstr "" msgstr ""

View file

@ -17,8 +17,8 @@ class Generators::TranslationCatalog::Extractor::Base
def validate_strings def validate_strings
@strings.to_a.each do |s| @strings.to_a.each do |s|
if s.length > 500 if s.length > 3000
raise "Found a string that longer than than the allowed 500 characters: '#{s}'" raise "Found a string that longer than than the allowed 3000 characters: '#{s}'"
end end
end end
end end

View file

@ -44,12 +44,12 @@ RSpec.describe Generators::TranslationCatalog::Extractor::Erb do
context 'with strings too long' do context 'with strings too long' do
let(:string) do let(:string) do
<<~"CODE" <<~"CODE"
<%= t("#{'a' * 501}") %> <%= t("#{'a' * 3001}") %>
CODE CODE
end end
it 'raises an error' do it 'raises an error' do
expect { result_strings }.to raise_error(%r{Found a string that longer than than the allowed 500 characters}) expect { result_strings }.to raise_error(%r{Found a string that longer than than the allowed 3000 characters})
end end
end end
end end

View file

@ -46,12 +46,12 @@ RSpec.describe Generators::TranslationCatalog::Extractor::Frontend do
context 'with strings too long' do context 'with strings too long' do
let(:string) do let(:string) do
<<~"CODE" <<~"CODE"
__("#{'a' * 501}") __("#{'a' * 3001}")
CODE CODE
end end
it 'raises an error' do it 'raises an error' do
expect { result_strings }.to raise_error(%r{Found a string that longer than than the allowed 500 characters}) expect { result_strings }.to raise_error(%r{Found a string that longer than than the allowed 3000 characters})
end end
end end
end end

View file

@ -45,12 +45,12 @@ RSpec.describe Generators::TranslationCatalog::Extractor::Ruby do
context 'with strings too long' do context 'with strings too long' do
let(:string) do let(:string) do
<<~"CODE" <<~"CODE"
__("#{'a' * 501}") __("#{'a' * 3001}")
CODE CODE
end end
it 'raises an error' do it 'raises an error' do
expect { result_strings }.to raise_error(%r{Found a string that longer than than the allowed 500 characters}) expect { result_strings }.to raise_error(%r{Found a string that longer than than the allowed 3000 characters})
end end
end end
end end

View file

@ -178,7 +178,7 @@ RSpec.describe Translation do
msgstr "custom-string-übersetzt" msgstr "custom-string-übersetzt"
msgid "custom-string-too-long" msgid "custom-string-too-long"
msgstr "custom-string-too-long #{'a' * 501}" msgstr "custom-string-too-long #{'a' * 3001}"
msgid "custom-string-untranslated" msgid "custom-string-untranslated"
msgstr "" msgstr ""