Added some loc work for documents

This commit is contained in:
Rick Falkvinge
2018-02-10 16:10:40 +01:00
parent 1c586c2fdd
commit 73078e31c9
2 changed files with 35 additions and 25 deletions
+29 -24
View File
@@ -45,30 +45,7 @@ namespace Swarmops.Logic.Support
int currentPage = Int32.Parse(match.Groups["current"].Value);
int totalPages = Int32.Parse(match.Groups["total"].Value);
if (currentPage == 1 && totalPages == 1)
{
// Single page
return input + Resources.Logic_Support_Document.PageSingle;
}
if (currentPage == 1)
{
// First page of X
return input + String.Format(Resources.Logic_Support_Document.PageOneOfX, totalPages);
}
if (currentPage == totalPages)
{
// Last page of X
return input + String.Format(Resources.Logic_Support_Document.LastPageOfX, totalPages);
}
// Page X of Y
return input + String.Format(Resources.Logic_Support_Document.PageXofY, currentPage, totalPages);
return input + GetLocalizedPageCounter(currentPage, totalPages);
}
// No localization
@@ -105,6 +82,34 @@ namespace Swarmops.Logic.Support
}
}
public static string GetLocalizedPageCounter(int currentPage, int totalPages)
{
if (currentPage == 1 && totalPages == 1)
{
// Single page
return Resources.Logic_Support_Document.PageSingle;
}
if (currentPage == 1)
{
// First page of X
return String.Format(Resources.Logic_Support_Document.PageOneOfX, totalPages);
}
if (currentPage == totalPages)
{
// Last page of X
return String.Format(Resources.Logic_Support_Document.LastPageOfX, totalPages);
}
// Page X of Y
return String.Format(Resources.Logic_Support_Document.PageXofY, currentPage, totalPages);
}
public static string StorageRoot
{
get
+6 -1
View File
@@ -116,13 +116,18 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
Documents documents = Documents.ForObject(tx.Dependency ?? tx); // tx.Dependency if not null, else tx
int pageCounter = 0;
int pagesTotal = documents.Count;
foreach (Document doc in documents)
{
pageCounter++;
VatReportDocuments.Add(new RepeatedDocument
{
BaseId = item.FinancialTransactionId.ToString(CultureInfo.InvariantCulture),
DocId = doc.Identity,
Title = tx.Description
Title = tx.Description + " " + Document.GetLocalizedPageCounter(pageCounter, pagesTotal)
});
}
}