Fix localization return issue.

This commit is contained in:
Haiping Chen 2024-04-23 14:48:30 -05:00
parent 36e569ea28
commit 2add4a6ae8
3 changed files with 5 additions and 3 deletions

View file

@ -17,6 +17,7 @@ public class ElementButton
public string Title { get; set; } = string.Empty;
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[Translate]
public string Payload { get; set; }
[JsonPropertyName("is_primary")]
@ -30,5 +31,6 @@ public class ElementButton
[JsonPropertyName("post_action_disclaimer")]
[JsonProperty("post_action_disclaimer")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[Translate]
public string? PostActionDisclaimer { get; set; }
}

View file

@ -130,7 +130,7 @@ public partial class ConversationService
response.RichContent is RichContent<IRichMessage> template &&
string.IsNullOrEmpty(template.Message.Text))
{
template.Message.Text = response.Content;
template.Message.Text = response.SecondaryContent ?? response.Content;
}
// Only read content from RichContent for UI rendering. When richContent is null, create a basic text message for richContent.
@ -138,7 +138,7 @@ public partial class ConversationService
response.RichContent = response.RichContent ?? new RichContent<IRichMessage>
{
Recipient = new Recipient { Id = state.GetConversationId() },
Message = new TextMessage(response.Content)
Message = new TextMessage(response.SecondaryContent ?? response.Content)
};
// Patch return function name

View file

@ -162,7 +162,7 @@ public partial class RoutingService : IRoutingService
}
else
{
response.Content = await translator.Translate(_router,
response.SecondaryContent = await translator.Translate(_router,
message.MessageId,
response.Content,
language: inst.Language);