/// <summary>
/// Check for either "Device16x9Portrait" or "Device16x9Landscape" layout.
/// Complain to the user if another layout is currently chosen.
/// </summary>
/// <remarks>
/// See https://issues.bloomlibrary.org/youtrack/issue/BL-5274.
/// </remarks>
public static void CheckBookLayout(Bloom.Book.Book book, WebSocketProgress progress)
{
var layout = book.GetLayout();
var desiredLayoutSize = "Device16x9";
if (layout.SizeAndOrientation.PageSizeName != desiredLayoutSize)
{
// The progress object has been initialized to use an id prefix. So we'll access L10NSharp explicitly here. We also want to make the string blue,
// which requires a special argument.
// var msgFormat = L10NSharp.LocalizationManager.GetString("Common.Note",
// "Note", "A heading shown above some messages.");
// progress.MessageWithoutLocalizing(msgFormat, MessageKind.Note);
var msgFormat = L10NSharp.LocalizationManager.GetString("PublishTab.Android.WrongLayout.Message",
"The layout of this book is currently \"{0}\". Bloom Reader will display it using \"{1}\", so text might not fit. To see if anything needs adjusting, go back to the Edit Tab and change the layout to \"{1}\".",
"{0} and {1} are book layout tags.");
var desiredLayout = desiredLayoutSize + layout.SizeAndOrientation.OrientationName;
var msg = String.Format(msgFormat, layout.SizeAndOrientation.ToString(), desiredLayout, Environment.NewLine);
progress.MessageWithoutLocalizing(msg, MessageKind.Note);
}
}