feat(newsletter): Started to localize the newsletter (#4485)

* Abstract media servers content into interfaces

* Media server entities into abstract classes

* Abstract media server content repository

* First pass at newsletter refactoring

* Minor code clean up

* Attempt at abstracting repositories (WIP)

* Fixed cast issue

* Corrected the other properties

* A step towards newsletter refactoring

* Clean up leftovers

* Fix broken episodes db interaction

* Save absolute URL for Plex content

Let's be consistent with Emby and Jellyfin

* Fix broken integration with Plex libraries

* Fix error when multiple media servers configured

* Fix newsletter being sent if no movies or episodes

* Fix broken tests

* Remove unneccesary logs

* Allow for newsletter localization

* Generate file in English

* Fix unsubscribe text unlocalized by messy merge

* Fix indentation

Co-authored-by: tidusjar <tidusjar@gmail.com>
This commit is contained in:
sephrat 2022-02-01 21:32:13 +01:00 committed by GitHub
commit b5ec556243
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 496 additions and 11 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Text;
using Ombi.I18n.Resources;
namespace Ombi.Notifications.Templates
{
@ -31,6 +32,7 @@ namespace Ombi.Notifications.Templates
private const string IntroText = "{@INTRO}";
private const string Unsubscribe = "{@UNSUBSCRIBE}";
private const string UnsubscribeText = "{@UNSUBSCRIBETEXT}";
private const string PoweredByText = "{@POWEREDBYTEXT}";
public string LoadTemplate(string subject, string intro, string tableHtml, string logo, string unsubscribeLink)
@ -42,7 +44,8 @@ namespace Ombi.Notifications.Templates
sb.Replace(DateKey, DateTime.Now.ToString("f"));
sb.Replace(Logo, string.IsNullOrEmpty(logo) ? OmbiLogo : logo);
sb.Replace(Unsubscribe, string.IsNullOrEmpty(unsubscribeLink) ? string.Empty : unsubscribeLink);
sb.Replace(UnsubscribeText, string.IsNullOrEmpty(unsubscribeLink) ? string.Empty : "Unsubscrible");
sb.Replace(UnsubscribeText, string.IsNullOrEmpty(unsubscribeLink) ? string.Empty : Texts.Unsubscribe);
sb.Replace(PoweredByText, Texts.PoweredBy);
return sb.ToString();
}

View file

@ -17,6 +17,7 @@
<None Update="Templates\BasicTemplate.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<ProjectReference Include="..\Ombi.I18n\Ombi.I18n.csproj" />
</ItemGroup>
</Project>

View file

@ -458,7 +458,7 @@
</tr>
<tr>
<td class="content-block powered-by" valign="top" align="center" style="font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; color: #999999; font-size: 12px; text-align: center;">
Powered by <a href="https://github.com/Ombi-app/Ombi" style="font-weight: 400; font-size: 12px; text-align: center; text-decoration: none; color: #ff761b;">Ombi</a>
{@POWEREDBYTEXT} <a href="https://github.com/Ombi-app/Ombi" style="font-weight: 400; font-size: 12px; text-align: center; text-decoration: none; color: #ff761b;">Ombi</a>
</td>
</tr>
</tbody>