Skip to content

Commit

Permalink
Fixes #5139 - Unable to send WhatsApp automatic reminders after 23 ho…
Browse files Browse the repository at this point in the history
…urs.

Co-authored-by: Tobias Schäfer <ts@zammad.com>
  • Loading branch information
fliebe92 and tschaefer committed Apr 22, 2024
1 parent f7fde26 commit d62b0f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/translation.rb
Expand Up @@ -77,7 +77,7 @@ def self.lang(locale)
=end

def self.translate(locale, string, *args)
translated = find_source(locale, string)&.target || string
translated = find_source(locale, string)&.target.presence || string

translated %= args if args.any?

Expand Down
11 changes: 11 additions & 0 deletions spec/models/translation_spec.rb
Expand Up @@ -36,6 +36,17 @@
end
end

context 'default string translations with fallback' do
before do
create(:translation, locale: 'de-de', source: 'dummy message', target: '', target_initial: '')
described_class.sync_locale_from_po('de-de')
end

it 'fallbacks to provided message/string when de-de is empty' do
expect(described_class.translate('de-de', 'dummy message')).to eq('dummy message')
end
end

context 'when using find_source' do
it 'de-de with existing title case word' do
expect(described_class.find_source('de-de', 'New')).to have_attributes(source: 'New', target_initial: 'Neu', target: 'Neu')
Expand Down

0 comments on commit d62b0f5

Please sign in to comment.