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 = __('''
** 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.
''') + '\n\n' + __('''
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
@description = __('''
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:
* Hello Mrs. #{ticket.customer.lastname},
* Hello Mr. #{ticket.customer.lastname},
* Hello #{ticket.customer.firstname},
* My Name is #{user.firstname},
''') + '\n\n' + __('''
Of course you can also use multi line snippets.
''') + '\n\n' + __('''
Available objects are:
* ticket (e. g. ticket.state, ticket.group)
* ticket.customer (e. g. ticket.customer.firstname, ticket.customer.lastname)
* ticket.owner (e. g. ticket.owner.firstname, ticket.owner.lastname)
* ticket.organization (e. g. ticket.organization.name)
* user (e. g. user.firstname, user.email)
''') + '\n\n' + __('''
To select placeholders from a list, just enter "::".
''')
# coffeelint: enable=no_interpolation_in_single_quotes

View file

@ -17,8 +17,8 @@ class App.Trigger extends App.Model
@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.
''') + '\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.
''') + '\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.
''')

View file

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

View file

@ -227,15 +227,15 @@ class CreateBase < ActiveRecord::Migration[4.2]
add_index :locales, [:name], unique: true
create_table :translations do |t|
t.string :locale, limit: 10, null: false
t.string :source, limit: 500, null: false
t.string :target, limit: 500, null: false
t.string :target_initial, limit: 500, null: false
t.boolean :is_synchronized_from_codebase, null: false, default: false
t.string :locale, limit: 10, null: false
t.string :source, limit: 3000, null: false
t.string :target, limit: 3000, null: false
t.string :target_initial, limit: 3000, null: false
t.boolean :is_synchronized_from_codebase, null: false, default: false
t.string :synchronized_from_translation_file, limit: 255
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps limit: 3, null: false
t.integer :updated_by_id, null: false
t.integer :created_by_id, null: false
t.timestamps limit: 3, null: false
end
add_index :translations, [:source], length: 255
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 ""
#: 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 ""
#: app/assets/javascripts/app/controllers/_plugin/keyboard_shortcuts.coffee
@ -793,10 +793,6 @@ msgstr ""
msgid "Any Recipient"
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
msgid "App ID"
msgstr ""
@ -1078,10 +1074,6 @@ msgstr ""
msgid "Available for the following roles"
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
msgid "Available types for a new ticket"
msgstr ""
@ -2085,7 +2077,7 @@ msgid "Create Text Modules"
msgstr ""
#: 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 ""
#: 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 ""
#: 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 ""
#: app/assets/javascripts/app/views/api.jst.eco
@ -3765,10 +3757,6 @@ msgstr ""
msgid "Examples"
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
msgid "Exception users"
msgstr ""
@ -5138,10 +5126,6 @@ msgstr ""
msgid "Ionicons"
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
msgid "Items per page"
msgstr ""
@ -5681,10 +5665,6 @@ msgstr ""
msgid "May"
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/organization_profile/object.jst.eco
#: app/assets/javascripts/app/views/popover/organization.jst.eco
@ -6693,10 +6673,6 @@ msgstr ""
msgid "October"
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
#: db/seeds/settings.rb
msgid "Office 365"
@ -10364,10 +10340,6 @@ msgstr ""
msgid "What values of %s should be synced to users."
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
msgid "When notification is being sent."
msgstr ""

View file

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

View file

@ -44,12 +44,12 @@ RSpec.describe Generators::TranslationCatalog::Extractor::Erb do
context 'with strings too long' do
let(:string) do
<<~"CODE"
<%= t("#{'a' * 501}") %>
<%= t("#{'a' * 3001}") %>
CODE
end
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

View file

@ -46,12 +46,12 @@ RSpec.describe Generators::TranslationCatalog::Extractor::Frontend do
context 'with strings too long' do
let(:string) do
<<~"CODE"
__("#{'a' * 501}")
__("#{'a' * 3001}")
CODE
end
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

View file

@ -45,12 +45,12 @@ RSpec.describe Generators::TranslationCatalog::Extractor::Ruby do
context 'with strings too long' do
let(:string) do
<<~"CODE"
__("#{'a' * 501}")
__("#{'a' * 3001}")
CODE
end
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

View file

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