Translate BaseLayout warnings

This commit is contained in:
jvyden 2022-08-02 09:47:31 -04:00
parent 4756560a6a
commit 3e1d5da3a9
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
4 changed files with 46 additions and 14 deletions

View file

@ -71,4 +71,22 @@
<data name="generated_modified" xml:space="preserve">
<value>This page was generated using a modified version of Project Lighthouse. Please make sure you are properly disclosing the source code to any users who may be using this instance.</value>
</data>
<data name="js_warn" xml:space="preserve">
<value>While we intend to have as little JavaScript as possible, we can not guarantee everything will work without it. We recommend that you whitelist JavaScript for Project Lighthouse.</value>
</data>
<data name="js_warn_title" xml:space="preserve">
<value>JavaScript is not enabled</value>
</data>
<data name="license_warn_title" xml:space="preserve">
<value>Potential License Violation</value>
</data>
<data name="license_warn_1" xml:space="preserve">
<value>This instance is a public-facing instance that has been modified without the changes published. You may be in violation of the {0}.</value>
</data>
<data name="license_warn_2" xml:space="preserve">
<value>If you believe this is an error, please create an issue with the output of {0} ran from the root of the server source code in the description on our {1}issue tracker{2}.</value>
</data>
<data name="license_warn_3" xml:space="preserve">
<value>If not, please publish the source code somewhere accessible to your users.</value>
</data>
</root>

View file

@ -49,7 +49,7 @@ public static class LocalizationManager
return $"{translationArea.ToString()}.{language}.{key}";
}
return localizedString;
return localizedString.Replace("\\n", "\n");
}
// If a language isn't working, it might be because a language is using a different name than what ASP.NET expects.

View file

@ -16,5 +16,12 @@ public static class BaseLayoutStrings
public static readonly TranslatableString GeneratedBy = create("generated_by");
public static readonly TranslatableString GeneratedModified = create("generated_modified");
public static readonly TranslatableString JavaScriptWarnTitle = create("js_warn_title");
public static readonly TranslatableString JavaScriptWarn = create("js_warn");
public static readonly TranslatableString LicenseWarnTitle = create("license_warn_title");
public static readonly TranslatableString LicenseWarn1 = create("license_warn_1");
public static readonly TranslatableString LicenseWarn2 = create("license_warn_2");
public static readonly TranslatableString LicenseWarn3 = create("license_warn_3");
private static TranslatableString create(string key) => new(TranslationAreas.BaseLayout, key);
}

View file

@ -123,29 +123,36 @@
<div class="ui container">
<div style="display: flex; align-items: center; font-size: 1.2rem;">
<i class="warning icon"></i>
<span style="font-size: 1.2rem;">JavaScript not enabled</span>
<span style="font-size: 1.2rem;">@Model.Translate(BaseLayoutStrings.JavaScriptWarnTitle)</span>
</div>
<p>
While we intend to have as little JavaScript as possible, we can not
guarantee everything will work without it. We recommend that you whitelist JavaScript for Project Lighthouse.
It's not <i>too</i> bloated, we promise.
</p>
<p>@Model.Translate(BaseLayoutStrings.JavaScriptWarn)</p>
</div>
</div>
</noscript>
@* ReSharper disable once CSharpWarnings::CS0162 *@
@if (!ServerStatics.IsDebug && VersionHelper.IsDirty)
{
@* ReSharper disable HeuristicUnreachableCode *@
@* ReSharper disable CSharpWarnings::CS0162 *@
@* @if (!ServerStatics.IsDebug && VersionHelper.IsDirty) *@
@{
<div class="ui bottom attached red message large">
<div class="ui container">
<i class="warning icon"></i>
<span style="font-size: 1.2rem;">Potential License Violation</span>
<p>This instance is a public-facing instance that has been modified without the changes published. You may be in violation of the <a href="https://github.com/LBPUnion/project-lighthouse/blob/main/LICENSE">GNU Affero General Public License v3.0</a>.</p>
<p>If you believe this is an error, please create an issue with the output of <code>git status</code> ran from the root of the server source code in the description on our <a href="https://github.com/LBPUnion/project-lighthouse/issues">issue tracker</a>.</p>
<p>If not, please publish the source code somewhere accessible to your users.</p>
<span style="font-size: 1.2rem;">@Model.Translate(BaseLayoutStrings.LicenseWarnTitle)</span>
<p>
@Html.Raw(Model.Translate(BaseLayoutStrings.LicenseWarn1,
"<a href=\"https://github.com/LBPUnion/project-lighthouse/blob/main/LICENSE\">GNU Affero General Public License v3.0</a>"))
</p>
<p>
@Html.Raw(Model.Translate(BaseLayoutStrings.LicenseWarn2,
"<code>git status</code>", "<a href=\"https://github.com/LBPUnion/project-lighthouse/issues\">", "</a>"))
</p>
<p>
@Html.Raw(Model.Translate(BaseLayoutStrings.LicenseWarn3))
</p>
</div>
</div>
}
@* ReSharper restore CSharpWarnings::CS0162 *@
@* ReSharper restore HeuristicUnreachableCode *@
</header>
<div class="main">
<div class="ui container">