2
I am trying through a rdlc files to configure to fetch translations from a Resource . resx file
public static Stream TranslateReport(Stream reportStream, string partyId)
{
var reportXml = XDocument.Load(reportStream);
foreach (var element in reportXml.Descendants(XName.Get("Value", @"http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition")))
{
var attribute = element.Attribute(XName.Get("LocID", @"http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"));
var rm = new ResourceManager($"TSG.Reporting.Resources._{partyId}.TransportAuthorizationRequestReport", Assembly.GetExecutingAssembly());
var translatedValue = rm.GetString(attribute.Value);
element.Value = string.IsNullOrEmpty(translatedValue) ? element.Value : translatedValue;
}
var ms = new MemoryStream();
reportXml.Save(ms, SaveOptions.OmitDuplicateNamespaces);
ms.Position = 0;
return ms;
}
I found solutions that spoke of use http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition but this source is no longer working
It is also described here though in English https://social.msdn.microsoft.com/Forums/vstudio/en-US/ddff5e7f-2d77-4b64-b66f-9ef3aed041c7/invalid-report-definition-exception-when-creating-report-using-visual-studio-2017?forum=winforms
just create the resx file, and use the key names in the Valuelocid properties so that when generating the reports the texts are replaced
– Ricardo Pontual
@Ricardopunctual I did it and it didn’t work
– Amadeu Antunes
but you didn’t implement the code? you need to use the method
TranslateReport
for the report to be produced using the Resources file, because this process is not automatic– Ricardo Pontual
@Ricardopunctual yes is implemented but something is wrong in this implementation
– Amadeu Antunes
is a little different than I remember... we’ve done this but it’s more like this example, see if it helps you: localization-multi-language-of-a-rdlc-report-with-microsoft-reportviewer
– Ricardo Pontual
https://stackoverflow.com/questions/38902037/ssrs-report-definition-is-newer-than-server
– Amadeu Antunes
Thanks @Ricardopunctual I developed the solution for this problem :)
– Amadeu Antunes