summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/README.md2
-rw-r--r--docs/release-notes.md2
-rw-r--r--src/SMAPI.Web/Framework/Extensions.cs14
-rw-r--r--src/SMAPI.Web/Views/JsonValidator/Index.cshtml2
-rw-r--r--src/SMAPI.Web/Views/LogParser/Index.cshtml6
-rw-r--r--src/SMAPI/i18n/pt.json3
6 files changed, 22 insertions, 7 deletions
diff --git a/docs/README.md b/docs/README.md
index 49cf28e4..996e9444 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -70,7 +70,7 @@ Hungarian | ❑ not translated
Italian | ❑ not translated
Japanese | ❑ not translated
Korean | ❑ not translated
-Portuguese | ❑ not translated
+Portuguese | ✓ [fully translated](../src/SMAPI/i18n/pt.json)
Russian | ✓ [fully translated](../src/SMAPI/i18n/ru.json)
Spanish | ✓ [fully translated](../src/SMAPI/i18n/es.json)
Turkish | ✓ [fully translated](../src/SMAPI/i18n/tr.json)
diff --git a/docs/release-notes.md b/docs/release-notes.md
index d31b95e5..6e785982 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -15,7 +15,7 @@
* fixed spawning custom rings added by mods;
* Fixed errors when some item data is invalid.
* Internal optimizations.
- * Updated translations. Thanks to PlussRolf (added Spanish)!
+ * Updated translations. Thanks to L30Bola (added Portuguese) and PlussRolf (added Spanish)!
* For the web UI:
* Added option to edit & reupload in the JSON validator.
diff --git a/src/SMAPI.Web/Framework/Extensions.cs b/src/SMAPI.Web/Framework/Extensions.cs
index d7707924..e0da1424 100644
--- a/src/SMAPI.Web/Framework/Extensions.cs
+++ b/src/SMAPI.Web/Framework/Extensions.cs
@@ -1,4 +1,6 @@
+using System;
using JetBrains.Annotations;
+using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
@@ -12,8 +14,9 @@ namespace StardewModdingAPI.Web.Framework
/// <param name="action">The name of the action method.</param>
/// <param name="controller">The name of the controller.</param>
/// <param name="values">An object that contains route values.</param>
+ /// <param name="absoluteUrl">Get an absolute URL instead of a server-relative path/</param>
/// <returns>The generated URL.</returns>
- public static string PlainAction(this IUrlHelper helper, [AspMvcAction] string action, [AspMvcController] string controller, object values = null)
+ public static string PlainAction(this IUrlHelper helper, [AspMvcAction] string action, [AspMvcController] string controller, object values = null, bool absoluteUrl = false)
{
RouteValueDictionary valuesDict = new RouteValueDictionary(values);
foreach (var value in helper.ActionContext.RouteData.Values)
@@ -22,7 +25,14 @@ namespace StardewModdingAPI.Web.Framework
valuesDict[value.Key] = null; // explicitly remove it from the URL
}
- return helper.Action(action, controller, valuesDict);
+ string url = helper.Action(action, controller, valuesDict);
+ if (absoluteUrl)
+ {
+ HttpRequest request = helper.ActionContext.HttpContext.Request;
+ Uri baseUri = new Uri($"{request.Scheme}://{request.Host}");
+ url = new Uri(baseUri, url).ToString();
+ }
+ return url;
}
}
}
diff --git a/src/SMAPI.Web/Views/JsonValidator/Index.cshtml b/src/SMAPI.Web/Views/JsonValidator/Index.cshtml
index a35fb9bb..a00c8387 100644
--- a/src/SMAPI.Web/Views/JsonValidator/Index.cshtml
+++ b/src/SMAPI.Web/Views/JsonValidator/Index.cshtml
@@ -5,7 +5,7 @@
@{
// get view data
- string curPageUrl = this.Url.PlainAction("Index", "JsonValidator", new { schemaName = Model.SchemaName, id = Model.PasteID });
+ string curPageUrl = this.Url.PlainAction("Index", "JsonValidator", new { schemaName = Model.SchemaName, id = Model.PasteID }, absoluteUrl: true);
string newUploadUrl = this.Url.PlainAction("Index", "JsonValidator", new { schemaName = Model.SchemaName });
string schemaDisplayName = null;
bool isValidSchema = Model.SchemaName != null && Model.SchemaFormats.TryGetValue(Model.SchemaName, out schemaDisplayName) && schemaDisplayName?.ToLower() != "none";
diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
index ac951564..87c7f918 100644
--- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
+++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
@@ -13,6 +13,8 @@
.Cast<LogLevel>()
.ToDictionary(level => level.ToString().ToLower(), level => level != LogLevel.Trace);
JsonSerializerSettings noFormatting = new JsonSerializerSettings { Formatting = Formatting.None };
+
+ string curPageUrl = this.Url.PlainAction("Index", "LogParser", new { id = Model.PasteID }, absoluteUrl: true);
}
@section Head {
@@ -50,7 +52,7 @@ else if (Model.ParseError != null)
{
<div class="banner error" v-pre>
<strong>Oops, couldn't parse that log. (Make sure you upload the log file, not the console text.)</strong><br />
- Share this URL when asking for help: <code>https://@this.Context.Request.Host.ToUriComponent()@this.Url.PlainAction("Index", "LogParser", new { id = Model.PasteID }))</code><br />
+ Share this URL when asking for help: <code>@curPageUrl</code><br />
(Or <a href="@this.Url.PlainAction("Index", "LogParser", values: null)">upload a new log</a>.)<br />
<br />
<small v-pre>Error details: @Model.ParseError</small>
@@ -59,7 +61,7 @@ else if (Model.ParseError != null)
else if (Model.ParsedLog?.IsValid == true)
{
<div class="banner success" v-pre>
- <strong>Share this link to let someone else see the log:</strong> <code>https://@this.Context.Request.Host.ToUriComponent()@this.Url.PlainAction("Index", "LogParser", new { id = Model.PasteID })</code><br />
+ <strong>Share this link to let someone else see the log:</strong> <code>@curPageUrl</code><br />
(Or <a href="@this.Url.PlainAction("Index", "LogParser", values: null)">upload a new log</a>.)
</div>
}
diff --git a/src/SMAPI/i18n/pt.json b/src/SMAPI/i18n/pt.json
new file mode 100644
index 00000000..59273680
--- /dev/null
+++ b/src/SMAPI/i18n/pt.json
@@ -0,0 +1,3 @@
+{
+ "warn.invalid-content-removed": "Conteúdo inválido foi removido para prevenir uma falha (veja o console do SMAPI para mais informações)."
+}