Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathoschild committed Nov 7, 2024
2 parents 4daed27 + b4e2511 commit 2f98438
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 33 deletions.
2 changes: 1 addition & 1 deletion build/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repo. It imports the other MSBuild files as needed.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--set general build properties -->
<Version>4.1.4</Version>
<Version>4.1.5</Version>
<Product>SMAPI</Product>
<LangVersion>latest</LangVersion>
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
Expand Down
10 changes: 10 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
[README](README.md)

# Release notes
## 4.1.5
Released 07 November 2024 for Stardew Valley 1.6.10 or later.

* For players:
* Updated mod compatibility list.
* Fixed translation issues in some mods with SMAPI 4.1._x_.

* For mod authors:
* Fixed `translation.UsePlaceholder(false)` also disabling custom fallback text in recent builds, not just the "no translation" placeholder.

## 4.1.4
Released 05 November 2024 for Stardew Valley 1.6.10 or later.

Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.ConsoleCommands/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
"Version": "4.1.4",
"Version": "4.1.5",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
"MinimumApiVersion": "4.1.4"
"MinimumApiVersion": "4.1.5"
}
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.SaveBackup/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Save Backup",
"Author": "SMAPI",
"Version": "4.1.4",
"Version": "4.1.5",
"Description": "Automatically backs up all your saves once per day into its folder.",
"UniqueID": "SMAPI.SaveBackup",
"EntryDll": "SaveBackup.dll",
"MinimumApiVersion": "4.1.4"
"MinimumApiVersion": "4.1.5"
}
46 changes: 38 additions & 8 deletions src/SMAPI.Web/wwwroot/SMAPI.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@
"ID": "Entoarox.EntoaroxFramework",
"Default | UpdateKey": "Nexus:2269"
},
"JSON Assets": {
"ID": "spacechase0.JsonAssets",
"Default | UpdateKey": "Nexus:1720"
},
"Mail Framework": {
"ID": "DIGUS.MailFrameworkMod",
"Default | UpdateKey": "Nexus:1536"
Expand All @@ -98,10 +94,6 @@
"ID": "Omegasis.StardustCore",
"Default | UpdateKey": "Nexus:2341"
},
"TMXL Map Toolkit": {
"ID": "Platonymous.TMXLoader",
"Default | UpdateKey": "Nexus:1820"
},

/*********
** Obsolete
Expand Down Expand Up @@ -148,6 +140,44 @@
"~ | StatusReasonPhrase": "split-screen mode was added in Stardew Valley 1.5. You can delete this mod."
},

/*********
** Broke in SDV 1.6.9
*********/
"Catalogue Indicator": {
"ID": "com.anthonyhilyard.CatalogueIndicator",
"~1.0.0 | Status": "AssumeBroken",
"~1.0.0 | StatusReasonDetails": "ItemStockInformation references crash at runtime"
},
"Heart Event Helper": {
"ID": "bungus.HeartEventHelper",
"~1.0.6 | Status": "AssumeBroken",
"~1.0.6 | StatusReasonDetails": "breaks question dialogues (e.g. Lewis' start-festival-event question)"
},
"Json Assets": {
"ID": "spacechase0.JsonAssets",
"~1.1.18 | Status": "AssumeBroken",
"~1.1.18 | StatusReasonDetails": "ItemStockInformation references crash at runtime",

"Default | UpdateKey": "Nexus:1720"
},
"Shop Tile Framework": {
"ID": "Cherry.ShopTileFramework",
"~1.0.10-alpha-20240227 | Status": "AssumeBroken",
"~1.0.10-alpha-20240227 | StatusReasonDetails": "ItemStockInformation references crash at runtime"
},
"Swim (FlyingTNT)": {
"ID": "FlyingTNT.Swim",
"~1.6.4 | Status": "AssumeBroken",
"~1.6.4 | StatusReasonDetails": "Harmony patches fail at runtime"
},
"TMXL Map Toolkit": {
"ID": "Platonymous.TMXLoader",
"~1.24.3-alpha.20240226 | Status": "AssumeBroken",
"~1.24.3-alpha.20240226 | StatusReasonDetails": "Harmony patches fail at runtime",

"Default | UpdateKey": "Nexus:1820"
},

/*********
** Broke in SDV 1.6
*********/
Expand Down
2 changes: 1 addition & 1 deletion src/SMAPI/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal static class EarlyConstants
internal static int? LogScreenId { get; set; }

/// <summary>SMAPI's current raw semantic version.</summary>
internal static string RawApiVersion = "4.1.4";
internal static string RawApiVersion = "4.1.5";
}

/// <summary>Contains SMAPI's constants and assumptions.</summary>
Expand Down
40 changes: 21 additions & 19 deletions src/SMAPI/Translation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public class Translation
/// <summary>The underlying translation text.</summary>
private readonly string? Text;

/// <summary>The value to return if the translations is undefined.</summary>
private string? Placeholder { get; init; }
/// <summary>The custom value to return if the translations is undefined.</summary>
private string? CustomDefault { get; init; }

/// <summary>Whether to use <see cref="Placeholder"/> if the translation is <c>null</c> or empty.</summary>
/// <summary>Whether to show a placeholder if the <see cref="Text"/> and <see cref="CustomDefault"/> are both is <c>null</c> or empty.</summary>
private bool ShouldUsePlaceholder { get; init; }

/// <summary>Whether to process gender-switch blocks in translation text, if any.</summary>
Expand Down Expand Up @@ -65,7 +65,6 @@ internal Translation(string locale, string key, string? text)
this.Locale = locale;
this.Key = key;
this.Text = text;
this.Placeholder = string.Format(Translation.PlaceholderText, key);
this.ShouldUsePlaceholder = true;
this.ShouldApplyGenderSwitchBlocks = true;
}
Expand All @@ -75,28 +74,27 @@ internal Translation(string locale, string key, string? text)
internal Translation(Translation other)
: this(other.Locale, other.Key, other.Text)
{
this.Placeholder = other.Placeholder;
this.CustomDefault = other.CustomDefault;
this.ShouldUsePlaceholder = other.ShouldUsePlaceholder;
this.ShouldApplyGenderSwitchBlocks = other.ShouldApplyGenderSwitchBlocks;
this.TokenValues = other.TokenValues;
this.ForceGender = other.ForceGender;
}

/// <summary>Replace the text if it's <c>null</c> or empty. If you set a <c>null</c> or empty value, the translation will show the fallback "no translation" placeholder (see <see cref="UsePlaceholder"/> if you want to disable that).</summary>
/// <summary>The custom text to use if the text is <c>null</c> or empty. If set to <c>null</c> or empty value, defaults to a fallback "no translation" placeholder unless you disable that via <see cref="UsePlaceholder"/>.</summary>
/// <param name="default">The default value.</param>
/// <remarks>Returns a new instance if this would change the result, else the current instance.</remarks>
public Translation Default(string? @default)
{
if (this.HasValue())
return this;
if (string.IsNullOrEmpty(@default))
@default = null;

string placeholder = string.IsNullOrEmpty(@default)
? string.Format(Translation.PlaceholderText, this.Key)
: @default;
if (this.HasValue() || @default == this.CustomDefault)
return this;

return new Translation(this)
{
Placeholder = placeholder
CustomDefault = @default
};
}

Expand Down Expand Up @@ -160,18 +158,22 @@ public bool HasValue()
}

/// <summary>Get the translation text. Calling this method isn't strictly necessary, since you can assign a <see cref="Translation"/> value directly to a string.</summary>
/// <remarks><strong>Limitation with nullable reference types: if there's no text and you disabled the fallback via <see cref="UsePlaceholder"/>, this will return null but the return value will still be marked non-nullable.</strong></remarks>
/// <remarks><strong>Limitation with nullable reference types: if there's no text, no <see cref="Default"/>, and you disabled the fallback via <see cref="UsePlaceholder"/>, this will return null but the return value will still be marked non-nullable.</strong></remarks>
public override string ToString()
{
if (!this.Cached)
{
string? rawText = this.FormatText(
this.ShouldUsePlaceholder && !this.HasValue()
? this.Placeholder
: this.Text
);
string? rawText;
if (this.HasValue())
rawText = this.Text;
else if (this.CustomDefault != null)
rawText = this.CustomDefault;
else if (this.ShouldUsePlaceholder)
rawText = string.Format(Translation.PlaceholderText, this.Key);
else
rawText = null;

this.CachedResult = rawText;
this.CachedResult = this.FormatText(rawText);
this.Cached = true;
}

Expand Down

0 comments on commit 2f98438

Please sign in to comment.